mirror of
https://github.com/umami-software/umami.git
synced 2026-02-08 22:57:12 +01:00
split db files
This commit is contained in:
parent
46b4b98d40
commit
bb50753704
36 changed files with 496 additions and 454 deletions
|
|
@ -1,13 +1,8 @@
|
|||
import { CLICKHOUSE, RELATIONAL, KAFKA } from 'lib/constants';
|
||||
import {
|
||||
getDateFormatClickhouse,
|
||||
prisma,
|
||||
rawQueryClickhouse,
|
||||
runAnalyticsQuery,
|
||||
runQuery,
|
||||
} from 'lib/db';
|
||||
import { sendKafkaMessage, getDateFormatKafka } from 'lib/db/kafka';
|
||||
import { getSessionByUuid } from 'queries';
|
||||
import { CLICKHOUSE, KAFKA, RELATIONAL } from 'lib/constants';
|
||||
import { prisma, runQuery } from 'lib/db/relational';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import kafka from 'lib/db/kafka';
|
||||
import { runAnalyticsQuery } from 'lib/db/db';
|
||||
|
||||
export async function createSession(...args) {
|
||||
return runAnalyticsQuery({
|
||||
|
|
@ -47,13 +42,11 @@ async function clickhouseQuery(
|
|||
country ? country : null,
|
||||
];
|
||||
|
||||
await rawQueryClickhouse(
|
||||
await clickhouse.rawQuery(
|
||||
`insert into umami.session (created_at, session_uuid, website_id, hostname, browser, os, device, screen, language, country)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4, $5, $6, $7, $8, $9);`,
|
||||
values (${clickhouse.getDateFormat(new Date())}, $1, $2, $3, $4, $5, $6, $7, $8, $9);`,
|
||||
params,
|
||||
);
|
||||
|
||||
return getSessionByUuid(session_uuid);
|
||||
}
|
||||
|
||||
async function kafkaQuery(
|
||||
|
|
@ -63,7 +56,7 @@ async function kafkaQuery(
|
|||
const params = {
|
||||
session_uuid: session_uuid,
|
||||
website_id: website_id,
|
||||
created_at: getDateFormatKafka(new Date()),
|
||||
created_at: kafka.getDateFormat(new Date()),
|
||||
hostname: hostname,
|
||||
browser: browser,
|
||||
os: os,
|
||||
|
|
@ -73,7 +66,5 @@ async function kafkaQuery(
|
|||
country: country ? country : null,
|
||||
};
|
||||
|
||||
await sendKafkaMessage(params, 'session');
|
||||
|
||||
return getSessionByUuid(session_uuid);
|
||||
await kafka.sendKafkaMessage(params, 'session');
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue