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(error-tracking): expose severity in system table (#83279)

Hugues Pouillot92f6820bdacb
diff --git a/posthog/hogql/database/schema/system.py b/posthog/hogql/database/schema/system.py
index d27850c7917c..00d0b3703b41 100644
--- a/posthog/hogql/database/schema/system.py
+++ b/posthog/hogql/database/schema/system.py
@@ -1641,6 +1641,9 @@ error_tracking_issues: PostgresTable = PostgresTable(
"status": StringDatabaseField(
name="status", description="Issue status, e.g. 'active', 'resolved', 'suppressed'."
),
+ "severity": StringDatabaseField(
+ name="severity", nullable=True, description="Assigned issue severity, or null when unassigned."
+ ),
"name": StringDatabaseField(name="name", description="Issue title (usually the exception type/message)."),
"description": StringDatabaseField(name="description", description="Issue description."),
},
diff --git a/posthog/hogql/database/schema/test/test_system_tables.py b/posthog/hogql/database/schema/test/test_system_tables.py
index ae9b6b7d1b69..eee716d1f7e9 100644
--- a/posthog/hogql/database/schema/test/test_system_tables.py
+++ b/posthog/hogql/database/schema/test/test_system_tables.py
@@ -905,6 +905,22 @@ class TestSystemTablesTeamIsolation(NonAtomicBaseTest):
assert str(obj_team1.pk) in ids
assert str(obj_team2.pk) not in ids
+ def test_error_tracking_issue_severity(self):
+ ErrorTrackingIssue.objects.create(
+ team=self.team,
+ name="high_severity_issue",
+ status=ErrorTrackingIssue.Status.ACTIVE,
+ severity=ErrorTrackingIssue.Severity.HIGH,
+ )
+
+ response = execute_hogql_query(
+ "SELECT severity FROM system.error_tracking_issues WHERE severity IS NOT NULL",
+ team=self.team,
+ user=self.user,
+ )
+
+ assert response.results == [("high",)]
+
class TestDataWarehouseSourcesLiveQueryability(BaseTest):
"""`is_live_queryable` is how an agent finds the sources it can pass as a query's connection id."""
diff --git a/posthog/hogql/database/test/__snapshots__/test_database.ambr b/posthog/hogql/database/test/__snapshots__/test_database.ambr
index cc465d583f76..85b934c3408b 100644
--- a/posthog/hogql/database/test/__snapshots__/test_database.ambr
+++ b/posthog/hogql/database/test/__snapshots__/test_database.ambr
@@ -6219,6 +6219,16 @@
"table": null,
"type": "string"
},
+ "severity": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "severity",
+ "id": null,
+ "name": "severity",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
"name": {
"chain": null,
"fields": null,
@@ -16429,6 +16439,16 @@
"table": null,
"type": "string"
},
+ "severity": {
+ "chain": null,
+ "fields": null,
+ "hogql_value": "severity",
+ "id": null,
+ "name": "severity",
+ "schema_valid": true,
+ "table": null,
+ "type": "string"
+ },
"name": {
"chain": null,
"fields": null,
diff --git a/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md b/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md
index b6aed57adbc1..1382baadb76a 100644
--- a/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md
+++ b/products/posthog_ai/skills/querying-posthog-data/references/models-error-tracking.md
@@ -8,9 +8,10 @@ Error tracking issues represent grouped exceptions captured by PostHog SDKs. Eac
Column | Type | Nullable | Description
`id` | uuid | NOT NULL | Primary key (UUID)
-`team_id` | integer | NOT NULL | FK to `system.teams.id`
+`team_id` | integer | NOT NULL | PostHog project ID; foreign key to `system.teams.id`
`created_at` | timestamp with tz | NOT NULL | Creation timestamp
`status` | varchar | NOT NULL | Issue status (see Status Values below)
+`severity` | varchar | NULL | Assigned severity: `low`, `medium`, `high`, or `critical`
`name` | text | NULL | Issue name (typically the exception type/message)
`description` | text | NULL | User-provided description
@@ -34,6 +35,9 @@ Status | Description
- Issues group exception events by fingerprint (a hash of exception characteristics)
- The `name` field is typically auto-populated from the first exception's type/message
- Use the `events` table with `event = '$exception'` and `issue_id` to query actual exception occurrences
+- Use `system.error_tracking_issues` for all-time issue counts by status or severity
+- Access to `system.error_tracking_issues` follows the connected user's Error tracking permissions and only returns rows from the current project
+- Use `posthog:query-error-tracking-issues-list` for issues observed during a date range or for impact counts
- Issues can be merged (combining fingerprints) or split (separating fingerprints into new issues)
---
@@ -47,7 +51,7 @@ Rows can also track missing symbol sets so future uploads know which stack frame
Column | Type | Nullable | Description
`id` | uuid | NOT NULL | Primary key (UUID)
-`team_id` | integer | NOT NULL | FK to `system.teams.id`
+`team_id` | integer | NOT NULL | PostHog project ID; foreign key to `system.teams.id`
`ref` | text | NOT NULL | Symbol set reference matched from stack frames
`release_id` | uuid | NULL | Associated error tracking release ID
`created_at` | timestamp with tz | NOT NULL | Creation timestamp
@@ -111,6 +115,16 @@ GROUP BY status
ORDER BY count DESC
```
+**Count issues by severity:**
+
+```sql
+SELECT severity, count() AS count
+FROM system.error_tracking_issues
+WHERE severity IS NOT NULL
+GROUP BY severity
+ORDER BY count DESC
+```
+
**Find exception events for a specific issue:**
```sql