fix clickhouse date timezone issues
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { CLICKHOUSE, RELATIONAL, KAFKA, URL_LENGTH } from 'lib/constants';
|
||||
import {
|
||||
getDateFormatClickhouse,
|
||||
getDateFormatKafka,
|
||||
prisma,
|
||||
rawQueryClickhouse,
|
||||
runAnalyticsQuery,
|
||||
@@ -50,7 +51,7 @@ async function clickhouseQuery(website_id, { event_uuid, session_uuid, url, even
|
||||
|
||||
return rawQueryClickhouse(
|
||||
`
|
||||
insert into umami_dev.event (created_at, website_id, session_uuid, url, event_name)
|
||||
insert into umami.event (created_at, website_id, session_uuid, url, event_name)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4);`,
|
||||
params,
|
||||
);
|
||||
@@ -61,6 +62,7 @@ async function kafkaQuery(website_id, { event_uuid, session_uuid, url, event_nam
|
||||
event_uuid: event_uuid,
|
||||
website_id: website_id,
|
||||
session_uuid: session_uuid,
|
||||
created_at: getDateFormatKafka(new Date()),
|
||||
url: url?.substr(0, URL_LENGTH),
|
||||
event_name: event_name?.substr(0, 50),
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CLICKHOUSE, RELATIONAL, KAFKA, URL_LENGTH } from 'lib/constants';
|
||||
import {
|
||||
getDateFormatClickhouse,
|
||||
getDateFormatKafka,
|
||||
prisma,
|
||||
rawQueryClickhouse,
|
||||
runAnalyticsQuery,
|
||||
@@ -39,7 +40,7 @@ async function clickhouseQuery(website_id, { session_uuid, url, referrer }) {
|
||||
|
||||
return rawQueryClickhouse(
|
||||
`
|
||||
insert into umami_dev.pageview (created_at, website_id, session_uuid, url, referrer)
|
||||
insert into umami.pageview (created_at, website_id, session_uuid, url, referrer)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4);`,
|
||||
params,
|
||||
);
|
||||
@@ -49,6 +50,7 @@ async function kafkaQuery(website_id, { session_uuid, url, referrer }) {
|
||||
const params = {
|
||||
website_id: website_id,
|
||||
session_uuid: session_uuid,
|
||||
created_at: getDateFormatKafka(new Date()),
|
||||
url: url?.substr(0, URL_LENGTH),
|
||||
referrer: referrer?.substr(0, URL_LENGTH),
|
||||
};
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CLICKHOUSE, RELATIONAL, KAFKA } from 'lib/constants';
|
||||
import {
|
||||
getDateFormatClickhouse,
|
||||
getDateFormatKafka,
|
||||
prisma,
|
||||
rawQueryClickhouse,
|
||||
runAnalyticsQuery,
|
||||
@@ -48,7 +49,7 @@ async function clickhouseQuery(
|
||||
];
|
||||
|
||||
await rawQueryClickhouse(
|
||||
`insert into umami_dev.session (created_at, session_uuid, website_id, hostname, browser, os, device, screen, language, country)
|
||||
`insert into umami.session (created_at, session_uuid, website_id, hostname, browser, os, device, screen, language, country)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4, $5, $6, $7, $8, $9);`,
|
||||
params,
|
||||
);
|
||||
@@ -63,6 +64,7 @@ async function kafkaQuery(
|
||||
const params = {
|
||||
session_uuid: session_uuid,
|
||||
website_id: website_id,
|
||||
created_at: getDateFormatKafka(new Date()),
|
||||
hostname: hostname,
|
||||
browser: browser,
|
||||
os: os,
|
||||
|
||||
Reference in New Issue
Block a user