Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit c8b500a

Browse files
committed
Add sampling examples.
1 parent 10ad05d commit c8b500a

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

text/trace/0247-peer-service-propagation.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ become unreliable, making it eventually obsolete.
1313

1414
This information can be effectively derived in the backend using the
1515
`Resource` of the parent `Span`, but is otherwise not available
16-
at Collector processing time, where it could be used for sampling
17-
and tranformation purposes.
16+
at Collector processing time, where it could be used for transformation
17+
purposes or sampling (e.g. adaptive sampling based on the calling service).
1818

1919
As metrics and logs do not have defined a parent-child relationship, using
2020
`peer.service` could help gaining insight into the remote service as well.
@@ -83,6 +83,20 @@ With `peer.service` present in server spans, further processing, filtering and s
8383
then be accomplished in the Collector, e.g. a preview of the dependency map of a service,
8484
similar in spirit to zPages could be created.
8585

86+
### Sampling scenarios
87+
88+
A specially interesting case is sampling depending on the calling service, specifically:
89+
90+
* An adaptive sampler may decide to sample or not based on the calling service, e.g.
91+
given Service A amounting to 98% of requests, and Service B amounting to 2% only,
92+
more traces could be sampled for the latter.
93+
* In cases where a parent `Span ` is **not** sampled **but** its child (or linked-to `Span`)
94+
wants to sample, knowing the calling service **may** help with the sampling decision.
95+
* In deployment scenarios where context is properly propagated through all the services,
96+
but not all of them are actually traced, it would be helpful to know what services
97+
were part of the request, even if no traces/spans exist for them, see
98+
https://github.com/w3c/trace-context/issues/550 as an example.
99+
86100
## Trade-offs and mitigations
87101

88102
Given the `TraceState` [lenght contrains](https://www.w3.org/TR/trace-context/#tracestate-header)

0 commit comments

Comments
 (0)