Skip to content

Filtering events

View Markdown

For some applications, certain default events may be unecessary or excessively data heavy. To specify events to ignore, use the events.ignore configuration option. Here you can specify a list of event types for the gem to ignore. They can be either a string or a regex.

events:
ignore:
- "enqueue.sidekiq"
- !ruby/regexp "/.*.active_storage/"

You may also ignore events based on event data by specifying a hash object.

events:
ignore:
- event_type: "chatty_events"
custom_data: "ignore_me"

This will ignore events that have been created with the matching event_type and key(symbol)/value:

Honeybadger.event('chatty_events', custom_data: 'ignore_me') # will not be sent to Insights

You can also use the before_event callback to inspect or modify event data, as well as calling halt! to prevent the event from being sent to Honeybadger:

config/initializers/honeybadger.rb
Honeybadger.configure do |config|
config.before_event do |event|
# Ignore health check requests
if event.event_type == "process_action.action_controller" && event[:controller] == "Rails::HealthController"
event.halt!
end
# DB-backed job backends can generate a lot of useless queries
if event.event_type == "sql.active_record" && event[:query].match?(/good_job|solid_queue/)
event.halt!
end
end
end

before_event can be called multiple times to add multiple callbacks.

The gem comes configured to ignore a few events that can be chatty and not useful:

  • sql.active_record events with queries that contain only “BEGIN” or “COMMIT”.
  • sql.active_record events for database backed background processing gems (SolidQueue and GoodJob).
  • process_action.action_controller events for Rails::HealthController actions.

If you’d rather reduce event volume across the board instead of ignoring specific events, see Sampling events.