SDK Fingerprinting

In supported SDKs, you can override the Sentry default grouping passing the fingerprint attribute an array of strings. For example, in JavaScript you can group by the method, path and the err.statusCode like this:

function makeRequest(method, path, options) {
    return fetch(method, path, options).catch(function(err) {
        Sentry.withScope(function(scope) {
          // group errors together based on their request and response
          scope.setFingerprint([method, path, err.statusCode]);
          Sentry.captureException(err);
        });
    });
}

Similarly, you can pass {{ default }} in the fingerprint to extend the built-in behavior:

function makeRequest(method, path, options) {
    return fetch(method, path, options).catch(function(err) {
        Sentry.withScope(function(scope) {
          // extend the fingerprint with the request path
          scope.setFingerprint(['{{ default }}', path]);
          Sentry.captureException(err);
        });
    });
}

The following extra values are available for fingerprints:

  • {{ default }}: adds the default fingerprint values
  • {{ transaction }}: groups by the event’s transaction
  • {{ function }}: groups by the event’s function name
  • {{ type }}: groups by the event’s exception type name
  • {{ module }}: groups by the event’s module name
  • {{ package }}: groups by the event’s package name

Use Cases

Group errors more granularly

Your application queries an RPC interface or external API service, so the stack trace is generally the same (even if the outgoing request is very different).

The following example will split up the default group Sentry would create (represented by {{ default }}) further, taking some attributes on the error object into account:

Group errors more aggressively

A generic error, such as a database connection error, has many different stack traces and never groups together.

The following example will just completely overwrite Sentry’s grouping by omitting {{ default }} from the array: