mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
configure redis
This commit is contained in:
parent
efb52f5ff1
commit
48fe6ebcc5
13 changed files with 138 additions and 183 deletions
|
|
@ -1,14 +1,12 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import { EVENT_NAME_LENGTH, URL_LENGTH } from 'lib/constants';
|
||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||
import kafka from 'lib/kafka';
|
||||
import { runQuery, CLICKHOUSE, KAFKA, PRISMA } from 'lib/db';
|
||||
import { URL_LENGTH, EVENT_NAME_LENGTH } from 'lib/constants';
|
||||
import prisma from 'lib/prisma';
|
||||
|
||||
export async function saveEvent(...args) {
|
||||
return runQuery({
|
||||
[PRISMA]: () => relationalQuery(...args),
|
||||
[CLICKHOUSE]: () => clickhouseQuery(...args),
|
||||
[KAFKA]: () => kafkaQuery(...args),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -34,23 +32,6 @@ async function relationalQuery(website_id, { session_id, url, event_name, event_
|
|||
}
|
||||
|
||||
async function clickhouseQuery(website_id, { event_uuid, session_uuid, url, event_name }) {
|
||||
const { rawQuery, getDateFormat } = clickhouse;
|
||||
const params = [
|
||||
website_id,
|
||||
event_uuid,
|
||||
session_uuid,
|
||||
url?.substring(0, URL_LENGTH),
|
||||
event_name?.substring(0, EVENT_NAME_LENGTH),
|
||||
];
|
||||
|
||||
return rawQuery(
|
||||
`insert into umami.event (created_at, website_id, session_uuid, url, event_name)
|
||||
values (${getDateFormat(new Date())}, $1, $2, $3, $4);`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
||||
async function kafkaQuery(website_id, { event_uuid, session_uuid, url, event_name }) {
|
||||
const { getDateFormat, sendMessage } = kafka;
|
||||
const params = {
|
||||
event_uuid: event_uuid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue