Skip to content

Commit 0acc540

Browse files
cvxluoclaude
andcommitted
docs(grouping): remove hierarchical grouping, add Seer AI grouping
Co-authored-by: Claude <noreply@anthropic.com>
1 parent 25bcb17 commit 0acc540

File tree

1 file changed

+47
-29
lines changed

1 file changed

+47
-29
lines changed

develop-docs/backend/application-domains/grouping.mdx

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,10 @@ by the client yet, three systems start operating:
3333
the special `{{ default }}` value.
3434

3535
It's important to know that the grouping algorithm can produce more than one fingerprint hash. These hashes
36-
are collected and associated with issues. There are two types of hashes that can be created:
37-
38-
* flat hashes: these are traditional hashes where all hashes are equal. If any of these hashes exists in a group
39-
it is associated with it and any hash not yet associated with the group is added.
40-
* hierarchical hashes: these are secondary hashes that can be used to subdivide a group in the grouping tab.
36+
are collected and associated with issues via the `GroupHash` model. If any of these hashes exists in a group
37+
the event is associated with it, and any hash not yet associated with the group is added. In practice this
38+
means an event may produce both an "app" hash (using only in-app frames) and a "system" hash (using all frames),
39+
and either one matching an existing group is sufficient.
4140

4241
# Issue / Group Creation
4342

@@ -56,9 +55,38 @@ event as it flows further through the system to make it's way towards snuba, is
5655
which also means that the group is persisted in snuba along with the event.
5756

5857
Upon group creation, additional code runs such as the triggering of alerts, regression detection and more.
59-
It is thus relatively expensively to create a group due to the number of additional actions that can be
58+
It is thus relatively expensive to create a group due to the number of additional actions that can be
6059
triggered from it.
6160

61+
# AI Grouping via Seer
62+
63+
In addition to hash-based grouping, Sentry in SaaS uses Seer to detect similar issues
64+
based on stacktrace embeddings. Seer sits in the grouping pipeline *after* hash-based lookup and *before*
65+
new group creation:
66+
67+
1. The event's hashes are computed via the standard grouping algorithm.
68+
2. Sentry checks whether any of those hashes already belong to an existing group.
69+
3. If no existing group is found, and the event is eligible, Sentry calls Seer with the event's
70+
stacktrace (and exception type, platform, etc.) to search for a semantically similar existing issue.
71+
4. If Seer returns a match above the confidence threshold, the event is assigned to that existing group
72+
instead of creating a new one.
73+
5. If Seer finds no match (or the event is ineligible), a new group is created as before.
74+
75+
Eligibility for a Seer call is determined by [`should_call_seer_for_grouping`](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/ingest/seer.py)
76+
in `src/sentry/grouping/ingest/seer.py`. The check considers:
77+
78+
- Whether the event has a usable stacktrace (Seer operates on stacktrace embeddings)
79+
- Whether the event's platform is supported
80+
- Whether the project has similarity grouping enabled
81+
- Whether the event uses a custom fingerprint (custom-fingerprinted events skip Seer)
82+
- Rate limits (both global and per-project)
83+
- A circuit breaker that trips if Seer error rates are too high
84+
- Stacktrace size limits
85+
86+
Results — including the matched grouphash, match distance, and model version — are
87+
persisted in the [`GroupHashMetadata`](https://github.com/getsentry/sentry/blob/master/src/sentry/models/grouphashmetadata.py)
88+
model alongside the event's hash-based grouping metadata.
89+
6290
# Merges and Splits
6391

6492
The system does not cope particularly well with merges and splits because the events in Snuba are generally
@@ -148,8 +176,7 @@ existing group.
148176
Sentry at the moment feeds the entire stack into the group. There is a way to limit the number of frames
149177
contributed down to a smaller set by setting a maximum number of frames that should be considered. This
150178
has a hypothetical advantage when working with different paths that lead to a bug but have the consequence
151-
that very large groups can be created. Creating larger groups is tricker in Sentry as without hierarchical
152-
grouping there are no good ways to dive into the different stacks in an issue.
179+
that very large groups can be created.
153180

154181
## Fallback Grouping
155182

@@ -171,37 +198,28 @@ think of grouping as a problem of the source of the error. At any point the que
171198
source of the error is "how we call a function" (caller error) or "in the function" (callee error). Making
172199
this decision is impossible to make in a general sense, but over time it can be easier to make this call.
173200

174-
Sentry has an experimental grouping system called "hierarchical" grouping where we allow diving into the
175-
different paths towards a bug by preferring to over-group and then provide a grouping tab that can show
176-
the different paths by which we came to the error. However the limitation of this with the current group
177-
system is that since the group has been created, there is now way to split out, you can end up with a much
178-
larger group than you desired.
179-
180201
# Paths Forward
181202

182-
The grouping system as implemented relates very close to the work flow that is established with the groups
183-
that are created. It is the creator of the groups and as the creator, it drives a big part of the user
184-
experience that derives from it. If it were to create a single issue per event, or a single issue for all
185-
events nothing in Sentry would properly function any more. It is thus our first point of balancing the
186-
quality of the workflow. Unfortunately with the tools available today there we are sitting in a pretty
187-
tough spot at the time of grouping. If we get it wrong, the user is likely stuck.
203+
The grouping system is tightly coupled to the workflow that issues drive. It is the creator of the groups
204+
and as the creator, it drives a big part of the user experience. If it were to create a single issue per
205+
event, or a single issue for all events, nothing in Sentry would properly function. It is thus our first
206+
point of balancing the quality of the workflow.
207+
208+
## Improving Seer
188209

189-
The following general paths forward are current envisioned:
210+
The introduction of AI-assisted grouping via Seer has already improved the caller-vs-callee problem described
211+
above, but there is ongoing work to improve model accuracy, expand platform support, and reduce latency.
212+
Key areas include better handling of hybrid fingerprints, improving confidence thresholds, and training on
213+
broader datasets.
190214

191215
## Groups of Groups
192216

193217
The consequences of making too many groups today are alert spam and the inability to work with multiple
194218
issues at once. If Sentry were to no longer be alerting on all new groups and tools existed to work
195-
across multiple groups more opportunities arise. In particular the grouping algorithm could continue to
219+
across multiple groups, more opportunities arise. In particular the grouping algorithm could continue to
196220
just fingerprint the stack trace but a secondary process could come in periodically and sweep up related
197221
fingerprints into a larger group. If we take the `get_current_user` example the creation of 50 independent
198-
groups is not much of an issue if no alerts are fired. If after 5 minute the system detected that they are
222+
groups is not much of an issue if no alerts are fired. If after 5 minutes the system detected that they are
199223
in fact all very related (eg: the bug is "in `get_current_user`") it could leave the 50 generated groups
200224
alone but create a new group that links the other 50 groups, hide/deemphasize the individual 50 groups in
201225
the UI and let the user work with the larger group instead.
202-
203-
## Evaluate Hierarchical Grouping
204-
205-
We also have the hierarchical grouping prototype which tries to group on fewer inputs. This system has
206-
some limitations but it's less likely to create many groups. Unfortunately the user experience is
207-
not fleshed out as working with parts of the group is not an option.

0 commit comments

Comments
 (0)