Skip to content

Commit

Permalink
Updated transport action sampler
Browse files Browse the repository at this point in the history
Signed-off-by: Dev Agarwal <[email protected]>
  • Loading branch information
devagarwal1803 committed Feb 7, 2024
1 parent 81f4f97 commit afe700c
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.opentelemetry.context.Context;
import io.opentelemetry.sdk.trace.data.LinkData;
import io.opentelemetry.sdk.trace.samplers.Sampler;
import io.opentelemetry.sdk.trace.samplers.SamplingDecision;
import io.opentelemetry.sdk.trace.samplers.SamplingResult;

import static org.opensearch.telemetry.tracing.AttributeNames.TRANSPORT_ACTION;
Expand Down Expand Up @@ -71,7 +72,11 @@ public SamplingResult shouldSample(
) {
final String action = attributes.get(AttributeKey.stringKey(TRANSPORT_ACTION));
if (action != null) {
return actionSampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
final SamplingResult result = actionSampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
if (result.getDecision() != SamplingDecision.DROP && fallbackSampler != null) {
return fallbackSampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
}
return result;
}
if (fallbackSampler != null) return fallbackSampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);

Expand Down

0 comments on commit afe700c

Please sign in to comment.