From 105e50c9d550c16bf9b183cef087668cd2440a94 Mon Sep 17 00:00:00 2001 From: Otmar Ertl Date: Mon, 25 Sep 2023 20:39:00 +0200 Subject: [PATCH] improved java doc, explicit passing of invalid p-value to root sampler (#1053) --- .../sampler/consistent/ConsistentParentBasedSampler.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ConsistentParentBasedSampler.java b/consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ConsistentParentBasedSampler.java index 94d70b187..0a3c93c28 100644 --- a/consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ConsistentParentBasedSampler.java +++ b/consistent-sampling/src/main/java/io/opentelemetry/contrib/sampler/consistent/ConsistentParentBasedSampler.java @@ -10,9 +10,8 @@ import javax.annotation.concurrent.Immutable; /** - * A consistent sampler that makes the same sampling decision as the parent and optionally falls - * back to an alternative consistent sampler, if the parent p-value is invalid (like for root - * spans). + * A consistent sampler that makes the same sampling decision as the parent. For root spans, the + * sampling decision is delegated to the root sampler. */ @Immutable final class ConsistentParentBasedSampler extends ConsistentSampler { @@ -38,7 +37,7 @@ final class ConsistentParentBasedSampler extends ConsistentSampler { @Override protected int getP(int parentP, boolean isRoot) { if (isRoot) { - return rootSampler.getP(parentP, isRoot); + return rootSampler.getP(OtelTraceState.getInvalidP(), isRoot); } else { return parentP; }