mirror of
https://github.com/umami-software/umami.git
synced 2026-02-11 08:07:12 +01:00
Added rev_id column. Updated redis calls.
This commit is contained in:
parent
a9112f39ec
commit
3485b6268b
18 changed files with 133 additions and 79 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import prisma from 'lib/prisma';
|
||||
import clickhouse from 'lib/clickhouse';
|
||||
import { runQuery, CLICKHOUSE, PRISMA } from 'lib/db';
|
||||
import redis from 'lib/redis';
|
||||
|
||||
export async function getSessionMetrics(...args) {
|
||||
return runQuery({
|
||||
|
|
@ -36,13 +37,15 @@ async function relationalQuery(websiteId, { startDate, endDate, field, filters =
|
|||
|
||||
async function clickhouseQuery(websiteId, { startDate, endDate, field, filters = {} }) {
|
||||
const { parseFilters, getBetweenDates, rawQuery } = clickhouse;
|
||||
const params = [websiteId];
|
||||
const website = await redis.get(`website:${websiteId}`);
|
||||
const params = [websiteId, website?.revId || 0];
|
||||
const { pageviewQuery, sessionQuery } = parseFilters(null, filters, params);
|
||||
|
||||
return rawQuery(
|
||||
`select ${field} x, count(*) y
|
||||
from event as x
|
||||
where website_id=$1
|
||||
where website_id = $1
|
||||
and rev_id = $2
|
||||
and event_name = ''
|
||||
and ${getBetweenDates('created_at', startDate, endDate)}
|
||||
${pageviewQuery}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue