Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

added performance table

Blue Mouse0161af506344
diff --git a/migrations/clickhouse/2022_12_29.js b/migrations/clickhouse/2022_12_29.js
index f61271de9..c99a69b07 100644
--- a/migrations/clickhouse/2022_12_29.js
+++ b/migrations/clickhouse/2022_12_29.js
@@ -2,6 +2,22 @@ const { queriesRunner, dbName } = require('./setup')
const queries = [
`DROP COLUMN ${dbName}.lt`,
+ `CREATE TABLE IF NOT EXISTS ${dbName}.performance
+ (
+ pid FixedString(12),
+ dns Nullable(UInt32),
+ ssl Nullable(UInt32),
+ conn Nullable(UInt32),
+ resp Nullable(UInt32),
+ render Nullable(UInt32),
+ domLoad Nullable(UInt32),
+ pageLoad Nullable(UInt32),
+ ttfb Nullable(UInt32),
+ created DateTime
+ )
+ ENGINE = MergeTree()
+ PARTITION BY toYYYYMM(created)
+ ORDER BY (pid, created);`
]
queriesRunner(queries)
diff --git a/src/common/constants.ts b/src/common/constants.ts
index bf55d20d8..e40c7f1cc 100644
--- a/src/common/constants.ts
+++ b/src/common/constants.ts
@@ -66,14 +66,30 @@ const CLICKHOUSE_INIT_QUERIES = [
ORDER BY (pid, created);`,
`CREATE TABLE IF NOT EXISTS analytics.customEV
(
- id UUID,
- pid FixedString(12),
- ev String,
- created DateTime
+ id UUID,
+ pid FixedString(12),
+ ev String,
+ created DateTime
)
ENGINE = MergeTree()
PARTITION BY toYYYYMM(created)
ORDER BY (id, created, pid);`,
+ `CREATE TABLE IF NOT EXISTS analytics.performance
+ (
+ pid FixedString(12),
+ dns Nullable(UInt32),
+ ssl Nullable(UInt32),
+ conn Nullable(UInt32),
+ resp Nullable(UInt32),
+ render Nullable(UInt32),
+ domLoad Nullable(UInt32),
+ pageLoad Nullable(UInt32),
+ ttfb Nullable(UInt32),
+ created DateTime
+ )
+ ENGINE = MergeTree()
+ PARTITION BY toYYYYMM(created)
+ ORDER BY (pid, created);`,
isSelfhosted &&
`CREATE TABLE IF NOT EXISTS analytics.project
(