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): add issue state timestamp (#81355)

Hugues Pouilloteaa47d3d2e1a
diff --git a/products/error_tracking/backend/migrations/0025_issue_state_updated_at.py b/products/error_tracking/backend/migrations/0025_issue_state_updated_at.py
new file mode 100644
index 000000000000..409ccec2cae2
--- /dev/null
+++ b/products/error_tracking/backend/migrations/0025_issue_state_updated_at.py
@@ -0,0 +1,18 @@
+# Generated by Django 5.2.17 on 2026-08-11 15:59
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("error_tracking", "0024_errortrackingissue_severity"),
+ ("posthog", "1298_user_stripped_alias_index"),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name="errortrackingissue",
+ name="state_updated_at",
+ field=models.DateTimeField(blank=True, null=True),
+ ),
+ ]
diff --git a/products/error_tracking/backend/migrations/0026_issue_state_updated_at_index.py b/products/error_tracking/backend/migrations/0026_issue_state_updated_at_index.py
new file mode 100644
index 000000000000..b93e202d065e
--- /dev/null
+++ b/products/error_tracking/backend/migrations/0026_issue_state_updated_at_index.py
@@ -0,0 +1,22 @@
+from django.db import migrations, models
+
+from posthog.migration_helpers import SafeAddIndexConcurrently
+
+
+class Migration(migrations.Migration):
+ atomic = False
+
+ dependencies = [
+ ("error_tracking", "0025_issue_state_updated_at"),
+ ]
+
+ operations = [
+ SafeAddIndexConcurrently(
+ model_name="errortrackingissue",
+ index=models.Index(
+ condition=models.Q(state_updated_at__isnull=False),
+ fields=["team", "-state_updated_at"],
+ name="et_issue_team_state_idx",
+ ),
+ ),
+ ]
diff --git a/products/error_tracking/backend/migrations/max_migration.txt b/products/error_tracking/backend/migrations/max_migration.txt
index e7819733869b..bfa4f7221e2a 100644
--- a/products/error_tracking/backend/migrations/max_migration.txt
+++ b/products/error_tracking/backend/migrations/max_migration.txt
@@ -1 +1 @@
-0024_errortrackingissue_severity
+0026_issue_state_updated_at_index
diff --git a/products/error_tracking/backend/models.py b/products/error_tracking/backend/models.py
index b8f87372106d..a03690bc77a4 100644
--- a/products/error_tracking/backend/models.py
+++ b/products/error_tracking/backend/models.py
@@ -64,6 +64,7 @@ class ErrorTrackingIssue(UUIDTModel):
team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE)
created_at = models.DateTimeField(auto_now_add=True)
+ state_updated_at = models.DateTimeField(null=True, blank=True)
status = models.TextField(choices=Status, default=Status.ACTIVE, null=False)
severity = models.TextField(choices=Severity, null=True, default=None)
name = models.TextField(null=True, blank=True)
@@ -73,6 +74,13 @@ class ErrorTrackingIssue(UUIDTModel):
class Meta:
db_table = "posthog_errortrackingissue"
+ indexes = [
+ models.Index(
+ fields=["team", "-state_updated_at"],
+ name="et_issue_team_state_idx",
+ condition=models.Q(state_updated_at__isnull=False),
+ )
+ ]
def merge(
self, issue_ids: Sequence[str | UUID], expected_fingerprint_issue_ids: dict[str, UUID] | None = None