Skip to content

feat!: Add hint support to scope-level event capture - #2099

Draft
jpnurmi wants to merge 1 commit into
jpnurmi/ref/attachment-manifestfrom
jpnurmi/feat/hints
Draft

jpnurmi wants to merge 1 commit into
jpnurmi/ref/attachment-manifestfrom
jpnurmi/feat/hints

Conversation

@jpnurmi

@jpnurmi jpnurmi commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Accept hints in sentry_scope_capture_event and pass them to before_send. Keep sentry_capture_event unchanged.

Merge hint and scope attachments before before_send and before_send_feedback, then use the resulting hint attachments in the envelope. Add sentry_hint_remove_attachment and
sentry_hint_clear_attachments to allow filtering attachments without modifying scopes.

Caution

BREAKING CHANGE: before_send callbacks now take sentry_hint_t * instead of void * for the hint parameter. sentry_scope_capture_event now requires a hint argument; pass NULL when no hint is needed. Scope attachment changes inside either callback no longer affect the current event; modify the hint instead.

Close: #2098

@jpnurmi jpnurmi changed the title feat!: Add hint support to event capture feat!: Add hint support to scope-level event capture Sep 15, 2026
Comment thread src/sentry_core.c Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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 5f5a9a8. Configure here.

Comment thread src/sentry_core.c
Comment thread src/sentry_core.c
@codecov

codecov Bot commented Sep 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.20290% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.84%. Comparing base (775eb0c) to head (71c5994).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2099      +/-   ##
==========================================
+ Coverage   74.67%   74.84%   +0.16%     
==========================================
  Files         103      103              
  Lines       27386    27395       +9     
  Branches     4944     4944              
==========================================
+ Hits        20450    20503      +53     
+ Misses       5588     5541      -47     
- Partials     1348     1351       +3     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@limbonaut limbonaut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good!

Comment thread include/sentry.h
* call `sentry_value_decref` on the provided event and return a
* `sentry_value_new_null()` instead.
*
* The hint is always provided and can be used to modify attachments on the

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We need to document a gap: crash backends currently do not pass a hint.

@tustanivsky tustanivsky left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Just to clarify - do we support hints in before_send for crash events as well? All four backends seem to pass NULL as the hint there 🤔

@jpnurmi

jpnurmi commented Sep 16, 2026

Copy link
Copy Markdown
Collaborator Author

Just to clarify - do we support hints in before_send for crash events as well? All four backends seem to pass NULL as the hint there 🤔

Hmm, but sentry-unreal sets on_crash which replaces before_send for crash events. 😕

EDIT: Which means, do we then need hint for on_crash, too?

@jpnurmi
jpnurmi marked this pull request as draft September 16, 2026 11:23
@tustanivsky

Copy link
Copy Markdown
Collaborator

Hmm, but sentry-unreal sets on_crash which replaces before_send for crash events

Right, for Unreal it’s on_crash that matters so a before_send fix alone wouldn’t help there. But it still makes sense for users who rely solely on before_send.

Which means, do we then need hint for on_crash, too?

Yes, I think it would be good to align what both callbacks carry so downstream SDKs get the same capabilities regardless of which hook handles the event.

Accept hints in `sentry_scope_capture_event` and pass them to
`before_send`. Keep `sentry_capture_event` unchanged.

Merge hint and scope attachments before `before_send` and
`before_send_feedback`, then use the resulting hint attachments in the
envelope. Add `sentry_hint_remove_attachment` and
`sentry_hint_clear_attachments` to filter attachments without modifying
scopes.

BREAKING CHANGE: `before_send` callbacks now take `sentry_hint_t *`
instead of `void *` for the hint parameter. `sentry_scope_capture_event`
now requires a hint argument; pass `NULL` when no hint is needed.
Scope attachment changes inside either callback no longer affect the
current event; modify the hint instead.

Close: #2098
@jpnurmi
jpnurmi changed the base branch from master to jpnurmi/ref/attachment-manifest September 18, 2026 16:46
@jpnurmi
jpnurmi added this pull request to stack #2113 September 18, 2026 16:49
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.

Feature request: hints

4 participants