Skip to content

fix(seer): Add sent_at timestamp to autofix PR analytics events#115341

Merged
trevor-e merged 3 commits into
masterfrom
telkins/fix-autofix-pr-event-sent-at
May 12, 2026
Merged

fix(seer): Add sent_at timestamp to autofix PR analytics events#115341
trevor-e merged 3 commits into
masterfrom
telkins/fix-autofix-pr-event-sent-at

Conversation

@trevor-e
Copy link
Copy Markdown
Member

@trevor-e trevor-e commented May 11, 2026

Summary

  • Autofix PR webhook analytics events (ai.autofix.pr.opened, ai.autofix.pr.merged, ai.autofix.pr.closed) were missing a sent_at field in their serialized JSON payload
  • The downstream ETL (seer_autofix_analytics_staging) relies on $.sent_at to populate pr_opened_ts, pr_merged_ts, and pr_closed_ts in seer_autofix_group_metrics
  • Adds sent_at (epoch millis) with a default factory to AiAutofixPrEvent, matching the format the ETL expects

Companion PR

Test plan

  • Existing webhook tests pass (7/7)
  • Mypy clean
  • Ruff clean

PR webhook analytics events (ai.autofix.pr.opened/merged/closed) were
missing a sent_at field in their JSON payload. The downstream ETL that
builds seer_autofix_group_metrics relies on this field to populate
pr_opened_ts, pr_merged_ts, and pr_closed_ts — without it, those
columns are always NULL, blocking merge rate analysis.

Co-Authored-By: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 11, 2026
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 688c92b. Configure here.

Comment thread src/sentry/analytics/events/ai_autofix_pr_events.py Outdated
PR webhook analytics events (ai.autofix.pr.opened/merged/closed) were
missing a sent_at field in their JSON payload. The downstream ETL that
builds seer_autofix_group_metrics relies on this field to populate
pr_opened_ts, pr_merged_ts, and pr_closed_ts — without it, those
columns are always NULL, blocking merge rate analysis.

Derives the timestamp from the GitHub webhook payload (created_at,
merged_at, closed_at) rather than recording time.

Co-Authored-By: Claude <noreply@anthropic.com>
@trevor-e trevor-e closed this May 11, 2026
@trevor-e trevor-e reopened this May 11, 2026
Replace exclude_fields=["sent_at"] with actual expected epoch
millisecond values derived from the test fixture timestamps.

Co-Authored-By: Claude <noreply@anthropic.com>
@trevor-e trevor-e marked this pull request as ready for review May 12, 2026 14:32
@trevor-e trevor-e requested review from a team as code owners May 12, 2026 14:32
@trevor-e trevor-e merged commit cd59a5d into master May 12, 2026
63 checks passed
@trevor-e trevor-e deleted the telkins/fix-autofix-pr-event-sent-at branch May 12, 2026 14:49
nikkikapadia pushed a commit that referenced this pull request May 12, 2026
)

## Summary
- Autofix PR webhook analytics events (`ai.autofix.pr.opened`,
`ai.autofix.pr.merged`, `ai.autofix.pr.closed`) were missing a `sent_at`
field in their serialized JSON payload
- The downstream ETL (`seer_autofix_analytics_staging`) relies on
`$.sent_at` to populate `pr_opened_ts`, `pr_merged_ts`, and
`pr_closed_ts` in `seer_autofix_group_metrics`
- Adds `sent_at` (epoch millis) with a default factory to
`AiAutofixPrEvent`, matching the format the ETL expects

## Companion PR
- ETL fallback for historical data:
getsentry/etl#2538

## Test plan
- [x] Existing webhook tests pass (7/7)
- [x] Mypy clean
- [x] Ruff clean

---------

Co-authored-by: Claude <noreply@anthropic.com>
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.

2 participants