Skip to content

Commit 7fa4942

Browse files
committed
improve language around explaining how policies are evaluated
1 parent 78f4ffb commit 7fa4942

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

solutions/observability/apm/transaction-sampling.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ Trace events are matched to policies in the order specified. Each policy list mu
272272
Note that from version `9.0.0` APM Server has an unlimited storage limit, but will stop writing when the disk where the database resides reaches 80% usage. Due to how the limit is calculated and enforced, the actual disk space may still grow slightly over this disk usage based limit, or any configured storage limit.
273273
::::
274274

275-
### Example configuration A [_example_configuration_a]
275+
### Example configuration 1 [_example_configuration_1]
276276

277277
This example defines three tail-based sampling polices:
278278

@@ -290,9 +290,9 @@ This example defines three tail-based sampling polices:
290290
2. Samples 1% of traces in `production` with the trace name `"GET /not_important_route"`
291291
3. Default policy to sample all remaining traces at 10%, e.g. traces in a different environment, like `dev`, or traces with any other name
292292

293-
### Example configuration B [_example_configuration_b]
293+
### Example configuration 2 [_example_configuration_2]
294294

295-
When a trace originates in Service A and then calls Service B (without errors), the sampling rate is determined by the service where the trace starts:
295+
When a trace originates in Service A and then calls Service B, the sampling rate is determined by the service where the trace starts:
296296

297297
```yaml
298298
- sample_rate: 0.3
@@ -302,22 +302,22 @@ When a trace originates in Service A and then calls Service B (without errors),
302302
- sample_rate: 1.0 # Fallback: always set a default
303303
```
304304

305-
- Because Service A is the root of the trace, its policy (0.5) takes precedence over Service B's policy (0.3).
305+
- Because Service A is the root of the trace, its policy (0.5) is applied while Service B's policy (0.3) is ignored.
306306
- If instead the trace began in Service B (and then passed to Service A), the policy for Service B would apply.
307307

308-
> **Key point**: Tail‑based sampling rules are evaluated at the *trace level* based on where the trace was initiated, not on downstream spans (*service level*).
308+
> **Key point**: Tail‑based sampling rules are evaluated at the *trace level* based on which service initiated the distributed trace, not the service of the transaction or span.
309309

310-
### Example configuration C [_example_configuration_c]
310+
### Example configuration 3 [_example_configuration_3]
311311

312-
When you need to combine service‑specific policies with outcomes (e.g. failures), policy order defines specificity:
312+
Policies are evaluated **in order** and applies the first one whose match conditions are all met. That means, in practice, order policies from most specific (narrow matchers) to most general, ending with a catch-all (fallback).
313313

314314
```yaml
315315
# Example A: prioritize service origin, then failures
316316
- sample_rate: 0.2
317317
service.name: A
318318
- sample_rate: 0.5
319319
trace.outcome: failure
320-
- sample_rate: 1.0 # Default
320+
- sample_rate: 1.0 # catch-all
321321
322322
# Example B: prioritize failures, then a specific service
323323
- sample_rate: 0.2
@@ -330,10 +330,6 @@ When you need to combine service‑specific policies with outcomes (e.g. failure
330330
- In Example A, traces from Service A are sampled at 20%, and all other failed traces (regardless of service) are sampled at 50%.
331331
- In Example B, every failed trace is sampled at 20%, including those originating from Service A.
332332

333-
Policies targeting the trace (e.g. `trace.outcome: failure`) apply across all services and should appear before more specific, service‑level rules if you want them to take precedence.
334-
335-
> **Key point**: Define failure policy at the top to ensure capturing all failed traces, then define more specific policies for specific services to capture edge cases.
336-
337333
### Configuration reference [_configuration_reference]
338334

339335
#### Top-level tail-based sampling settings [_top_level_tail_based_sampling_settings]

0 commit comments

Comments
 (0)