Skip to content

fix(notifier): migrate Sentry Event.Extra to Contexts for sentry-go v0.46#33

Merged
ankurs merged 2 commits intomainfrom
fix/sentry-go-v0.46-event-extra
May 4, 2026
Merged

fix(notifier): migrate Sentry Event.Extra to Contexts for sentry-go v0.46#33
ankurs merged 2 commits intomainfrom
fix/sentry-go-v0.46-event-extra

Conversation

@ankurs
Copy link
Copy Markdown
Member

@ankurs ankurs commented May 4, 2026

Summary

  • sentry-go v0.46 removed Event.Extra. Downstream consumers that pull v0.46+ transitively fail to compile against errors v0.2.15 with unknown field Extra in struct literal of type sentry.Event.
  • Migrate the extra payload to event.Contexts["extra"] (sentry.Context is a map[string]interface{} alias, so the shape is preserved) and only set it when non-empty.
  • Bump github.com/getsentry/sentry-go from v0.43.0 to v0.46.2.

Test plan

  • go build ./...
  • go test -race ./...
  • make lint (golangci-lint + govulncheck)

Summary by CodeRabbit

  • Chores
    • Updated Sentry error tracking dependency to the latest version.
    • Adjusted how event metadata is structured to align with updated Sentry library requirements.

…0.46

sentry-go v0.46 removed Event.Extra. Move the extra map to
event.Contexts["extra"] (Context is a map[string]interface{} alias,
so the payload structure is preserved) and bump the dependency to
v0.46.2.
Copilot AI review requested due to automatic review settings May 4, 2026 11:18
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6e3a4279-6c6e-444a-b783-251487c31fd9

📥 Commits

Reviewing files that changed from the base of the PR and between 21b1808 and b4da913.

⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (3)
  • go.mod
  • notifier/notifier.go
  • notifier/notifier_sentry_test.go

📝 Walkthrough

Walkthrough

The PR updates the Sentry Go client library from v0.43.0 to v0.46.2 and adapts the notifier to store extra data in event.Contexts["extra"] instead of event.Extra, with corresponding test updates.

Changes

Sentry Event Extra Data Migration

Layer / File(s) Summary
Dependency Update
go.mod
github.com/getsentry/sentry-go bumped from v0.43.0 to v0.46.2.
Core Implementation
notifier/notifier.go
buildSentryEvent no longer populates event.Extra; when extra data is non-empty, it initializes event.Contexts and assigns event.Contexts["extra"] = extra.
Test Updates
notifier/notifier_sentry_test.go
TestSentryExtra and TestBuildSentryEvent assertions updated to verify extra data via event.Contexts["extra"] instead of event.Extra.

Possibly Related PRs

  • feat: migrate from raven-go to sentry-go #13: Introduced buildSentryEvent using event.Extra for extras; this PR refactors it to use event.Contexts["extra"] and updates corresponding tests in response to the sentry-go library API evolution.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~8 minutes


🐰 A hop, a bump, a context shift so fine,
Extra data finds a better home to shine,
Sentry's path now clearer, bright,
Tests and code dance left to right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: migrating Sentry Event.Extra to Contexts for sentry-go v0.46, which directly aligns with the primary alteration in the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/sentry-go-v0.46-event-extra

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the Sentry notifier integration to remain compatible with github.com/getsentry/sentry-go v0.46+, which removed sentry.Event.Extra, by moving the “extra” payload into Event.Contexts.

Changes:

  • Migrate Sentry “extra” data from Event.Extra to Event.Contexts["extra"], only setting it when non-empty.
  • Update Sentry-related tests to assert against Contexts["extra"] instead of Extra.
  • Bump github.com/getsentry/sentry-go dependency to v0.46.2 (and refresh go.sum).

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
notifier/notifier.go Moves extra payload onto event.Contexts["extra"] for sentry-go v0.46 compatibility.
notifier/notifier_sentry_test.go Updates assertions to validate extra data via event.Contexts["extra"].
go.mod Bumps github.com/getsentry/sentry-go to v0.46.2.
go.sum Updates checksums for the sentry-go version bump.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread notifier/notifier.go Outdated
Initialize event.Contexts lazily and assign the "extra" key, instead
of replacing the whole map, so future contexts added before this
point aren't clobbered.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ankurs ankurs merged commit dbbc891 into main May 4, 2026
11 checks passed
@ankurs ankurs deleted the fix/sentry-go-v0.46-event-extra branch May 4, 2026 12:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants