~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
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.