Skip to content

Automatic instrumentation

View Markdown

Honeybadger Insights captures events from your Ruby application, including web requests, database queries, background jobs, and cache operations, and makes them available for querying, visualization, and dashboards. In a Rails app, this gives you performance monitoring and observability out of the box without additional instrumentation libraries.

In Honeybadger Ruby gem v6.0+, Insights is enabled by default. If you’re using an older gem version (v5.11+), you’ll need to enable it manually in your honeybadger.yml configuration file:

insights:
enabled: true

Automatic instrumentation sends events from Rails, ActiveJob, Sidekiq, SolidQueue, Karafka, Net::HTTP, Puma, and more to Honeybadger, where they will be displayed in the Insights section of your project.

See the Ruby event reference for every event the gem emits, with field schemas and types.

To find these events, filter by event_type::str. Here’s an example BadgerQL query that you can use:

fields @ts, @preview
| filter event_type::str == "perform.sidekiq"
| sort @ts

Customizing Insights for a specific plugin

Section titled “Customizing Insights for a specific plugin”

When Insights is active, all plugins are enabled if the required library is present. For example, if Sidekiq is present in your app, the Sidekiq plugin will be loaded. You can disable automatic Insights instrumentation for a specific plugin by adding a configuration like this:

sidekiq:
insights:
enabled: false

This will only affect Insights-related data capture and not the error notification portion of the plugin.

Some plugins allow for an easy way to choose if you want to capture events, metrics, or both for a particular plugin. The following configuration options are available:

rails:
insights:
events: true
metrics: false
karafka:
insights:
events: true
metrics: false
sidekiq:
insights:
events: true
metrics: false
net_http:
insights:
events: true
metrics: false
solid_queue:
insights:
events: true
metrics: false
puma:
insights:
events: true
metrics: false
autotuner:
insights:
events: true
metrics: false

Event options are all true by default. It is recommened to turn off events for plugins that may be producing more data than you actually need. Metric data collection is false by default since most metrics can be calculated from events.

By default, the net_http plugin logs the domain name of any request as part of the event payload. You can enabling logging of the full URL by setting the following configuration:

net_http:
insights:
full_url: true

If some events are noisy or you’d like to reduce quota consumption:

Automatic instrumentation covers the libraries the gem knows about. To send your own application events, see Sending custom events.

The Honeybadger Ruby gem does more than just send events when they occur in your app. You can also enable metric collection. Check out Collecting and Reporting Metrics for more information.

If you are already using the Rails logger to track events in your application, you can send those events to Insights by using a structured logging gem.