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/application/dynamic-sampling/architecture.mdx
+9-10Lines changed: 9 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -63,21 +63,20 @@ On the Sentry side, the configuration will be computed in case of a cache miss a
63
63
A sampling decision involves:
64
64
65
65
1. Matching the incoming event and/or DSC against the configuration.
66
-
2. Deriving a sample rate from the mix of `factor` and `sampleRate` rules.
67
-
3. Making the sampling decision with a random number generator.
66
+
2. Deriving a sample rate from the combination of `factor` and `sampleRate` rules.
67
+
3. Making the sampling decision using a random number generator.
68
68
69
-
_In case no match is found, or there are problems during matching, Relay will accept the event under the assumption that we prefer to oversample rather than drop events._
69
+
In case no match is found, or if there are problems during matching, Relay will accept the event under the assumption that it's preferable to oversample rather than drop potentially important events.
70
70
71
-
Relay samples with two [SamplingConfig](https://getsentry.github.io/relay/relay_sampling/config/struct.SamplingConfig.html) instances, namely**non-root sampling configuration** and **root sampling configuration**. The non-root config is the config of the project to which the incoming event belongs, whereas the root config is the config of the project to which the head transaction of the trace belongs. _In case no root sampling configuration is available, only transaction sampling will be performed._
71
+
Relay samples using two [SamplingConfig](https://getsentry.github.io/relay/relay_sampling/config/struct.SamplingConfig.html) instances: the**non-root sampling configuration** and the **root sampling configuration**. The non-root config belongs to the project of the incoming event, while the root config belongs to the project of the head transaction of the trace. If no root sampling configuration is available, only transaction sampling will be performed.
72
72
73
-
Once both configurations are fetched, Relay will **compute a merged configuration** (following the algorithm defined [here](https://getsentry.github.io/relay/relay_sampling/fn.merge_rules_from_configs.html)) consisting of all the transaction rules of the non-root project, **concatenated** to all the trace rules of the root project. This will result in a single configuration containing all the rules that Relay is going to try and match (**from top to bottom**). _The order of the rules of the same type is important, as it will influence the sampling decision._
73
+
With both configurations ready, Relay will attempt to match the transaction rules of the non-root config and then the trace rules of the root config. If both root and non-root configs are the same, Relay will perform the matching in the same manner.
74
74
75
-
With the merged configurations, Relay is ready to match the rules. During matching, Relay will inspect two payloads:
75
+
The payloads inspected for matching vary based on the type of rule being matched:
76
+
-`transaction`: a transaction rule will match against the [Event](https://getsentry.github.io/relay/relay_event_schema/protocol/struct.Event.html) payload itself.
77
+
-`trace`: a trace rule will match against the [Dynamic Sampling Context](https://getsentry.github.io/relay/relay_sampling/dsc/struct.DynamicSamplingContext.html), which remains consistent across all transactions of the trace.
76
78
77
-
-[Event](https://getsentry.github.io/relay/relay_general/protocol/struct.Event.html): inspected when the non-root project to has at least one transaction sampling rule.
78
-
-[Dynamic Sampling Context (DSC)](https://getsentry.github.io/relay/relay_sampling/dsc/struct.DynamicSamplingContext.html): inspected when the root project (the project of the head of the trace) has at least one trace sampling rule.
79
-
80
-
The matching that Relay will perform is going to be based on the `samplingValue` of the rules encountered. As specified in the section above, based on the type of `samplingValue`, we will either immediately return or continue matching other rules. More details about the matching algorithm can be found in the implementation [here](https://getsentry.github.io/relay/relay_sampling/struct.SamplingMatch.html#method.match_against_rules).
79
+
The matching that Relay performs is based on the `samplingValue` of the encountered rules. As specified earlier, depending on the type of `samplingValue`, Relay will either immediately return a result or continue matching other rules. More details about the matching algorithm can be found in the implementation [here](https://getsentry.github.io/relay/relay_sampling/evaluation/struct.SamplingEvaluator.html#method.match_rules).
0 commit comments