Skip to content

Conversation

@malwilley
Copy link
Member

Related to #104549

Events can relate to the GroupOpenPeriod, but that was not sufficient. In the case where a detector goes from high priority to medium (or vice versa), we create a GroupOpenPeriodActivity instead. Without tracking the event_id on the activity entry, we have no way to find the corresponding open period of an arbitrary event.

Also see this decision log entry

@malwilley malwilley requested a review from a team January 29, 2026 22:49
@malwilley malwilley requested a review from a team as a code owner January 29, 2026 22:49
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 29, 2026
Copy link
Contributor

@mifu67 mifu67 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is reasonable. Should we remove the column from GroupOpenPeriod?

@github-actions
Copy link
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/1022_add_event_id_to_groupopenperiodactivity.py

for 1022_add_event_id_to_groupopenperiodactivity in sentry

--
-- Add field event_id to groupopenperiodactivity
--
ALTER TABLE "sentry_groupopenperiodactivity" ADD COLUMN "event_id" varchar(32) NULL;

@malwilley
Copy link
Member Author

I think this is reasonable. Should we remove the column from GroupOpenPeriod?

Yes, since each GroupOpenPeriod has an associated "open" activity we shouldn't need one on the main model anymore

Copy link
Contributor

@saponifi3d saponifi3d left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, iirc this shouldn't be a post deploy (even if we dropping the event_id, since it's only a django change on the first pass) and adding a Null column should be super fast, even on a huge table like this -- might be good to confirm all that with a db-migration-owner tho.

Comment on lines +29 to +30
model_name="groupopenperiodactivity",
name="event_id",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we also start the removal of the event_id on the GroupOpenPeriod table? (feels like that might get confusing sooner rather than later)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, once I get this column added and event_id data coming in I'll remove the GroupOpenPeriod one.

It might be good if we, before dropping that column, transfer the event_id data from GroupOpenPeriod to the first activity entry. That way we don't lose the last month of event_ids

value = models.IntegerField(null=True)
# The event ID that triggered this activity
event_id = models.CharField(max_length=32, null=True)
notification_uuid = models.UUIDField("notification_uuid", default=generate_random_uuid)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unrelated to this pr -- wonder why we have the notification uuid here vs using the WorfklowFireHistory? (cc @mifu67) iirc that would have the event_id + notification uuid so we can have a history of each time a workflow was triggered.

(not sure if this is replicated data or needed to represent a different notification uuid or ?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we use the notification ID on this table. I likely duplicated it from the IncidentActivity model.

@malwilley malwilley enabled auto-merge (squash) January 30, 2026 17:19
@malwilley malwilley merged commit 6f4b0ca into master Jan 30, 2026
67 checks passed
@malwilley malwilley deleted the malwilley/chore/add-event-id-column-to-groupopenperiodactivity-model branch January 30, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants