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/traces/dynamic-sampling-context.mdx
+6-5Lines changed: 6 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,20 +49,20 @@ To align DSC propagation over all our SDKs, we defined a [unified propagation me
49
49
All of the attributes in the table below are required (non-optional) in a sense, that when they are known to an SDK at the time an envelope with an event (transaction or error) is sent to Sentry, or at the time a baggage header is propagated, they must also be included in said envelope or baggage.
50
50
51
51
At the moment, only `release`, `environment` and `transaction` are used by the product for dynamic sampling functionality.
52
-
The rest of the context attributes, `trace_id`, `public_key`, `sampled` and `sample_rate`, are used by Relay for internal decisions (like transaction sample rate smoothing).
52
+
The rest of the context attributes, `trace_id`, `public_key`, `sampled` and `sample_rate`, are used by Relay for internal decisions and for extrapolation in the product.
53
53
Additional entries such as `replay_id`, `org` and `sample_rand` are only using the DSC as a means of transport.
54
54
55
55
| Attribute | Type | Description | Example | Required Level |
|`trace_id`| string | The original trace ID as generated by the SDK. This must match the trace id of the submitted transaction item. [1]|`771a43a4192642f0b136d5159a501700`| strictly required [0]|
58
58
|`public_key`| string | Public key from the DSN used by the SDK. [2]|`49d0f7386ad645858ae85020e393bef3`| strictly required [0]|
59
-
|`sample_rate`| string | The sample rate as defined by the user on the SDK. [3]|`0.7`| strictly required [0]|
60
-
|`sampled`| string |`"true"` if the trace is sampled, `"false"` otherwise. This is set by the head of the trace. |`true`| required |
59
+
|`sample_rate`| string | The sample rate as defined by the user on the SDK. [3][4]|`0.7`| strictly required [0]|
60
+
|`sample_rand`| string | A truly random number originating from the head of trace SDK. [4]|`0.5`| required |
61
+
|`sampled`| string |`"true"` if the trace is sampled, `"false"` otherwise. This is set by the head of the trace. [4]|`true`| required |
61
62
|`release`| string | The release name as specified in client options. |`[email protected]`, `1.2.3`, `2025.4.107`| required |
62
63
|`environment`| string | The environment name as specified in client options. |`production`, `staging`| required |
63
64
|`transaction`| string | The transaction name set on the scope. **Only include** if name has [good quality](#note-on-good-quality-transaction-names). |`/login`, `myApp.myController.login`| required (if known and good quality) |
64
65
|`org`| string | The org ID parsed from the DSN or received by a downstream SDK. |`1`| required |
65
-
|`sample_rand`| string | A truly random number originating from the head of trace SDK. |`0.5`| required |
66
66
|`user_segment`[DEPRECATED]| string | User segment as set by the user with `scope.set_user()`. || deprecated |
67
67
68
68
0: In any case, `trace_id`, `public_key`, and `sample_rate` should always be known to an SDK, so these values are strictly required.
@@ -73,6 +73,8 @@ Additional entries such as `replay_id`, `org` and `sample_rand` are only using t
73
73
74
74
3: This string should always be a number between (and including) 0 and 1 in a notation that is supported by the [JSON specification](https://www.json.org/json-en.html). If a `tracesSampler` callback was used for the sampling decision, its result should be used for `sample_rate` instead of the `tracesSampleRate` from `SentryOptions`. In case `tracesSampler` returns `True` it should be sent as `1.0`, `False` should be sent as `0.0`.
75
75
76
+
4: These attributes must conform to the invariant `sample_rand < sample_rate <=> sampled`.
77
+
76
78
<Alertlevel="warning">
77
79
78
80
### Note on good-quality transaction names
@@ -279,5 +281,4 @@ TODO - Add some sort of Q&A section on the following questions, after evaluating
279
281
- Why must baggage be immutable before the second transaction has been started?
280
282
- What are the consequences and impacts of the immutability of baggage on Dynamic Sampling UX?
281
283
- Why can't we just make the decision for the whole trace in Relay after the trace is complete?
282
-
- What is sample rate smoothing and how does it use `sample_rate` from the Dynamic Sampling Context?
283
284
- What are the differences between Dynamic Sampling on traces vs. transactions?
0 commit comments