14.2.1 Custom fingerprinting

Custom fingerprinting allows you to control how errors are grouped by providing a list of strings when reporting an error. Errors sharing the same fingerprint are grouped together, overriding default grouping. By default, Telebugs might group errors separately if they contain unique details, such as different order numbers in error messages (e.g., Payment failed for order 123 and Payment failed for order 456). With custom fingerprinting, users can group such errors together.

For example, to group payment failure errors regardless of order IDs:

begin
  # Some code that might fail
rescue StandardError => e
  Sentry.capture_exception(e, fingerprint: ["payment-failure"])
end

In this example, setting ["payment-failure"] as the fingerprint ensures all errors with this fingerprint are grouped into one, making it easier to track payment-related issues collectively.

For dynamic grouping by user action (e.g., "checkout" or "login"):

begin
  # Some code that might fail
rescue StandardError => e
  action = "checkout"  # From app context
  Sentry.capture_exception(e, fingerprint: ["error", action])
end

This creates separate groups for each action type, such as ["error", "checkout"] for checkout errors and ["error", "login"] for login errors, providing a clearer picture of where problems occur.

This aligns with Sentry’s fingerprinting, enabling flexible organization by features or error types.