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 first line of the application trace or the backtrace otherwise
  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.exception_fingerprint callback allows you to calculate a fingerprint using information from the exception right before it is reported to Honeybadger. Its block should return the String fingerprint for the exception:

Honeybadger.exception_fingerprint do |notice|
  [notice[:error_class], notice[:component], notice[:backtrace].to_s].join(':')
end

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')