Introducing custom error grouping: More choices for grouping errors with Raygun

Daniel WylieProduct Updates, Provider Updates2 Comments

Custom error grouping with Raygun

* This article was last updated February 2018 to include the latest provider support for custom error grouping.

Error grouping can be tricky. Everyone has slightly different ideas of what should be grouped together. Add some inconsistencies between languages and it gets even harder—we’re looking at you, JavaScript!

Here at Raygun, we think our hashers are pretty sweet, but there are always edge cases that we can’t deal with.

Enter custom error grouping

What is custom error grouping? We use custom error hashing as the key that tells Raygun which error group the error should go into. Generally, the payload hits the Raygun servers, which runs a hashing algorithm over it and sorts it into the correct group. This works 99.99% of the time—your errors show up exactly where you expect them and everybody is happy.

Of course, there is always the chance that Raygun’s hasher doesn’t group your error how you desire.

What are my options?

We have two options to get around this problem:

  1. Use message-based hashing. But, this has limitations the second you have two messages that are the same but have very different causes.
  2. Now you can also provide your own hashing key!

What does providing your own hashing key involve?

Not that much actually. A word of warning though: generating a useful hash key can be quite a bit harder than it first appears—but with a decent amount of care, you should be able to build something that matches your needs perfectly if one of the built-in ones don’t do the trick.

But back to the point, you simply pass a “GroupingKey” property through on the payload and Raygun uses that instead of its own built-in hashing methods. Your errors are then fired straight through to the group that you’ve chosen!

Which providers does Raygun support?

At present, Raygun offers custom grouping for the following providers:

Let’s have a quick look at the Node.js provider and see what we can do!

When setting up the provider, we implement the groupingKey function like so:

Obviously, that’s not very useful as all of your errors will be grouped together. So let’s try something a bit more useful:

Boom! Errors are now grouped using their message, stack trace length and error class name. Helpful? Probably not—but it makes a good demo, right‽

As I said before, custom error grouping should be a last resort for when the built-in hashers don’t quite suit you. But as always, the more choices you have the better!

Related articles

Updated error grouping UI: Surface errors faster

How to locate InnerErrors with Raygun

Next level software intelligence across your entire stack.

2 Comments on “Introducing custom error grouping: More choices for grouping errors with Raygun”

  1. Pingback: Welcome to Raygun: An easy navigation guide for first time users

  2. Pingback: Strategies and tips for better error grouping in Raygun

Leave a Reply

Your email address will not be published. Required fields are marked *