mirror of
https://github.com/umami-software/umami.git
synced 2026-02-04 04:37:11 +01:00
Merge branch 'dev' of https://github.com/umami-software/umami into francis/uc-24-kafka-test
This commit is contained in:
commit
1ffd5775f8
138 changed files with 2849 additions and 239 deletions
|
|
@ -29,7 +29,7 @@ async function relationalQuery(
|
|||
return rawQuery(
|
||||
`
|
||||
select
|
||||
event_value x,
|
||||
event_name x,
|
||||
${getDateQuery('created_at', unit, timezone)} t,
|
||||
count(*) y
|
||||
from event
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function clickhouseQuery(websites, start_at) {
|
|||
session_id,
|
||||
created_at,
|
||||
url,
|
||||
event_type
|
||||
event_name
|
||||
from event
|
||||
where website_id in (${websites.join[',']}
|
||||
and created_at >= ${getDateFormatClickhouse(start_at)})
|
||||
|
|
|
|||
|
|
@ -16,33 +16,36 @@ export async function saveEvent(...args) {
|
|||
});
|
||||
}
|
||||
|
||||
async function relationalQuery(website_id, { session_id, url, event_type, event_value }) {
|
||||
async function relationalQuery(website_id, { session_id, url, event_name, event_data }) {
|
||||
const data = {
|
||||
website_id,
|
||||
session_id,
|
||||
url: url?.substr(0, URL_LENGTH),
|
||||
event_name: event_name?.substr(0, 50),
|
||||
};
|
||||
|
||||
if (event_data) {
|
||||
data.event_data = {
|
||||
create: {
|
||||
event_data: event_data,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return runQuery(
|
||||
prisma.event.create({
|
||||
data: {
|
||||
website_id,
|
||||
session_id,
|
||||
url: url?.substr(0, URL_LENGTH),
|
||||
event_type: event_type?.substr(0, 50),
|
||||
event_value: event_value?.substr(0, 50),
|
||||
},
|
||||
data,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
async function clickhouseQuery(website_id, { session_uuid, url, event_type, event_value }) {
|
||||
const params = [
|
||||
website_id,
|
||||
session_uuid,
|
||||
url?.substr(0, URL_LENGTH),
|
||||
event_type?.substr(0, 50),
|
||||
event_value?.substr(0, 50),
|
||||
];
|
||||
async function clickhouseQuery(website_id, { session_uuid, url, event_name }) {
|
||||
const params = [website_id, session_uuid, url?.substr(0, URL_LENGTH), event_name?.substr(0, 50)];
|
||||
|
||||
return rawQueryClickhouse(
|
||||
`
|
||||
insert into umami_dev.event (created_at, website_id, session_uuid, url, event_type, event_value)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4, $5);`,
|
||||
insert into umami_dev.event (created_at, website_id, session_uuid, url, event_name)
|
||||
values (${getDateFormatClickhouse(new Date())}, $1, $2, $3, $4);`,
|
||||
params,
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ export async function getPageviewParams(...args) {
|
|||
}
|
||||
|
||||
function relationalQuery(param, website_id, start_at, end_at, column, table, filters = {}) {
|
||||
const params = [param, website_id, start_at, end_at];
|
||||
const params = [param, param, website_id, start_at, end_at];
|
||||
const { pageviewQuery, sessionQuery, eventQuery, joinSession } = parseFilters(
|
||||
table,
|
||||
column,
|
||||
|
|
@ -26,12 +26,13 @@ function relationalQuery(param, website_id, start_at, end_at, column, table, fil
|
|||
return rawQuery(
|
||||
`select * from (
|
||||
select
|
||||
url, ${splitFn}(${splitFn}(url, concat($1, '='), 2), '&', 1) param
|
||||
url,
|
||||
IF( LENGTH(url) - LENGTH(${splitFn}(url, concat($1, '='), -1)) > 1, ${splitFn}(${splitFn}(url, concat($2, '='), -1), '&', 1), null ) param
|
||||
from
|
||||
pageview
|
||||
${joinSession}
|
||||
where
|
||||
${table}.website_id=$2 and ${table}.created_at between $3 and $4
|
||||
${table}.website_id=$3 and ${table}.created_at between $4 and $5
|
||||
${pageviewQuery}
|
||||
${joinSession && sessionQuery}
|
||||
${eventQuery}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue