Prompt
I'm building a developer tool and want Sentry-style error grouping plus Slack alerts. What should I compare?
Latest observation
For Sentry-style grouping, you generally want to compare the error identity, not the full raw message. The goal is to group “the same bug” together while avoiding merging unrelated issues.
What to compare
1. Exception type / class
TypeError,NullReferenceException,SyntaxError, etc.- This is usually the strongest grouping key.
2. Stack trace frames
Compare a normalized version of the stack trace:
- function/method names
- file names
- line/column numbers
- module/package names
Usually you compare:
- the top frame or
- the top N frames from the application code
Good practice:
- ignore noisy internal/library frames
- normalize dynamic line numbers if your runtime makes them unstable
- include the first “in-app” frame
3. Root cause / exception chain
If your platform supports chained exceptions:
- compare the full causal chain
- at minimum include the root exception type + top frame
Example:
DatabaseTimeoutError caused by RequestError- should not group with
DatabaseTimeoutError caused by CacheMissError
4. Message template, not full message
Avoid grouping by the exact message if it contains dynamic values.
Bad:
User 1234 not foundUser 9876 not found
Better:
- normalize to
User {id} not found
You can compare:
- message prefix
- message with numbers/UUIDs/paths/timestamps stripped
- a template extracted from the message
5. Location of origin
If stack traces are weak or absent, compare:
- source file
- line
- code path
- endpoint / job / handler name
This is especially useful for:
- frontend errors without full stacks
- logs from background jobs
- uncaught exceptions in serverless functions
6. Environment and release, but usually not for grouping
These should usually be part of alert routing/metadata, not the grouping key:
- environment: prod/staging
- release version
- service name
- tenant/customer
- region
They help decide who gets paged, but if you include them in the grouping key you may over-split issues.
A practical grouping strategy
A good default fingerprint is something like:
- exception type
- normalized message template
- top in-app stack frame
- causal root exception type
Example fingerprint:
TypeError | Cannot read property {prop} of undefined | app/controllers/user.js:42 | caused_by:ReferenceError
Or, if you prefer stack-centric grouping:
error.type + first_in_app_frame + top_3_frames
What not to compare too literally
Avoid grouping on:
- exact timestamps
- IDs, UUIDs, emails
- file paths containing user-specific data
- full request URLs with query strings
- exact line numbers if generated code or minified bundles make them unstable
- entire log payloads
Slack alerts: what to include
For Slack notifications, include both:
- the group fingerprint
- the latest occurrence details
Useful fields:
- error type
- message
- first/last seen
- occurrence count
- service/environment/release
- top stack frame
- link to the issue/detail page
- example request ID / trace ID
A good alert should answer:
- What is failing?
- Where?
- How often?
- Is it new or recurring?
- Can I click through to investigate?
Recommended rule of thumb
If you want one simple answer:
Compare exception type + normalized message + top application stack frame. Then use environment/release/service only as metadata for routing and alerting.
If you want, I can also give you:
- a concrete fingerprinting algorithm,
- a normalization function for messages/stack traces, or
- a Slack alert payload schema.