mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 16:45:35 +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
|
|
@ -1,5 +1,6 @@
|
|||
import { EVENT_NAME_LENGTH, URL_LENGTH, EVENT_TYPE, PAGE_TITLE_LENGTH } from 'lib/constants';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import kafka from 'lib/kafka';
|
||||
import prisma from 'lib/prisma';
|
||||
import { uuid } from 'lib/crypto';
|
||||
|
|
@ -134,6 +135,7 @@ async function clickhouseQuery(data: {
|
|||
city,
|
||||
...args
|
||||
} = data;
|
||||
const { insert } = clickhouse;
|
||||
const { getDateFormat, sendMessage } = kafka;
|
||||
const eventId = uuid();
|
||||
const createdAt = getDateFormat(new Date());
|
||||
|
|
@ -164,7 +166,11 @@ async function clickhouseQuery(data: {
|
|||
created_at: createdAt,
|
||||
};
|
||||
|
||||
await sendMessage(message, 'event');
|
||||
if (kafka.enabled) {
|
||||
await sendMessage(message, 'event');
|
||||
} else {
|
||||
await insert('website_event', [message]);
|
||||
}
|
||||
|
||||
if (eventData) {
|
||||
await saveEventData({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue