mirror of
https://github.com/umami-software/umami.git
synced 2026-02-19 12:05:41 +01:00
fix query
This commit is contained in:
parent
69ec6888ac
commit
99d5e7cb41
3 changed files with 8 additions and 4 deletions
|
|
@ -108,7 +108,11 @@ async function clickhouseQuery(data: {
|
||||||
message[`double${i + 1}`] = double;
|
message[`double${i + 1}`] = double;
|
||||||
});
|
});
|
||||||
|
|
||||||
await sendMessage('event_data_blob', message);
|
if (kafka.enabled) {
|
||||||
|
await sendMessage('event_data_blob', message);
|
||||||
|
} else {
|
||||||
|
await insert('event_data_blob', [message]);
|
||||||
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
import clickhouse from 'lib/clickhouse';
|
import clickhouse from 'lib/clickhouse';
|
||||||
import { EVENT_TYPE } from 'lib/constants';
|
import { EVENT_TYPE } from 'lib/constants';
|
||||||
|
import { EVENT_COLUMNS } from 'lib/constants';
|
||||||
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
import { CLICKHOUSE, PRISMA, runQuery } from 'lib/db';
|
||||||
import prisma from 'lib/prisma';
|
import prisma from 'lib/prisma';
|
||||||
import { QueryFilters } from 'lib/types';
|
import { QueryFilters } from 'lib/types';
|
||||||
import { EVENT_COLUMNS } from 'lib/constants';
|
|
||||||
|
|
||||||
export async function getWebsiteStats(
|
export async function getWebsiteStats(
|
||||||
...args: [websiteId: string, filters: QueryFilters]
|
...args: [websiteId: string, filters: QueryFilters]
|
||||||
|
|
@ -107,7 +107,7 @@ async function clickhouseQuery(
|
||||||
sum(views) c,
|
sum(views) c,
|
||||||
min(min_time) min_time,
|
min(min_time) min_time,
|
||||||
max(max_time) max_time
|
max(max_time) max_time
|
||||||
from umami.website_event_stats_hourly "website_event"
|
from website_event_stats_hourly "website_event"
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
and event_type = {eventType:UInt32}
|
and event_type = {eventType:UInt32}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ async function clickhouseQuery(
|
||||||
uniq(visit_id) as "visits",
|
uniq(visit_id) as "visits",
|
||||||
uniq(country) as "countries",
|
uniq(country) as "countries",
|
||||||
sum(length(event_name)) as "events"
|
sum(length(event_name)) as "events"
|
||||||
from umami.website_event_stats_hourly "website_event"
|
from website_event_stats_hourly "website_event"
|
||||||
where website_id = {websiteId:UUID}
|
where website_id = {websiteId:UUID}
|
||||||
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
and created_at between {startDate:DateTime64} and {endDate:DateTime64}
|
||||||
${filterQuery}
|
${filterQuery}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue