Opentelemetry-java: Probability sampler only respects positive parent decision

Created on 15 May 2020  路  3Comments  路  Source: open-telemetry/opentelemetry-java

~According to the spec, the probability sampler's "default behavior should be to trust the parent SampledFlag"~ (EDIT: See https://github.com/open-telemetry/opentelemetry-java/issues/1225#issuecomment-668224260). However, in Java, the decision is only respected if sampled=true. If sampled=false, the trace is potentially restarted with the sampler's probability. IMHO, notwithstanding any spec-conformance, this behavior is very weird and surprising.

The responsible condition is this:
https://github.com/open-telemetry/opentelemetry-java/blob/d7f6d5a64176b44752bbd4bd403716a0f150b3e6/sdk/src/main/java/io/opentelemetry/sdk/trace/Samplers.java#L195

Bug help wanted p2 required-for-ga

All 3 comments

Also, I just noticed that the probability is not attached in the cases where a parent decision is honored. Is this intended?

Also, I just noticed that the probability is not attached in the cases where a parent decision is honored. Is this intended?

It was intentional, yes. I'm honestly not 100% sure which way it should go. My thought process was: if we didn't use the probability in making the decision, then don't put it into the "decision" attributes.

Since https://github.com/open-telemetry/opentelemetry-specification/pull/704 this should be very simple to solve: Just remove any parent (and link!)-dependent code from the probability sampler.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bogdandrutu picture bogdandrutu  路  5Comments

jkwatson picture jkwatson  路  3Comments

pavolloffay picture pavolloffay  路  5Comments

poogurgaon picture poogurgaon  路  4Comments

thisthat picture thisthat  路  5Comments