Custom Exception Fingerprinting for Sentry

Randall A Gordon
Developing Koan
Published in
1 min readNov 29, 2021
Photo by George Prentzas

Monitoring services like Sentry are a lifesaver for understanding errors in production, but they aren’t without limitations. When using third-party code it may report errors to your exception monitoring service that aren’t immediately actionable. Browser plugins are another common source of such exceptions. If you use Sentry as we do here at Koan, their automated fingerprinting is often sufficient to set up filters to catch them, but occasionally they just don’t match up reliably and slip through—which is problematic if you’re holding the pager!

The following setup works with the beforeSend method which can be defined when configuring the Sentry client. The exception message is tested against the provided regular expression regex. Optionally, if more precision is required, a set of eventKeyPaths can be provided which leans on Lodash’s get to perform the same regex test against all paths. As you can see, we were having issues with grouping DraftJS related errors!

With a custom fingerprint attached to matching exceptions, filtering and setting up rules in Sentry will hopefully be much easier!

--

--