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.

fix(error-tracking): repair severity state ingestion (#91499)

Hugues Pouillotbf808691f8f0
diff --git a/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl b/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl
index b8ee96497215..50b8ba27bfe6 100644
--- a/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl
+++ b/posthog/clickhouse/hcl/golden/local-multi/ingestion_small.hcl
@@ -1164,6 +1164,59 @@ database "posthog" {
}
}
+ table "writable_error_tracking_fingerprint_issue_state" {
+ column "team_id" {
+ type = "Int64"
+ }
+ column "fingerprint" {
+ type = "String"
+ }
+ column "issue_id" {
+ type = "UUID"
+ }
+ column "issue_name" {
+ type = "Nullable(String)"
+ }
+ column "issue_description" {
+ type = "Nullable(String)"
+ }
+ column "issue_status" {
+ type = "String"
+ }
+ column "issue_severity" {
+ type = "Nullable(String)"
+ }
+ column "assigned_user_id" {
+ type = "Nullable(Int64)"
+ }
+ column "assigned_role_id" {
+ type = "Nullable(UUID)"
+ }
+ column "first_seen" {
+ type = "DateTime64(3, 'UTC')"
+ }
+ column "is_deleted" {
+ type = "Int8"
+ }
+ column "version" {
+ type = "Int64"
+ }
+ column "_timestamp" {
+ type = "DateTime"
+ }
+ column "_offset" {
+ type = "UInt64"
+ }
+ column "_partition" {
+ type = "UInt64"
+ }
+ engine "distributed" {
+ cluster_name = "aux"
+ remote_database = "posthog"
+ remote_table = "raw_error_tracking_fingerprint_issue_state"
+ }
+ }
+
table "writable_error_tracking_issue_fingerprint_embeddings" {
column "team_id" {
type = "Int64"
diff --git a/posthog/clickhouse/hcl/manifest.hcl b/posthog/clickhouse/hcl/manifest.hcl
index 9608b2bf387e..4f902dfd4e85 100644
--- a/posthog/clickhouse/hcl/manifest.hcl
+++ b/posthog/clickhouse/hcl/manifest.hcl
@@ -62,10 +62,10 @@ role "ai_events" {
# hosts the ingestion_warnings store; prod-us adds the Distributed proxy onto the data
# cluster. prod goldens are dump-baselined (not live-verifiable here).
role "aux" {
- env "local-multi" { layers = ["roles/shared", "roles/coshared/aux_data", "roles/auxiliary/shared", "roles/auxiliary/local"] }
- env "dev" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/dev"] }
- env "prod-us" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-us"] }
- env "prod-eu" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-eu"] }
+ env "local-multi" { layers = ["roles/shared", "roles/coshared/aux_data", "roles/coshared/aux_small", "roles/auxiliary/shared", "roles/auxiliary/local"] }
+ env "dev" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/dev"] }
+ env "prod-us" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-us"] }
+ env "prod-eu" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/coshared/aux_data", "roles/coshared/aux_small", "roles/coshared/ingestion_warnings_store", "roles/auxiliary/shared", "roles/auxiliary/prod", "roles/auxiliary/prod-eu"] }
}
# SESSIONS satellite: the local node runs only the shared query_log_archive path
@@ -115,7 +115,7 @@ role "events" {
}
role "small" {
- env "local-multi" { layers = ["roles/shared/qla.hcl", "roles/coshared/log_entries_write", "roles/coshared/session_replay_write", "roles/ingestion_small/local"] }
+ env "local-multi" { layers = ["roles/shared/qla.hcl", "roles/coshared/aux_small", "roles/coshared/log_entries_write", "roles/coshared/session_replay_write", "roles/ingestion_small/local"] }
}
role "medium" {
@@ -127,7 +127,7 @@ role "medium" {
# and not MULTINODE_CLICKHOUSE. Composed as the deduped union of the local-multi stacks it
# hosts, so any name two of those roles declare fails this load instead of drifting.
role "all" {
- env "local-single" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/ops/shared", "roles/ops/local", "roles/logs/base", "roles/logs/traces", "roles/logs/traces_kafka_metrics", "roles/logs/metrics", "roles/logs/local", "roles/coshared/ai_events_data", "roles/ai_events/shared", "roles/ai_events/local", "roles/coshared/aux_data", "roles/auxiliary/shared", "roles/auxiliary/local", "roles/coshared/sessions_data", "roles/coshared/tophog", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/batch_exports_data", "roles/coshared/ingestion_warnings_store", "roles/coshared/events_json_write", "roles/coshared/log_entries_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/local", "roles/ingestion_events/local", "roles/ingestion_events/local-single", "roles/ingestion_small/local", "roles/ingestion_medium/local"] }
+ env "local-single" { layers = ["roles/shared", "roles/coshared/custom_metrics", "roles/ops/shared", "roles/ops/local", "roles/logs/base", "roles/logs/traces", "roles/logs/traces_kafka_metrics", "roles/logs/metrics", "roles/logs/local", "roles/coshared/ai_events_data", "roles/ai_events/shared", "roles/ai_events/local", "roles/coshared/aux_data", "roles/coshared/aux_small", "roles/auxiliary/shared", "roles/auxiliary/local", "roles/coshared/sessions_data", "roles/coshared/tophog", "roles/coshared/events_recent", "roles/coshared/events_recent_write", "roles/coshared/batch_exports_data", "roles/coshared/ingestion_warnings_store", "roles/coshared/events_json_write", "roles/coshared/log_entries_write", "roles/coshared/session_replay_write", "roles/data/shared", "roles/data/local", "roles/ingestion_events/local", "roles/ingestion_events/local-single", "roles/ingestion_small/local", "roles/ingestion_medium/local"] }
}
# role "endpoints" {
diff --git a/posthog/clickhouse/hcl/roles/auxiliary/shared/tables.hcl b/posthog/clickhouse/hcl/roles/auxiliary/shared/tables.hcl
index c4454c59d121..10f11062a97d 100644
--- a/posthog/clickhouse/hcl/roles/auxiliary/shared/tables.hcl
+++ b/posthog/clickhouse/hcl/roles/auxiliary/shared/tables.hcl
@@ -663,58 +663,6 @@ database "posthog" {
version_column = "computed_at"
}
}
- table "writable_error_tracking_fingerprint_issue_state" {
- column "team_id" {
- type = "Int64"
- }
- column "fingerprint" {
- type = "String"
- }
- column "issue_id" {
- type = "UUID"
- }
- column "issue_name" {
- type = "Nullable(String)"
- }
- column "issue_description" {
- type = "Nullable(String)"
- }
- column "issue_status" {
- type = "String"
- }
- column "issue_severity" {
- type = "Nullable(String)"
- }
- column "assigned_user_id" {
- type = "Nullable(Int64)"
- }
- column "assigned_role_id" {
- type = "Nullable(UUID)"
- }
- column "first_seen" {
- type = "DateTime64(3, 'UTC')"
- }
- column "is_deleted" {
- type = "Int8"
- }
- column "version" {
- type = "Int64"
- }
- column "_timestamp" {
- type = "DateTime"
- }
- column "_offset" {
- type = "UInt64"
- }
- column "_partition" {
- type = "UInt64"
- }
- engine "distributed" {
- cluster_name = "aux"
- remote_database = "posthog"
- remote_table = "raw_error_tracking_fingerprint_issue_state"
- }
- }
materialized_view "hog_invocation_results_mv" {
to_table = "posthog.hog_invocation_results_data"
query = file("sql/hog_invocation_results_mv.sql")
diff --git a/posthog/clickhouse/hcl/roles/coshared/aux_small/tables.hcl b/posthog/clickhouse/hcl/roles/coshared/aux_small/tables.hcl
new file mode 100644
index 000000000000..c9a0c361ded2
--- /dev/null
+++ b/posthog/clickhouse/hcl/roles/coshared/aux_small/tables.hcl
@@ -0,0 +1,54 @@
+database "posthog" {
+ table "writable_error_tracking_fingerprint_issue_state" {
+ column "team_id" {
+ type = "Int64"
+ }
+ column "fingerprint" {
+ type = "String"
+ }
+ column "issue_id" {
+ type = "UUID"
+ }
+ column "issue_name" {
+ type = "Nullable(String)"
+ }
+ column "issue_description" {
+ type = "Nullable(String)"
+ }
+ column "issue_status" {
+ type = "String"
+ }
+ column "issue_severity" {
+ type = "Nullable(String)"
+ }
+ column "assigned_user_id" {
+ type = "Nullable(Int64)"
+ }
+ column "assigned_role_id" {
+ type = "Nullable(UUID)"
+ }
+ column "first_seen" {
+ type = "DateTime64(3, 'UTC')"
+ }
+ column "is_deleted" {
+ type = "Int8"
+ }
+ column "version" {
+ type = "Int64"
+ }
+ column "_timestamp" {
+ type = "DateTime"
+ }
+ column "_offset" {
+ type = "UInt64"
+ }
+ column "_partition" {
+ type = "UInt64"
+ }
+ engine "distributed" {
+ cluster_name = "aux"
+ remote_database = "posthog"
+ remote_table = "raw_error_tracking_fingerprint_issue_state"
+ }
+ }
+}
diff --git a/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql b/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql
index b43f89083495..8b535e3b8b2e 100644
--- a/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql
+++ b/posthog/clickhouse/hcl/sql/local-multi/ingestion_small.sql
@@ -341,6 +341,23 @@ CREATE TABLE posthog.writable_duplicate_events (
_offset UInt64,
_partition UInt64
) ENGINE = Distributed('posthog_single_shard', 'posthog', 'duplicate_events');
+CREATE TABLE posthog.writable_error_tracking_fingerprint_issue_state (
+ team_id Int64,
+ fingerprint String,
+ issue_id UUID,
+ issue_name Nullable(String),
+ issue_description Nullable(String),
+ issue_status String,
+ issue_severity Nullable(String),
+ assigned_user_id Nullable(Int64),
+ assigned_role_id Nullable(UUID),
+ first_seen DateTime64(3, 'UTC'),
+ is_deleted Int8,
+ version Int64,
+ _timestamp DateTime,
+ _offset UInt64,
+ _partition UInt64
+) ENGINE = Distributed('aux', 'posthog', 'raw_error_tracking_fingerprint_issue_state');
CREATE TABLE posthog.writable_error_tracking_issue_fingerprint_embeddings (
team_id Int64,
model_name LowCardinality(String),
diff --git a/posthog/clickhouse/migrations/0312_reapply_error_tracking_issue_severity.py b/posthog/clickhouse/migrations/0312_reapply_error_tracking_issue_severity.py
new file mode 100644
index 000000000000..593401e9f679
--- /dev/null
+++ b/posthog/clickhouse/migrations/0312_reapply_error_tracking_issue_severity.py
@@ -0,0 +1,47 @@
+from posthog.clickhouse.client.connection import NodeRole
+from posthog.clickhouse.client.migration_tools import run_sql_with_exceptions
+from posthog.run_mode import run_mode
+
+from products.error_tracking.backend.sql import (
+ DROP_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_KAFKA_TABLE_SQL,
+ DROP_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_MV_SQL,
+ ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_MV_SQL,
+ KAFKA_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_TABLE_SQL,
+ WRITABLE_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_TABLE_SQL,
+)
+
+operations = [
+ run_sql_with_exceptions(
+ WRITABLE_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_TABLE_SQL(),
+ node_roles=[NodeRole.INGESTION_SMALL],
+ require_hosts=True,
+ ),
+ run_sql_with_exceptions(
+ "ALTER TABLE writable_error_tracking_fingerprint_issue_state "
+ "ADD COLUMN IF NOT EXISTS issue_severity Nullable(String) AFTER issue_status",
+ node_roles=[NodeRole.INGESTION_SMALL],
+ sharded=False,
+ is_alter_on_replicated_table=False,
+ ),
+] + (
+ [
+ run_sql_with_exceptions(
+ DROP_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_MV_SQL,
+ node_roles=[NodeRole.INGESTION_SMALL],
+ ),
+ run_sql_with_exceptions(
+ DROP_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_KAFKA_TABLE_SQL,
+ node_roles=[NodeRole.INGESTION_SMALL],
+ ),
+ run_sql_with_exceptions(
+ KAFKA_ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_TABLE_SQL(),
+ node_roles=[NodeRole.INGESTION_SMALL],
+ ),
+ run_sql_with_exceptions(
+ ERROR_TRACKING_FINGERPRINT_ISSUE_STATE_WS_MV_SQL(),
+ node_roles=[NodeRole.INGESTION_SMALL],
+ ),
+ ]
+ if run_mode().is_deployed_cloud
+ else []
+)
diff --git a/posthog/clickhouse/migrations/max_migration.txt b/posthog/clickhouse/migrations/max_migration.txt
index ae7a878b4330..92d0bc382e83 100644
--- a/posthog/clickhouse/migrations/max_migration.txt
+++ b/posthog/clickhouse/migrations/max_migration.txt
@@ -1 +1 @@
-0311_drop_log_attributes_mvs
+0312_reapply_error_tracking_issue_severity