Skip to content

Commit a349edd

Browse files
authored
ref(grouping): Small tweaks to fingerprint rules doc (#14176)
This is a small cleanup of the fingerprinting rules docs, pulled out of an upcoming PR in order to make it easier to review. - Update GH link to fingerprinting grammar. - Alphabetize non-utility fingerprinting variables. - Add introductory sentence identifying utility matchers.
1 parent ea17942 commit a349edd

File tree

1 file changed

+62
-60
lines changed

1 file changed

+62
-60
lines changed

docs/concepts/data-management/event-grouping/fingerprint-rules.mdx

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ description: "Learn about fingerprint rules, matchers for fingerprinting, how to
66

77
<Include name="only-error-issues-note.mdx" />
88

9-
Fingerprint rules (previously known as _server-side fingerprinting_) are also configured with a config similar to [stack trace rules](../stack-trace-rules/), but the syntax is slightly different. The matchers are the same, but instead of flipping flags, a fingerprint is assigned and it overrides the default grouping entirely. Assigning a fingerprint can also refine the default grouping rather than overriding it, if the fingerprint includes the value `{{ default }}`.
9+
Fingerprint rules (previously known as _server-side fingerprinting_) are configured with a config similar to [stack trace rules](../stack-trace-rules/), but the syntax is slightly different. The matchers are the same, but instead of flipping flags, a fingerprint is assigned and it overrides the default grouping entirely. Assigning a fingerprint can also refine the default grouping rather than overriding it, if the fingerprint includes the value `{{ default }}`.
1010

1111
These rules can be configured on a per-project basis in **[Project] > Settings > Issue Grouping > Fingerprint Rules**. This setting has input fields where you can write custom fingerprinting rules. To update a rule:
1212

1313
1. Identify the match logic for grouping issues together.
1414
1. Set the match logic and the fingerprint for it.
1515

16-
The syntax for fingerprint rules is similar to syntax in [**Discover** queries](/concepts/search/#syntax). To negate a match, add an exclamation mark (`!`) at the beginning of the expression. See the full grammar [here](https://github.com/getsentry/sentry/blob/c5b84a393365a833348dd7fd9378d34c353ca6ca/src/sentry/grouping/fingerprinting.py#L17-L55).
16+
The syntax for fingerprint rules is similar to syntax in [**Discover** queries](/concepts/search/#syntax). To negate a match, add an exclamation mark (`!`) at the beginning of the expression. See the full grammar [here](https://github.com/getsentry/sentry/blob/90f5cdfa9ebaf0bfdea63852812a6efc90f13691/src/sentry/grouping/fingerprinting/__init__.py#L36-L73).
1717

1818
Sentry attempts to match against all values that are configured in the fingerprint. In the case of stack traces, all frames are considered. If the event data matches all the values in a line for a matcher and expression, then the fingerprint is applied. When there are multiple rules that match the event, the first matching rule in the list is applied.
1919

@@ -67,12 +67,12 @@ error.value:"connection error (code: *)" -> connection-error
6767
error.value:"could not connect (*)" -> connection-error
6868
```
6969

70-
### `message`
70+
### `level`
7171

72-
Matches on a log message. It will also automatically check for the additional exception value as they can be hard to keep apart. The matching is case insensitive.
72+
Matches on the log level. The match is case insensitive.
7373

7474
```bash {tabTitle:Fingerprinting Config}
75-
message:"system encountered a fatal problem: *" -> fatal-log
75+
logger:"com.myapp.FooLogger" level:"error" -> mylogger-error
7676
```
7777

7878
### `logger`
@@ -83,20 +83,12 @@ Matches on the name of the logger, which is useful to combine all messages of a
8383
logger:"com.myapp.mypackage.*" -> mypackage-logger
8484
```
8585

86-
### `level`
87-
88-
Matches on the log level. The match is case insensitive.
89-
90-
```bash {tabTitle:Fingerprinting Config}
91-
logger:"com.myapp.FooLogger" level:"error" -> mylogger-error
92-
```
93-
94-
### `tags.tag_name`
86+
### `message`
9587

96-
Matches on the value of the tag `tag_name`. This can be useful to filter down certain types of events. For instance, you can separate events caused by a specific server:
88+
Matches on a log message. It will also automatically check for the additional exception value as they can be hard to keep apart. The matching is case insensitive.
9789

9890
```bash {tabTitle:Fingerprinting Config}
99-
tags.server_name:"canary-*.mycompany.internal" -> canary-events
91+
message:"system encountered a fatal problem: *" -> fatal-log
10092
```
10193

10294
### `stack.abs_path`
@@ -109,24 +101,24 @@ Matches on the path of an event and is case insensitive. It uses path globbing s
109101
stack.abs_path:"**/my-utils/*.js" -> my-utils, {{ error.type }}
110102
```
111103

112-
### `stack.module`
104+
### `stack.function`
113105

114-
alias: `module`
106+
alias: `function`
115107

116-
Similar to `stack.abs_path` but matches on the module name instead. The match is case-sensitive and regular globbing rules apply (`*` also matches slashes).
108+
Checks if any of the functions in the stack trace match the glob. The match is case-sensitive:
117109

118110
```bash {tabTitle:Fingerprinting Config}
119-
stack.module:"*/my-utils/*" -> my-utils, {{ error.type }}
111+
stack.function:"my_assertion_failed" -> my-assertion-failed
120112
```
121113

122-
### `stack.function`
114+
### `stack.module`
123115

124-
alias: `function`
116+
alias: `module`
125117

126-
Checks if any of the functions in the stack trace match the glob. The match is case-sensitive:
118+
Similar to `stack.abs_path` but matches on the module name instead. The match is case-sensitive and regular globbing rules apply (`*` also matches slashes).
127119

128120
```bash {tabTitle:Fingerprinting Config}
129-
stack.function:"my_assertion_failed" -> my-assertion-failed
121+
stack.module:"*/my-utils/*" -> my-utils, {{ error.type }}
130122
```
131123

132124
### `stack.package`
@@ -140,14 +132,16 @@ stack.package:"**/libcurl.dylib" -> libcurl
140132
stack.package:"**/libcurl.so" -> libcurl
141133
```
142134

143-
### `family`
135+
### `tags.tag_name`
144136

145-
Used to "scope" down the matcher. The following families exist: `javascript` for any type of JavaScript event, `native` for any type of Native event. Any other platform is called `other`.
137+
Matches on the value of the tag `tag_name`. This can be useful to filter down certain types of events. For instance, you can separate events caused by a specific server:
146138

147139
```bash {tabTitle:Fingerprinting Config}
148-
family:native !stack.module:"myproject::*" -> not-from-my-project
140+
tags.server_name:"canary-*.mycompany.internal" -> canary-events
149141
```
150142

143+
Additionally, the folowing utility matchers are available:
144+
151145
### `app`
152146

153147
Checks if the frame is in-app or not. It is particularly useful when combined with another matcher. Possible values are `yes` and `no`:
@@ -156,6 +150,14 @@ Checks if the frame is in-app or not. It is particularly useful when combined wi
156150
app:yes stack.function:"assert" -> assert
157151
```
158152

153+
### `family`
154+
155+
Used to "scope" down the matcher. The following families exist: `javascript` for any type of JavaScript event, `native` for any type of Native event. Any other platform is called `other`.
156+
157+
```bash {tabTitle:Fingerprinting Config}
158+
family:native !stack.module:"myproject::*" -> not-from-my-project
159+
```
160+
159161
</DefinitionList>
160162

161163
## Combining Matchers
@@ -186,14 +188,6 @@ This fills in the default fingerprint that would be produced by the normal group
186188
stack.function:"query_database" -> {{ default }}, {{ transaction }}
187189
```
188190

189-
### `{{ transaction }}`
190-
191-
This fills in the name of the transaction into the fingerprint. It will force the creation of a group per transaction:
192-
193-
```bash {tabTitle:Fingerprinting Config}
194-
error.type:"ApiError" -> api-error, {{ transaction }}
195-
```
196-
197191
### `{{ error.type }}`
198192

199193
alias: `{{ type }}`
@@ -214,14 +208,30 @@ This fills in the stringified value of the error that occurred. When chained exc
214208
error.type:"ScriptError" -> script-evaluation, {{ error.value }}
215209
```
216210

217-
### `{{ stack.function }}`
211+
### `{{ level }}`
218212

219-
alias: `{{ function }}`
213+
This fills in the name of the log level that was used to create an event.
220214

221-
This fills in the function name of the "crashing frame," also known as the application code's topmost frame.
215+
```bash {tabTitle:Fingerprinting Config}
216+
message:"connection error*" -> connection-error, {{ logger }}, {{ level }}
217+
```
218+
219+
### `{{ logger }}`
220+
221+
This fills in the name of the logger that caused an event.
222222

223223
```bash {tabTitle:Fingerprinting Config}
224-
error.type:"ScriptError" -> script-evaluation, {{ stack.function }}
224+
message:"critical connection error*" -> connection-error, {{ logger }}
225+
```
226+
227+
### `{{ message }}`
228+
229+
This fills in the message of the event (similar to `error.value` but for
230+
captured messages). Note that this can produce groups with poor data quality if
231+
messages are changing frequently:
232+
233+
```bash {tabTitle:Fingerprinting Config}
234+
logger:"com.foo.auditlogger.*" -> audit-log, {{ message }}
225235
```
226236

227237
### `{{ stack.abs_path }}`
@@ -242,6 +252,16 @@ This is like `stack.abs_path` but will only fill in the relative file name:
242252
error.type:"ScriptError" -> script-evaluation, {{ stack.filename }}
243253
```
244254

255+
### `{{ stack.function }}`
256+
257+
alias: `{{ function }}`
258+
259+
This fills in the function name of the "crashing frame," also known as the application code's topmost frame.
260+
261+
```bash {tabTitle:Fingerprinting Config}
262+
error.type:"ScriptError" -> script-evaluation, {{ stack.function }}
263+
```
264+
245265
### `{{ stack.module }}`
246266

247267
alias: `{{ module }}`
@@ -262,22 +282,6 @@ This fills in the package name (object file) of the "crashing frame," also known
262282
stack.function:"assert" -> assertion, {{ stack.package }}
263283
```
264284

265-
### `{{ logger }}`
266-
267-
This fills in the name of the logger that caused an event.
268-
269-
```bash {tabTitle:Fingerprinting Config}
270-
message:"critical connection error*" -> connection-error, {{ logger }}
271-
```
272-
273-
### `{{ level }}`
274-
275-
This fills in the name of the log level that was used to create an event.
276-
277-
```bash {tabTitle:Fingerprinting Config}
278-
message:"connection error*" -> connection-error, {{ logger }}, {{ level }}
279-
```
280-
281285
### `{{ tags.tag_name }}`
282286

283287
This fills in the value of a tag into the fingerprint, which can, for instance, be used to split events by server name or something similar.
@@ -286,14 +290,12 @@ This fills in the value of a tag into the fingerprint, which can, for instance,
286290
message:"connection error*" -> connection-error, {{ tags.server_name }}
287291
```
288292

289-
### `{{ message }}`
293+
### `{{ transaction }}`
290294

291-
This fills in the message of the event (similar to `error.value` but for
292-
captured messages). Note that this can produce groups with poor data quality if
293-
messages are changing frequently:
295+
This fills in the name of the transaction into the fingerprint. It will force the creation of a group per transaction:
294296

295297
```bash {tabTitle:Fingerprinting Config}
296-
logger:"com.foo.auditlogger.*" -> audit-log, {{ message }}
298+
error.type:"ApiError" -> api-error, {{ transaction }}
297299
```
298300

299301
</DefinitionList>

0 commit comments

Comments
 (0)