mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 14:47:14 +01:00
Support Clickhouse insert without Kafka.
This commit is contained in:
parent
d501410a63
commit
9bf34bd5e4
3 changed files with 23 additions and 4 deletions
|
|
@ -3,6 +3,7 @@ import { DATA_TYPE } from 'lib/constants';
|
|||
import { uuid } from 'lib/crypto';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import { flattenJSON, getStringValue } from 'lib/data';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import { DynamicData } from 'lib/types';
|
||||
|
|
@ -59,6 +60,7 @@ async function clickhouseQuery(data: {
|
|||
}) {
|
||||
const { websiteId, sessionId, eventId, urlPath, eventName, eventData, createdAt } = data;
|
||||
|
||||
const { insert } = clickhouse;
|
||||
const { getDateFormat, sendMessages } = kafka;
|
||||
|
||||
const jsonKeys = flattenJSON(eventData);
|
||||
|
|
@ -79,7 +81,11 @@ async function clickhouseQuery(data: {
|
|||
};
|
||||
});
|
||||
|
||||
await sendMessages(messages, 'event_data');
|
||||
if (kafka.enabled) {
|
||||
await sendMessages(messages, 'event_data');
|
||||
} else {
|
||||
await insert('event_data', messages);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue