Skip to content

Commit ce0f629

Browse files
chore(docs): split contents into separate files
1 parent a3e2613 commit ce0f629

File tree

4 files changed

+104
-70
lines changed

4 files changed

+104
-70
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
---
2+
title: Filtering
3+
---
4+
5+
<Alert level="info">
6+
This document uses key words such as "MUST", "SHOULD", and "MAY" as defined in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) to indicate requirement levels.
7+
</Alert>
8+
9+
The SDK MUST implement a mechanism for users to filter out spans.
10+
The result MUST be binary (`true` or `false`).
11+
Any APIs exposed to the user to filter spans MUST adhere to the following design principles:
12+
13+
- The APIs are optimized for trace completeness
14+
- The APIs are optimized for conclusive sampling decisions
15+
16+
## Filter with `ignoreSpans`
17+
18+
The `ignoreSpans` option accepts a glob pattern or string.
19+
20+
```js
21+
Sentry.init({
22+
ignoreSpans: [
23+
'GET /about',
24+
'events.signal *',
25+
]
26+
})
27+
```
28+
29+
## Filter with `integrations`
30+
31+
The `integrations` option MAY perform in similar fashion as the `ignoreSpans` option, or make explicit opt-out possible via a boolean flag.
32+
33+
```js
34+
Sentry.init({
35+
integrations: [
36+
fsIntegration: {
37+
ignoreSpans: [
38+
'fs.read',
39+
],
40+
readSpans: true,
41+
writeSpans: false,
42+
}
43+
]
44+
})
45+
```
46+
47+
## Other approaches
48+
49+
If both options mentioned above are not feasible to be implemented in certain SDKs, other approaches MUST be explored that have the same outcome.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Sampling
3+
---
4+
5+
<Alert level="info">
6+
This document uses key words such as "MUST", "SHOULD", and "MAY" as defined in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) to indicate requirement levels.
7+
</Alert>
8+
9+
Any APIs exposed to the user to sample spans MUST adhere to the following design principles:
10+
11+
- Sampling MUST only happen to a root span
12+
- The APIs are optimized for trace completeness
13+
- The APIs are optimized for conclusive sampling decisions
14+
15+
## Sample with `tracesSampleRate`
16+
17+
The SDK is automatically initialized with a `tracesSampleRate` of `0.0`.
18+
When starting a root span, the configured rate is compared against a random number between `0.0` and `1.0` to decide if this root span will be sampled or not.
19+
20+
## Sample with `tracesSampler`
21+
22+
If the SDK is configured with a `tracesSampler`, the `tracesSampleRate` no longer applies.
23+
24+
The `tracesSampler` callback MUST receive sufficient arguments from users to define their own sampling rules.
25+
This MAY include but is not limited to certain attributes from the root span, such as HTTP headers.
26+
The return value of the `tracesSampler` is a float between `0.0` and `1.0`.
27+
28+
If no `tracesSampler` is configured, a propagated sampling decision via the traceparent takes precedence over the `tracesSampleRate`. This behavior MAY be disabled by defining a `tracesSampler`.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Scrubbing data
3+
---
4+
5+
<Alert level="info">
6+
This document uses key words such as "MUST", "SHOULD", and "MAY" as defined in [RFC 2119](https://www.ietf.org/rfc/rfc2119.txt) to indicate requirement levels.
7+
</Alert>
8+
9+
## Scrubbing data with `beforeSendSpans`
10+
11+
This callback MUST NOT allow the removal of any spans from the span tree.
12+
It receives a deep copy of all spans in the span tree and their attributes.
13+
14+
```
15+
[
16+
{
17+
'name': 'GET /',
18+
'attributes': [
19+
'http.request.method': 'GET',
20+
'http.response.status_code': 200,
21+
]
22+
},
23+
]
24+
```
25+
26+
Users MAY mutate any exposed properties to perform sanitation on sensitive data or PII.
27+
The return value of `beforeSendSpans` MUST be merged with the original span tree prior to emission.

develop-docs/sdk/telemetry/spans/span-sampling.mdx

Lines changed: 0 additions & 70 deletions
This file was deleted.

0 commit comments

Comments
 (0)