You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop-docs/sdk/telemetry/spans/filtering.mdx
+41-15Lines changed: 41 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,48 +19,74 @@ Any APIs exposed to the user to filter spans MUST adhere to the following design
19
19
20
20
## Filter with `ignoreSpans`
21
21
22
-
The `ignoreSpans` option MUST accept a string, RegExp or glob pattern (whichever of the two the platform supports). Furthermore, it SHOULD accept an Object with the patterns matching at least one of or both, the span name and op.
22
+
The `ignoreSpans` option MUST accept a string, RegExp or glob pattern (whichever of the two the platform supports). These values MUST be matched against the span name.
23
+
24
+
Furthermore, `ignoreSpans` SHOULD accept an Object with patterns matching the span name, or span attributes (see type definitions below).
(Note: `GlobPattern` is used as an illustrative type. It is not a valid TypeScript type.)
43
+
(Note: `GlobPattern` is used as an illustrative type for platforms that support matching glob patterns. It is not a valid TypeScript type.)
38
44
39
45
Example:
40
46
41
47
```js
42
48
Sentry.init({
43
49
ignoreSpans: [
50
+
// apply on span name
44
51
'GET /about',
45
52
'events.signal *',
46
53
/api\/\d+/,
54
+
// ignore health check GET requests with 200 status code
55
+
{
56
+
name: /healthz?/,
57
+
attributes: {
58
+
'http.method':'GET',
59
+
'http.status_code':200,
60
+
}
61
+
},
62
+
// ignore all GET requests to /api/ with 200 status code
63
+
// (i.e. span name doesn't matter)
47
64
{
48
-
op:'fs.read',
65
+
attributes: {
66
+
'http.method': /GET \/api\/.*/,
67
+
'http.status_code':200,
68
+
}
49
69
},
70
+
// ignore all spans with name starting with /imprint-
71
+
// if glob patterns are supported
50
72
{
51
-
name: /healthz?/,
52
-
op:'http.client',
73
+
name:'/imprint-*'
53
74
}
54
75
]
55
76
})
56
77
```
57
-
(Note: The glob pattern serves an illustrative purpose. It is not supported in JavaScript.)
78
+
(Note: The glob patterns used in the example serve an illustrative purpose. They are not supported in JavaScript.)
58
79
59
80
### Implementation Requirements
60
81
61
-
The `ignoreSpans` patterns MUST be applied to all spans, including the root or segment span.
62
-
- If a pattern matches the root span, the span and all its children MUST be ignored.
63
-
- If a pattern matches a child span, the span MUST be ignored but any potential child spans MUST be attempted to be reparented to the parent span of the ignored span.
82
+
1. The `ignoreSpans` patterns MUST be applied to all spans, including the root or segment span.
83
+
- If a pattern matches the root span, the span and all its children MUST be ignored.
84
+
- If a pattern matches a child span, the span MUST be ignored but any potential child spans MUST be attempted to be reparented to the parent span of the ignored span.
85
+
86
+
2. If SDKs accept `IgnoreSpanFilter` objects, attributes MUST be matched by value. This also applies to attributes with array values.
87
+
- String attribute values are matched in the same fashion as span names: If a string is provided, the string MUST match (contains), if a `RegExp` or glob pattern is provided, the value MUST match the pattern.
88
+
- Any other attribute value type MUST strictly equal the provided value.
0 commit comments