Skip to content

before_breadcrumb has no effect for Active Support breadcrumbs #1357

@mattbrictson

Description

@mattbrictson

Describe the bug

The Sentry documentation says I can define a before_breadcrumb proc to filter breadcrumbs before they are sent to Sentry. In a Rails app configured to use the Active Support breadcrumb logger, this does not work.

To Reproduce

Configure Sentry to use the Active Support breadcrumb logger:

config.breadcrumbs_logger = [:active_support_logger]

Define a before_breadcrumb proc as suggested in the documentation:

config.before_breadcrumb = lambda do |breadcrumb, hint|
  nil # reject all breadcrumbs
end

Now trigger an error in the Rails app and view the error in the Sentry UI.

Expected behavior

Sentry should not capture any breadcrumbs for the event.

Actual behavior

The Sentry UI shows a full list of breadcrumbs, even though before_breadcrumb said to filter them all out.

Further investigation shows that before_breadcrumb is never called.

config.before_breadcrumb = lambda do |breadcrumb, hint|
  raise "please stop!" # this code is never reached; sentry never calls this proc
end

Environment

  • Ruby Version: 3.0.0
  • SDK Version: 4.3.0
  • Integration Versions (if any):
  • Rails 6.1.3

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions