Skip to content

Commit 7635fce

Browse files
lobsterkatieandrewshie-sentry
authored andcommitted
ref(grouping): Add timestamp to tombstone table (#83473)
This adds a `date_added` field to the `GroupTombstone` table. We currently store who did the tombstoning, and what was tombstoned, but not when it happened. This information would have been helpful in investigating #82501, and while that's now closed, I figured I'd add it in case a similar thing ever comes up again (or in case we want to analyze tombstoning trends over time or something).
1 parent 32cc6be commit 7635fce

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

migrations_lockfile.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ remote_subscriptions: 0003_drop_remote_subscription
1515

1616
replays: 0004_index_together
1717

18-
sentry: 0815_add_action_cols_to_threads_model
18+
sentry: 0816_add_timestamp_to_group_tombstone
1919

2020
social_auth: 0002_default_auto_field
2121

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Generated by Django 5.1.4 on 2025-01-15 00:48
2+
3+
import django.utils.timezone
4+
from django.db import migrations, models
5+
6+
from sentry.new_migrations.migrations import CheckedMigration
7+
8+
9+
class Migration(CheckedMigration):
10+
# This flag is used to mark that a migration shouldn't be automatically run in production.
11+
# This should only be used for operations where it's safe to run the migration after your
12+
# code has deployed. So this should not be used for most operations that alter the schema
13+
# of a table.
14+
# Here are some things that make sense to mark as post deployment:
15+
# - Large data migrations. Typically we want these to be run manually so that they can be
16+
# monitored and not block the deploy for a long period of time while they run.
17+
# - Adding indexes to large tables. Since this can take a long time, we'd generally prefer to
18+
# run this outside deployments so that we don't block them. Note that while adding an index
19+
# is a schema change, it's completely safe to run the operation after the code has deployed.
20+
# Once deployed, run these manually via: https://develop.sentry.dev/database-migrations/#migration-deployment
21+
22+
is_post_deployment = False
23+
24+
dependencies = [
25+
("sentry", "0815_add_action_cols_to_threads_model"),
26+
]
27+
28+
operations = [
29+
migrations.AddField(
30+
model_name="grouptombstone",
31+
name="date_added",
32+
field=models.DateTimeField(default=django.utils.timezone.now, null=True),
33+
),
34+
]

src/sentry/models/grouptombstone.py

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from typing import Any
55

66
from django.db import models
7+
from django.utils import timezone
78

89
from sentry.backup.scopes import RelocationScope
910
from sentry.constants import LOG_LEVELS, MAX_CULPRIT_LENGTH
@@ -23,6 +24,8 @@
2324
class GroupTombstone(Model):
2425
__relocation_scope__ = RelocationScope.Excluded
2526

27+
# Will be null for tombstones created before January 2025
28+
date_added = models.DateTimeField(default=timezone.now, null=True)
2629
previous_group_id = BoundedBigIntegerField(unique=True)
2730
project = FlexibleForeignKey("sentry.Project")
2831
level = BoundedPositiveIntegerField(

0 commit comments

Comments
 (0)