Customizing Error Grouping

Honeybadger groups similar exceptions together using rules which we’ve found to work the best in most cases. The default information we use to group errors is:

  1. The file name, method name, and line number of the error’s location
  2. The class name of the error
  3. The component/controller name

We use this information to construct a “fingerprint” of the exception. Exceptions with the same fingerprint are treated as the same error in Honeybadger.

It is possible to customize your grouping by sending a different fingerprint to Honeybadger when the exception is reported.

There are two ways you can customize the fingerprint: globally (for all exceptions that are reported from your app), and locally (when calling Honeybadger.notify).

Customizing the Grouping for all Exceptions

The Honeybadger.before_notify callback in conjunction with the Notice#fingerprint method allows you to change the fingerprint of a notice to properly group the same notices.

Honeybadger.configure do |config|
  config.before_notify do |notice|
    notice.fingerprint = [notice.error_class,
      notice.component, notice.backtrace.join(',')].join(':')

For a list of properties available on the notice parameter, see the API reference.

Customizing the Grouping for Honeybadger.notify

The :fingerprint option can be used to override the fingerprint for an exception reported with Honeybadger.notify:

Honeybadger.notify(exception, fingerprint: 'a unique string')