-
Notifications
You must be signed in to change notification settings - Fork 952
Description
Describe the bug
When using TraceIdRatioBasedSampler as ParentBasedSamplerBuilder's root the warning is shown. However according to spec (https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#compatibility-warnings-for-traceidratiobased-sampler) this should be allowed
Only the configuration and creation APIs are stable. It is recommended to use this sampler algorithm only for root spans (in combination with ParentBased)
Steps to reproduce
Sampler.parentBased(Sampler.traceIdRatioBased(0.5));What did you expect to see?
Nothing
What did you see instead?
Following warning:
lut 09, 2026 10:52:20 PM io.opentelemetry.sdk.trace.samplers.ParentBasedSamplerBuilder maybeLogTraceIdSamplerWarning
WARNING: TraceIdRatioBasedSampler is being used as a child sampler (root). This configuration is discouraged per the OpenTelemetry specification and may lead to unexpected sampling behavior.
What version and what artifacts are you using?
Artifacts: (e.g., opentelemetry-api, opentelemetry-sdk, which exporters, etc) opentelemetry-sdk
Version: (e.g., v0.4.0, 1eb551b, etc): 1.59.0
How did you reference these artifacts? (excerpt from your build.gradle, pom.xml, etc)
implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:2.24.0-alpha"))
Environment
Compiler: (e.g., "Temurin 17.0.7"): Corretto 25
OS: (e.g., "Ubuntu 20.04"): Windows 11
Runtime (if different from JDK above): (e.g., "Oracle JRE 8u251")
OS (if different from OS compiled on): (e.g., "Windows Server 2019")
Additional context
This check seems to be added during refactoring of warning: https://github.com/open-telemetry/opentelemetry-java/pull/7948/changes#diff-f5b51b22d75fd6b9122f6e30138f8688a744a5d168088e0f5ddb7fa4579a2f7cR23. I assume it was added incorrectly
Tip: React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.