Skip to content

Add a fingerprint proc to choose what an error is grouped by - #121

Open
namolnad wants to merge 2 commits into
fractaledmind:mainfrom
namolnad:fingerprint-proc
Open

namolnad wants to merge 2 commits into
fractaledmind:mainfrom
namolnad:fingerprint-proc

Conversation

@namolnad

Copy link
Copy Markdown
Contributor

Closes #116.

Adds config.solid_errors.fingerprint, a proc called with the exception and its stored attributes (exception_class, message, severity, source). Occurrences whose procs return the same string are grouped into one error. The subscriber still hashes the result, so the fingerprint column keeps its format.

  • Nothing regroups on upgrade. The default joins class, message, severity and source in the same order as before, so every existing fingerprint is unchanged. A test asserts the default against the old SHA256(values.join).
  • The message is stored as reported. The error keeps the message it was first reported with, id included. A test reports two messages that differ only in a req_ id, plus a third that differs otherwise. The first two become one error with two occurrences, and the third stays a separate error.
  • Each occurrence keeps its own message. Once errors group, every message after the first would be stored nowhere: the error keeps only the first, and occurrences have no message column. So the subscriber now puts the message an occurrence was raised with into its context as message, unless the app already set that key. Its id stays findable, and it shows with the occurrence's other context on the error page and in the email. The copy goes through the sanitizer like everything else in the context, so the existing 64 KB string cap applies to it. This adds a key to every occurrence's context, not only grouped ones. One existing test that asserts a whole context hash gains it.
  • The proc gets the exception too, so an app can group on class, or on something the exception carries that isn't in the message. There's a test for that.
  • The README has a bullet next to ignored_errors and a short "Grouping occurrences into errors" section, and "What each occurrence records" now mentions the message.

I left CHANGELOG.md alone, since the entries link to the PR. I'm happy to add the line once this has a number.

Each occurrence also records the message it was raised with in its
context, since a grouped error keeps only the first one.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Let apps shape the fingerprint, so a message with a per-request id doesn't split one error into many

1 participant