Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(alerts): name the source on a platform check history row (#109455)

Jimmy Zhue07f43f8db7f
diff --git a/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl b/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl
index 30c5cb737cb1..18dfbbe5f265 100644
--- a/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/dev/auxiliary.hcl
@@ -1164,6 +1164,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
@@ -2395,6 +2398,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/dev/data.hcl b/posthog/clickhouse/hcl/golden/dev/data.hcl
index 552acc8323a2..0d54c0f7d2bf 100644
--- a/posthog/clickhouse/hcl/golden/dev/data.hcl
+++ b/posthog/clickhouse/hcl/golden/dev/data.hcl
@@ -3034,6 +3034,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl b/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl
index 74ae82666513..eafeed822db8 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/auxiliary.hcl
@@ -1207,6 +1207,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
@@ -2402,6 +2405,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/local-multi/data.hcl b/posthog/clickhouse/hcl/golden/local-multi/data.hcl
index 86dcfa596dec..afcaa722337c 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/data.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/data.hcl
@@ -3463,6 +3463,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/local-single/all.hcl b/posthog/clickhouse/hcl/golden/local-single/all.hcl
index 0d318a3145a7..cc8996319d08 100644
--- a/posthog/clickhouse/hcl/golden/local-single/all.hcl
+++ b/posthog/clickhouse/hcl/golden/local-single/all.hcl
@@ -8670,6 +8670,9 @@ SQL
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
@@ -12554,6 +12557,9 @@ SQL
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl b/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl
index 1237db2d847b..cc42af8b4d16 100644
--- a/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-eu/auxiliary.hcl
@@ -1164,6 +1164,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
@@ -2395,6 +2398,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/prod-eu/data.hcl b/posthog/clickhouse/hcl/golden/prod-eu/data.hcl
index bfdf6e969f40..7923c453a275 100644
--- a/posthog/clickhouse/hcl/golden/prod-eu/data.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-eu/data.hcl
@@ -3795,6 +3795,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl b/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl
index adcf11dfb2e7..0bd698ab53bf 100644
--- a/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-us/auxiliary.hcl
@@ -1202,6 +1202,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
@@ -2433,6 +2436,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/golden/prod-us/data.hcl b/posthog/clickhouse/hcl/golden/prod-us/data.hcl
index 0de7eba5e432..d514cabc72a4 100644
--- a/posthog/clickhouse/hcl/golden/prod-us/data.hcl
+++ b/posthog/clickhouse/hcl/golden/prod-us/data.hcl
@@ -3586,6 +3586,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/roles/coshared/aux_data/tables.hcl b/posthog/clickhouse/hcl/roles/coshared/aux_data/tables.hcl
index 17914b011b94..e3d57f247e37 100644
--- a/posthog/clickhouse/hcl/roles/coshared/aux_data/tables.hcl
+++ b/posthog/clickhouse/hcl/roles/coshared/aux_data/tables.hcl
@@ -383,6 +383,9 @@ database "posthog" {
column "occurred_at" {
type = "DateTime64(6, 'UTC')"
}
+ column "source_kind" {
+ type = "LowCardinality(String)"
+ }
column "expires_at" {
type = "Date"
default = "today() + toIntervalDay(90)"
diff --git a/posthog/clickhouse/hcl/sql/dev/auxiliary.sql b/posthog/clickhouse/hcl/sql/dev/auxiliary.sql
index 76ddbbe62380..7183e4f4e0bd 100644
--- a/posthog/clickhouse/hcl/sql/dev/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/dev/auxiliary.sql
@@ -450,6 +450,7 @@ CREATE TABLE posthog.sharded_platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.platform_alert_events', '{replica}-{shard}') PRIMARY KEY (team_id, configuration_id, alert_id, occurred_at) ORDER BY (team_id, configuration_id, alert_id, occurred_at, evaluation_key) PARTITION BY toYYYYMM(occurred_at) TTL expires_at SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;
CREATE TABLE posthog.sharded_session_replay_features (
@@ -1279,6 +1280,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.session_replay_features (
diff --git a/posthog/clickhouse/hcl/sql/dev/data.sql b/posthog/clickhouse/hcl/sql/dev/data.sql
index f4bdabc2937b..f1b9bec617ab 100644
--- a/posthog/clickhouse/hcl/sql/dev/data.sql
+++ b/posthog/clickhouse/hcl/sql/dev/data.sql
@@ -641,6 +641,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.plugin_log_entries (
diff --git a/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql b/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql
index f57ecdc6814b..2f0e66bd2b8a 100644
--- a/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/local-multi/auxiliary.sql
@@ -454,6 +454,7 @@ CREATE TABLE posthog.sharded_platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.platform_alert_events', '{replica}-{shard}') PRIMARY KEY (team_id, configuration_id, alert_id, occurred_at) ORDER BY (team_id, configuration_id, alert_id, occurred_at, evaluation_key) PARTITION BY toYYYYMM(occurred_at) TTL expires_at SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;
CREATE TABLE posthog.sharded_session_replay_features (
@@ -1300,6 +1301,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.session_replay_features (
diff --git a/posthog/clickhouse/hcl/sql/local-multi/data.sql b/posthog/clickhouse/hcl/sql/local-multi/data.sql
index 49b46e919ca1..aeb796d31f48 100644
--- a/posthog/clickhouse/hcl/sql/local-multi/data.sql
+++ b/posthog/clickhouse/hcl/sql/local-multi/data.sql
@@ -665,6 +665,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.plugin_log_entries (
diff --git a/posthog/clickhouse/hcl/sql/local-single/all.sql b/posthog/clickhouse/hcl/sql/local-single/all.sql
index 88796a321e3a..a1dc5d01994e 100644
--- a/posthog/clickhouse/hcl/sql/local-single/all.sql
+++ b/posthog/clickhouse/hcl/sql/local-single/all.sql
@@ -2480,6 +2480,7 @@ CREATE TABLE posthog.sharded_platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.platform_alert_events', '{replica}-{shard}') PRIMARY KEY (team_id, configuration_id, alert_id, occurred_at) ORDER BY (team_id, configuration_id, alert_id, occurred_at, evaluation_key) PARTITION BY toYYYYMM(occurred_at) TTL expires_at SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;
CREATE TABLE posthog.sharded_posthog_document_embeddings_buffer (
@@ -7185,6 +7186,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.preaggregation_results (
diff --git a/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql b/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql
index 7dc00e959ee9..6b93e6adf868 100644
--- a/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/prod-eu/auxiliary.sql
@@ -450,6 +450,7 @@ CREATE TABLE posthog.sharded_platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.platform_alert_events', '{replica}-{shard}') PRIMARY KEY (team_id, configuration_id, alert_id, occurred_at) ORDER BY (team_id, configuration_id, alert_id, occurred_at, evaluation_key) PARTITION BY toYYYYMM(occurred_at) TTL expires_at SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;
CREATE TABLE posthog.sharded_session_replay_features (
@@ -1279,6 +1280,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.session_replay_features (
diff --git a/posthog/clickhouse/hcl/sql/prod-eu/data.sql b/posthog/clickhouse/hcl/sql/prod-eu/data.sql
index 9afa5aa37ef4..ebf1cd26525a 100644
--- a/posthog/clickhouse/hcl/sql/prod-eu/data.sql
+++ b/posthog/clickhouse/hcl/sql/prod-eu/data.sql
@@ -914,6 +914,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.plugin_log_entries (
diff --git a/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql b/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql
index beb728a27f3f..f1715a3d3663 100644
--- a/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql
+++ b/posthog/clickhouse/hcl/sql/prod-us/auxiliary.sql
@@ -450,6 +450,7 @@ CREATE TABLE posthog.sharded_platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = ReplicatedMergeTree('/clickhouse/tables/noshard/posthog.platform_alert_events', '{replica}-{shard}') PRIMARY KEY (team_id, configuration_id, alert_id, occurred_at) ORDER BY (team_id, configuration_id, alert_id, occurred_at, evaluation_key) PARTITION BY toYYYYMM(occurred_at) TTL expires_at SETTINGS index_granularity = 8192, ttl_only_drop_parts = 1;
CREATE TABLE posthog.sharded_session_replay_features (
@@ -1289,6 +1290,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.session_replay_features (
diff --git a/posthog/clickhouse/hcl/sql/prod-us/data.sql b/posthog/clickhouse/hcl/sql/prod-us/data.sql
index e713d84e1525..72b09e17e340 100644
--- a/posthog/clickhouse/hcl/sql/prod-us/data.sql
+++ b/posthog/clickhouse/hcl/sql/prod-us/data.sql
@@ -783,6 +783,7 @@ CREATE TABLE posthog.platform_alert_events (
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
) ENGINE = Distributed('aux', 'posthog', 'sharded_platform_alert_events', cityHash64(team_id));
CREATE TABLE posthog.plugin_log_entries (
diff --git a/posthog/clickhouse/migrations/0346_platform_alert_events_source_kind.py b/posthog/clickhouse/migrations/0346_platform_alert_events_source_kind.py
new file mode 100644
index 000000000000..d6094aa6b625
--- /dev/null
+++ b/posthog/clickhouse/migrations/0346_platform_alert_events_source_kind.py
@@ -0,0 +1,33 @@
+"""Name the source a check came from, so a read of this table does not have to join Postgres.
+
+The column lands before anything writes the table, so every row it ever holds carries a source.
+"""
+
+from posthog.clickhouse.client.connection import NodeRole
+from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
+
+from products.alerts.backend.models.platform_alert_events_sql import (
+ PLATFORM_ALERT_EVENTS_TABLE,
+ SHARDED_PLATFORM_ALERT_EVENTS_TABLE,
+)
+
+# Positioned rather than appended, so the migrated cluster matches the column order the Python
+# definition and the declarative schema both declare. A drift there fails the schema check.
+ADD_SOURCE_KIND = "ADD COLUMN IF NOT EXISTS source_kind LowCardinality(String) AFTER occurred_at"
+
+operations = [
+ # Not sharded despite the name: aux is one shard with replicas, so the storage table is
+ # replicated and the ALTER runs on one host.
+ run_sql_with_exceptions(
+ f"ALTER TABLE {SHARDED_PLATFORM_ALERT_EVENTS_TABLE} {ADD_SOURCE_KIND}",
+ node_roles=[NodeRole.AUX],
+ sharded=False,
+ is_alter_on_replicated_table=True,
+ ),
+ run_sql_with_exceptions(
+ f"ALTER TABLE {PLATFORM_ALERT_EVENTS_TABLE} {ADD_SOURCE_KIND}",
+ node_roles=[NodeRole.DATA, NodeRole.AUX],
+ sharded=False,
+ is_alter_on_replicated_table=False,
+ ),
+]
diff --git a/posthog/clickhouse/migrations/max_migration.txt b/posthog/clickhouse/migrations/max_migration.txt
index 8cd7880294f7..f280afd8f1f6 100644
--- a/posthog/clickhouse/migrations/max_migration.txt
+++ b/posthog/clickhouse/migrations/max_migration.txt
@@ -1 +1 @@
-0345_metrics4_series_services_projection
+0346_platform_alert_events_source_kind
diff --git a/posthog/clickhouse/test/__snapshots__/test_schema.ambr b/posthog/clickhouse/test/__snapshots__/test_schema.ambr
index 582c008a3f84..5895cc530256 100644
--- a/posthog/clickhouse/test/__snapshots__/test_schema.ambr
+++ b/posthog/clickhouse/test/__snapshots__/test_schema.ambr
@@ -5989,6 +5989,7 @@
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
)
ENGINE = Distributed('aux', 'posthog_test', 'sharded_platform_alert_events', cityHash64(team_id))
@@ -8478,6 +8479,7 @@
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_noshard/posthog.platform_alert_events', '{replica}-{shard}')
@@ -14229,6 +14231,7 @@
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay(90)
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/77f1df52-4b43-11e9-910f-b8ca3a9b9f3e_noshard/posthog.platform_alert_events', '{replica}-{shard}')
diff --git a/products/alerts/backend/models/platform_alert_events_sql.py b/products/alerts/backend/models/platform_alert_events_sql.py
index a46ce604afd8..e956268cc410 100644
--- a/products/alerts/backend/models/platform_alert_events_sql.py
+++ b/products/alerts/backend/models/platform_alert_events_sql.py
@@ -34,6 +34,7 @@ BASE_PLATFORM_ALERT_EVENTS_COLUMNS = f"""
consecutive_failures UInt32,
muted_notification LowCardinality(String),
occurred_at DateTime64(6, 'UTC'),
+ source_kind LowCardinality(String),
expires_at Date DEFAULT today() + toIntervalDay({PLATFORM_ALERT_EVENTS_TTL_DAYS})
""".strip()