allow event data CH

This commit is contained in:
Brian Cao 2022-08-30 17:29:30 -07:00
parent f3312732dc
commit 7c05a54ffe
2 changed files with 9 additions and 5 deletions

View File

@ -94,7 +94,7 @@ CREATE TABLE event
created_at DateTime('UTC'),
url String,
event_name String,
event_data String
event_data JSON
)
engine = MergeTree PRIMARY KEY (event_uuid, created_at)
ORDER BY (event_uuid, created_at)

View File

@ -31,15 +31,19 @@ async function relationalQuery(website_id, { session_id, url, event_name, event_
});
}
async function clickhouseQuery(website_id, { event_uuid, session_uuid, url, event_name }) {
async function clickhouseQuery(
website_id,
{ event_uuid, session_uuid, url, event_name, event_data },
) {
const { getDateFormat, sendMessage } = kafka;
const params = {
event_uuid: event_uuid,
website_id: website_id,
session_uuid: session_uuid,
event_uuid,
website_id,
session_uuid,
created_at: getDateFormat(new Date()),
url: url?.substring(0, URL_LENGTH),
event_name: event_name?.substring(0, EVENT_NAME_LENGTH),
event_data: JSON.stringify(event_data),
};
await sendMessage(params, 'event');