Skip to content

Commit 139aa0d

Browse files
authored
feat(grouping): Document hierarchical grouping (#3916)
Document grouping breakdown, sentinel and prefix frames. New page is marked as draft, so it is still hidden from the sidebar. Fix https://getsentry.atlassian.net/browse/INGEST-115
1 parent bff7293 commit 139aa0d

File tree

9 files changed

+170
-11
lines changed

9 files changed

+170
-11
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: "Grouping Breakdown"
3+
sidebar_order: 3
4+
draft: false
5+
description: "Learn more about the grouping algorithm and using the Grouping tab in Issue Details."
6+
---
7+
8+
<Note>
9+
10+
This feature is currently only available to a few select organizations. If you have any feedback, please mail [[email protected]](mailto:[email protected]).
11+
12+
</Note>
13+
14+
<!--
15+
<Note>
16+
17+
This feature is available only if you're in the Early Adopter program. Features available to Early Adopters are still in-progress and may have bugs. We recognize the irony.
18+
19+
If you’re interested in being an Early Adopter, you can turn your organization’s Early Adopter status on/off in General Settings. This will affect all users in your organization and can be turned back off just as easily.
20+
21+
</Note>
22+
-->
23+
24+
Sentry's current grouping algorithm puts two error events into the same issue if they have the same stack trace. This approach sometimes creates multiple distinct issues for errors with the same root cause.
25+
26+
If two distinct issues are created occasionally, you may be able to reduce the noise by manually [merging](/product/issues/issue-details/#tabs) those issues. Alternatively, if you want coarser issue groups (thus fewer issues) by default, follow the process outlined here.
27+
28+
29+
<!--
30+
## Enable the Grouping Breakdown (beta)
31+
32+
Enable our newest grouping algorithm, which creates coarser (that is, fewer) issues by considering only the most relevant part of the stack trace.
33+
34+
1. Join our Early Adopter program by navigating to **Settings > General Settings**.
35+
36+
1. [Upgrade to the latest grouping algorithm](/product/data-management-settings/event-grouping#grouping-algorithms).
37+
38+
<Alert level="warning" title="Changing the grouping algorithm">
39+
40+
Upgrading the grouping algorithm cannot be undone.
41+
42+
</Alert>
43+
-->
44+
45+
## Use the Updated Grouping Breakdown
46+
47+
After enabling the updated grouping algorithm, the grouping breakdown allows you to navigate subgroups of an issue, to see what events would group together if a larger part of the stack trace were to be considered.
48+
49+
For example, if you have a crashing function called from multiple locations in your code ("intermediate function" "1" and "2"), when you move the slider all the way to the left, only the crashing frame is considered for grouping, and
50+
all events are sorted into the same issue regardless of the calling location:
51+
52+
![Breakdown of this issue on the highest level](breakdown_level_01.png)
53+
54+
When you move the slider to the right, you can see what groups would be created
55+
if the calling frame were also to be considered:
56+
57+
![Breakdown of this issue on an intermediate level](breakdown_level_02.png)
58+
59+
You can add another level by moving the slider all the way to the right. However, this does not add any new subgroups, as both calling functions are themselves called from the same location (`main`):
60+
61+
![Breakdown of this issue on the deepest level](breakdown_level_03.png)
62+
63+
## Sentinel & Prefix Frames
64+
65+
With Grouping Breakdown enabled, Sentry groups events by identifying the most
66+
interesting group of frames it can find in a stack trace.
67+
68+
To mark frames as interesting, use the `+sentinel` and `+prefix` actions in [Stack Trace Rules](/product/data-management-settings/event-grouping/stack-trace-rules). For the first level, our algorithm looks for the first frame `X` which is marked as sentinel. The fingerprint of this frame is added to the level. If `X` is also a prefix frame, the next frame `Y` is also added. If `Y` is again a prefix frame, the next frame `Z` is added, and so on.
69+
70+
If no sentinel frame is found, every frame that contributes to grouping according to the usual
71+
stack trace rules (for example, `+group`) constitutes its own level of detail.
72+
73+
#### Example
74+
75+
Consider a stack trace with functions `a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`, with `a` being the crashing frame
76+
and `h` being the thread base. Imagine you have the following stack trace rules defined:
77+
78+
```discover {tabTitle:Sentinel & Prefix Rules}
79+
function:b +sentinel +prefix
80+
function:c +prefix
81+
function:f +sentinel
82+
```
83+
84+
In this case
85+
86+
- `b` is used for grouping because it is the first sentinel frame,
87+
- `c` is used for grouping because `b` is a prefix frame,
88+
- `d` is used for grouping because `c` is a prefix frame.
89+
90+
This becomes visible in the [Breakdown tab](/product/data-management-settings/event-grouping/grouping-breakdown):
91+
92+
![Example Breakdown with Sentinel & Prefix Frames (level 1)](breakdown_sentinels_level_01.png)
93+
94+
Increasing the level adds the second sentinel:
95+
96+
![Example Breakdown with Sentinel & Prefix Frames (level 2)](breakdown_sentinels_level_02.png)
97+
98+
Finally, the deepest level contains the entire stack trace, ignoring sentinel and prefix frames:
99+
100+
![Example Breakdown with Sentinel & Prefix Frames (level 3)](breakdown_sentinels_level_03.png)

src/docs/product/data-management-settings/event-grouping/stack-trace-rules.mdx

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ The syntax for stack trace rules is similar to:
1616
matcher-name:expression other-matcher:expression ... action1 action2 ...
1717
```
1818

19-
The syntax follows the syntax from [Discover queries](/product/discover-queries/). If you want to negate the match, you can prefix the expression with an exclamation mark (`!`).
19+
The syntax is the same as the syntax used for [Discover queries](/product/discover-queries/). If you want to negate the match, prefix the expression with an exclamation mark (`!`). If a line is prefixed with a hash (`#`), it's ignored and treated as a comment.
2020

2121
The following is a practical example of how this looks:
2222

@@ -44,9 +44,11 @@ Matches on the general platform family, which currently includes `javascript`, `
4444
```discover {tabTitle:Match multiple}
4545
family:javascript,native stack.abs_path:**/generated/** -group
4646
```
47+
4748
```discover {tabTitle:Match only JavaScript}
4849
family:javascript stack.abs_path:**/generated/** -group
4950
```
51+
5052
```discover {tabTitle:Match only native}
5153
family:native stack.abs_path:**/generated/** -group
5254
```
@@ -99,13 +101,56 @@ stack.package:**/libcurl.dylib -group
99101

100102
Matches on the current state of the in-app flag of a stack trace frame. `yes` means the frame is in-app, `no` means it's not.
101103

104+
<!--
105+
106+
### `category`
107+
108+
Matches on a built-in [built-in](#built-in-categories) or a user-defined frame category.
109+
See [variable actions](#variable-actions) on how to set a category.
110+
111+
```discover {tabTitle:Category Match}
112+
category:telemetry -group
113+
```
114+
115+
#### Built-in Categories
116+
117+
Frame categorization is heavily used by our newest grouping algorithm, so [if you have it enabled](/product/data-management-settings/event-grouping/grouping-breakdown#enable-the-grouping-breakdown-beta), you can match on a variety of categories, including:
118+
119+
- `system` - detected system libraries
120+
- `std` - detected standard libraries
121+
- `ui` - UI frameworks
122+
- `driver` - graphics drivers, and so on
123+
- `telemetry` - crash reporting and analytics frameworks
124+
125+
See [our source code](https://github.com/getsentry/sentry/blob/master/src/sentry/grouping/enhancer/enhancement-configs/mobile%402021-04-02.txt) for a full list of built-in categories.
126+
127+
-->
128+
102129
</DefinitionList>
103130

131+
<!--
132+
133+
### Matching Sibling Frames
134+
135+
If information about the surrounding frames is necessary to apply a rule to a frame, use caller/callee matching syntax. For example:
136+
137+
```discover {tabTitle:Sibling matches}
138+
# Ignore in-app frames if they are called by telemetry
139+
[ category:telemetry ] | app:yes -group
140+
141+
# Ignore system frames if they call app frames
142+
category:system | [ app:yes ] -group
143+
```
144+
145+
-->
146+
104147
## Actions
105148

106149
There are two types of **actions**: flag and variables setting.
107150

108-
1. A **flag** identifies the action to be taken if all matchers match and uses these prefixes:
151+
### Flag Actions
152+
153+
A _flag_ identifies the action to be taken if all matchers match, and it uses these prefixes:
109154

110155
- `+` sets the flag
111156
- `-` unsets the flag
@@ -117,11 +162,25 @@ As an example, `-group ^-group` removes the matching frame and all frames above
117162
- `app`: marks or unmarks a frame in-app
118163
- `group`: adds or removes a frame from grouping
119164

120-
2. **variables**: Variables can be set (`variable=value`). Currently, there is just one:
165+
<!--
166+
- `sentinel`: marks a frame as [sentinel frame](#sentinel--prefix-frames)
167+
- `prefix`: marks a frame as [prefix frame](#sentinel--prefix-frames)
168+
-->
121169

122-
- `max-frames`: sets the total number of frames to be considered for grouping. The default is `0`, which means "all frames." If set to `3`, only the top three frames are considered.
170+
### Variable Actions
123171

124-
If a line is prefixed with a hash (`#`), it's a comment and ignored.
172+
A limited set of _variables_ can be defined (`variable=value`):
173+
174+
- `max-frames`: Sets the total number of frames to be considered for grouping. The default is `0`, which means "all frames". If set to `3`, only the top three frames are considered.
175+
176+
<!--
177+
- `category`: Sets a custom category for the frame.
178+
179+
- Custom categories overwrite [built-in categories](#built-in-categories).
180+
- If multiple category-applying rules match a frame, only the category set in the bottom-most rule is preserved.
181+
-->
182+
183+
### Example
125184

126185
```discover {tabTitle:Enhancement Rules}
127186
stack.abs_path:**/node_modules/** -group
@@ -197,7 +256,6 @@ SentrySDK.start { options in
197256
When using static frameworks, the frameworks end up in the main executable. Therefore, the SDK currently can't detect if a frame of the main executable
198257
originates from your application or a private framework and marks all of them as `inApp`. To improve your experience, use the below explained stack trace rules on the server to tell Sentry which should be marked as `not inApp`.
199258

200-
201259
#### Stack Trace Rules
202260

203261
The following marks frames from libdispatch starting with `_dispatch_` as `inApp`.
@@ -213,6 +271,7 @@ app:no +app
213271
stack.function:std::* -app
214272
stack.function:boost::* -app
215273
```
274+
216275
<Note>
217276

218277
You need to force all frames to be in-app first because there might already have been some defaults set by the client SDK or earlier processing.

src/docs/product/sentry-basics/guides/grouping-and-fingerprints/index.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Fortunately you can change the default grouping behavior to make certain issue t
3434

3535
</Note>
3636

37-
# Solutions
37+
## Solutions
3838

3939
There are three different approaches for updating how events group into issues. The first approach is for merging together historical issues already created. We'll call this **Merging Similar Issues**. The second is for setting rules so next incoming issues will get grouped together. We'll call this **Fingerprint Rules**. The third is **SDK Side Fingerprinting**. The difference between SDK side and Server side is the data elements on the exception and stack traces which you can use for matching issues.
4040

@@ -44,7 +44,7 @@ In **Fingerprint Rules** we'll see how to set rules for new incoming issues of o
4444

4545
More on **SDK Side Fingerprinting** [here](/platform-redirect/?next=/usage/sdk-fingerprinting/).
4646

47-
## Merging Similar Issues
47+
### Merging Similar Issues
4848

4949
This is for merging similar issues and will not auto merge the next occurrence of this issue coming in.
5050

@@ -59,14 +59,14 @@ You can also do this from inside a single issue. Click the Similar Issues tab
5959

6060
**Warning:** Future issues will get added to the merged set only if they match one of the stack traces in the merged set.
6161

62-
## Fingerprint Rules
62+
### Fingerprint Rules
6363

6464
Here's an overview of what we'll do using **Fingerprint Rules**
6565

6666
1. Identify the match logic for grouping issues together. We'll use either the error's **type** or **message**
6767
2. Set the match logic and its fingerprint for it, in your Project's Settings.
6868

69-
### 1. Identify Match Logic
69+
#### 1. Identify Match Logic
7070

7171
Let's say you want the following 2 issues to group together:
7272
![ConnectionTimeouts](connection-timeouts-2.png)
@@ -79,7 +79,7 @@ Or you can do it based on the **message** as in any value after the word host:
7979

8080
![ConnectionTimeoutMessage](connection-timeout-message.png)
8181

82-
### 2. Implement
82+
#### 2. Implement
8383

8484
Here's how to set the match based on the error **type**
8585

0 commit comments

Comments
 (0)