How to setup to consider probability instead of sample flag in traceparent header for web requests #10805
Unanswered
abalabolov
asked this question in
Q&A
Replies: 2 comments
-
hi @abalabolov! I'd recommend asking in the micrometer-tracing-bridge-otel project |
Beta Was this translation helpful? Give feedback.
0 replies
-
Created micrometer-metrics/tracing#626 I didn't find |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Issue: Overwhelm an application with tracing overhead
https://www.w3.org/TR/trace-context-1/#denial-of-service
Env: Spring Boot 3.2.3, micrometer-tracing-bridge-otel + opentelemetry-exporter-zipkin
System: We have desktop, web client and monolitic server (for now) behind AWS ALB with autoscaling.
What I would like to achive:
trace and span id
from anyWeb client
and take them into account on theBE
side for other internal purposes.BE
side taking into account specifiedprobability
on the BE side andSampleFlag
header from theWeb client
side. I.e. to follow this https://www.w3.org/TR/trace-context-1/#trace-flagsI set
tracing.sampling.probability: 0.1
and addedAspect
(for testing purpose) that wraps several packages with the following code:During startup I see that OTel creates
TraceIdRatioBasedSampler
and wraps it inParentBasedSampler
When I specify
traceparent header with sample flag = 01
, I face with the following:PropagatingReceiverTracingObservationHandler.onStart()
that usesparentTraceContext with
PropagatedSpanwith
traceFlags=01`.SpanBuilder.startSpan()
hastracerSharedState
withParentBasedSampler
and callsshouldSample()
on behalf ofParentBasedSampler
that checks traceFlags fromPropagatedSpan
. So, it is moreSampleFlagBased
ratherparentBased
PropagatedSpan.traceFlags
= 01 so the decision isRECORD_AND_SAMPLE
every timetraceparent header with sample flag = 00
, then the result isDROP
every time.probability
doesn't make an effect. Even I set it to 0 or 0.0, all spans still appear in ZipkinI think this behavior was implemented for comminication between isolated microservices.
So, my questions:
probability
work with default out of the box settingsprobability
instead ofSampledFlag
I am loking for the right way to resolve them and think about one of the following:
Root OTel Sampler
with onlytraceIdRatioBased
sampler. Trusting the following convention: ifSpan
is considered to beSampled
, other calls to checkshouldSample
with the same params will return the same result. I have checked, this works as I described above.ParentBasedSampler
: remoteParentSampled(Sampler), localParentSampled(Sampler) to TraceIdRatioBasedSampler. Based on the "running the sampler on any child Span will produce the same decision"OncePerRequest
filter and replaceSampleFlag
01 to 00 if request is not from some "White list" that is loaded at startup to the memory.W3CTraceContextPropagator
and the same propagators: check if the header is allowed from the caller see option 4).There is a topic that has the similar question but the answer is absent.
open-telemetry/opentelemetry-dotnet#3594
Beta Was this translation helpful? Give feedback.
All reactions