Documentation

Check out our guides and API reference documentation on how to use Rollbar to monitor, debug, and triage errors.

Guides & SDKs    API Reference

Default Grouping Algorithm

When it comes to combining similar errors, Rollbar has a few key concepts and term:

  • An occurrence is a single event instance: an exception or log message, along with its associated metadata.
  • A fingerprint is a string used to identify each occurrence (more on this below).
  • An item is the combination of all occurrences with the same fingerprint.

Occurrences can be:

  • exceptions, which have an exception class, exception message, and stack trace. or
  • messages, which have only a string message

Goals

Rollbar tries to combine occurrences such that:

  • Occurrences with the same root cause are combined
  • Occurrences with different root causes are kept separate
  • Fingerprints are resilient to deploys and code changes

When the above goals are in conflict, we generally err on the side of creating more issues. That is, we think it's better to get a few redundant notifications than to not realize an issue is happening because it was lumped together with something else.

Grouping changes

Rollbar continuously improves the default grouping engine and automatically uses the most advanced version for projects created since 29th July 2020. You can enable it for older projects - or disable for new ones - on the 'Upgrade Grouping' settings page.

Exception Fingerprinting

For exceptions (including PHP and JavaScript errors), our basic fingerprinting algorithm is:

  1. Combine the filenames and method names from all of the stack frames
  2. Append the exception class name
  3. We recognize the exception message pattern and append the useful parameters
  4. Take the SHA1 hash of the result

The resulting SHA1 hash is used as the occurrence fingerprint.

Things to note:

  • We use all of the stack frames, not just the frame from the top of the stack. While this sometimes means there will be multiple Items for the same root cause, it also prevents unrelated issues from being combined together when they happen to call into the same library function.
  • We don't use the line numbers in the stack trace, as they often change due to unrelated code changes (i.e. someone added a line of code at the beginning of the file).
  • There is a list of exception message patterns we will recognize and use to identify the parameters for grouping. Should none of these patterns apply to the exception message, we exclude the exception message, as it often contains input that varies for each call. However as a fallback, we do include it when there are no stack frames in the trace.
  • When server.root is set, we strip the root off of each filename and replace it with a constant string. So the filenames used for the fingerprint will be different than if server.root is not set.

We've added a number of tweaks to this basic algorithm. Here are some of the big ones:

  • dates and shas are stripped from paths in filenames
  • integers 2 characters or longer are stripped from method names
  • for JavaScript errors, we attempt to match the error message against a known database, to include data from the exception message when useful, and to group across browsers. Read more about JavaScript grouping in the blog post.
  • we attempt to recognize and ignore boilerplate stack frames of frameworks

Message Fingerprinting

For messages, we apply a number of heuristics on the message text itself. The basic algorithm is:

  1. Strip out things that look like data
  2. Take the SHA1 hash of what remains

Like exceptions, the resulting SHA1 hash is used as the occurrence "fingerprint", and occurrences with the same fingerprint are combined.

"Things that look like data" includes:

  • things that look like dates or timestamps
  • email addresses
  • ip addresses
  • numbers with decimal points
  • integers 2 digits or longer
  • hexadecimals 4 digits of longer

On the other hand, we attempt to preserve "things that look like data" if we assume it's relevant for grouping, like error codes or http status codes.

Customizing Fingerprinting Rules

If our default algorithm doesn't group the occurrences the way you would like to see, you can create rules to override the default behavior. This can be found in Settings -> Custom Fingerprinting. Please see the Custom Fingerprinting guide to learn more.

Client-side Fingerprints

If you cannot describe the grouping you would like to use as Custom Fingerprinting Rules, you can calculate a fingerprint yourself and send it with the occurrence report. Note that despite its flexibility, we discourage using this feature as any change you would like to make in grouping this way will require you to re-deploy your application.

See the docs for the Rollbar library you are using for instructions on how to set specific keys in the payload. To send the fingerprint, you'll just need to set the fingerprint key in the payload to the value you want.

Occurrences with the same fingerprint will be combined. The fingerprint should be a string up to 40 characters long. If you pass a string longer than 40 characters, we'll use its SHA1 hash instead.

Updated 13 days ago

Default Grouping Algorithm


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.