Add url_path.

pull/1841/head
Brian Cao 2023-03-21 10:57:50 -07:00
parent da7f02bb73
commit 30d2163610
3 changed files with 12 additions and 4 deletions

View File

@ -102,6 +102,7 @@ CREATE TABLE event_data
session_id UUID,
event_id UUID,
rev_id UInt32,
url_path String,
event_name String,
event_key String,
event_string_value Nullable(String),
@ -111,7 +112,7 @@ CREATE TABLE event_data
created_at DateTime('UTC')
)
engine = MergeTree
ORDER BY (website_id, session_id, created_at)
ORDER BY (website_id, session_id, event_id, event_key, created_at)
SETTINGS index_granularity = 8192;
CREATE TABLE event_data_queue (
@ -119,6 +120,7 @@ CREATE TABLE event_data_queue (
session_id UUID,
event_id UUID,
rev_id UInt32,
url_path String,
event_name String,
event_key String,
event_string_value Nullable(String),
@ -140,6 +142,7 @@ SELECT website_id,
session_id,
event_id,
rev_id,
url_path,
event_name,
event_key,
event_string_value,

View File

@ -102,8 +102,8 @@ async function clickhouseQuery(data: {
subdivision1: subdivision1 ? subdivision1 : null,
subdivision2: subdivision2 ? subdivision2 : null,
city: city ? city : null,
urlPath: urlPath?.substring(0, URL_LENGTH),
urlQuery: urlQuery?.substring(0, URL_LENGTH),
url_path: urlPath?.substring(0, URL_LENGTH),
url_query: urlQuery?.substring(0, URL_LENGTH),
page_title: pageTitle,
event_type: EVENT_TYPE.customEvent,
event_name: eventName?.substring(0, EVENT_NAME_LENGTH),
@ -120,6 +120,7 @@ async function clickhouseQuery(data: {
sessionId,
eventId,
revId: website?.revId,
urlPath: urlPath?.substring(0, URL_LENGTH),
eventName: eventName?.substring(0, EVENT_NAME_LENGTH),
eventData,
createdAt,

View File

@ -9,6 +9,7 @@ export async function saveEventData(args: {
sessionId: string;
eventId: string;
revId: number;
urlPath: string;
eventName: string;
eventData: EventData;
createdAt: string;
@ -36,11 +37,12 @@ async function clickhouseQuery(data: {
sessionId: string;
eventId: string;
revId: number;
urlPath: string;
eventName: string;
eventData: EventData;
createdAt: string;
}) {
const { websiteId, sessionId, eventId, revId, eventName, eventData, createdAt } = data;
const { websiteId, sessionId, eventId, revId, urlPath, eventName, eventData, createdAt } = data;
const { getDateFormat, sendMessages } = kafka;
@ -51,6 +53,7 @@ async function clickhouseQuery(data: {
session_id: sessionId,
event_id: eventId,
rev_id: revId,
url_path: urlPath,
event_name: eventName,
event_key: a.key,
event_string_value:
@ -64,6 +67,7 @@ async function clickhouseQuery(data: {
event_data_type: a.eventDataType,
created_at: createdAt,
}));
``;
await sendMessages(messages, 'event_data');