Skip to content

Comments

feat: Add beforeBreadcrumb callback support#1534

Merged
tustanivsky merged 6 commits intomasterfrom
feat/before-breadcrumb-callback
Feb 19, 2026
Merged

feat: Add beforeBreadcrumb callback support#1534
tustanivsky merged 6 commits intomasterfrom
feat/before-breadcrumb-callback

Conversation

@tustanivsky
Copy link
Collaborator

@tustanivsky tustanivsky commented Feb 19, 2026

Summary

This PR adds beforeBreadcrumb callback support allowing users to inspect, modify or discard breadcrumbs before they are added to global scope. The callback fires in sentry_add_breadcrumb (global path only); breadcrumbs added directly to local scopes via sentry_scope_add_breadcrumb bypass it. When a breadcrumb is discarded, neither the backend nor the scope is notified (no ghost breadcrumbs in captured events).

Similar callback is already implemented in Android and Cocoa SDKs.

Related items:

Key changes

  • New public API: sentry_before_breadcrumb_function_t typedef and sentry_options_set_before_breadcrumb setter
  • Invoke callback in sentry_add_breadcrumb using the discarded flag pattern to safely exit the SENTRY_WITH_OPTIONS for-loop macro

Testing

  • Unit tests: discard, modify and passthrough cases considered
  • Integration tests: modify and discard breadcrumbs paths

@github-actions
Copy link

github-actions bot commented Feb 19, 2026

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 5b36257

@tustanivsky tustanivsky merged commit 00f13ae into master Feb 19, 2026
80 of 81 checks passed
@tustanivsky tustanivsky deleted the feat/before-breadcrumb-callback branch February 19, 2026 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants