Package io.opentelemetry.contrib.awsxray
Class AlwaysRecordSampler
java.lang.Object
io.opentelemetry.contrib.awsxray.AlwaysRecordSampler
- All Implemented Interfaces:
io.opentelemetry.sdk.trace.samplers.Sampler
@Immutable
public final class AlwaysRecordSampler
extends Object
implements io.opentelemetry.sdk.trace.samplers.Sampler
This sampler will return the sampling result of the provided
rootSampler, unless the
sampling result contains the sampling decision SamplingDecision.DROP, in which case, a
new sampling result will be returned that is functionally equivalent to the original, except that
it contains the sampling decision SamplingDecision.RECORD_ONLY. This ensures that all
spans are recorded, with no change to sampling.
The intended use case of this sampler is to provide a means of sending all spans to a processor without having an impact on the sampling rate. This may be desirable if a user wishes to count or otherwise measure all spans produced in a service, without incurring the cost of 100% sampling.
-
Method Summary
Modifier and TypeMethodDescriptionstatic AlwaysRecordSamplercreate(io.opentelemetry.sdk.trace.samplers.Sampler rootSampler) io.opentelemetry.sdk.trace.samplers.SamplingResultshouldSample(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks)
-
Method Details
-
create
-
shouldSample
public io.opentelemetry.sdk.trace.samplers.SamplingResult shouldSample(io.opentelemetry.context.Context parentContext, String traceId, String name, io.opentelemetry.api.trace.SpanKind spanKind, io.opentelemetry.api.common.Attributes attributes, List<io.opentelemetry.sdk.trace.data.LinkData> parentLinks) - Specified by:
shouldSamplein interfaceio.opentelemetry.sdk.trace.samplers.Sampler
-
getDescription
- Specified by:
getDescriptionin interfaceio.opentelemetry.sdk.trace.samplers.Sampler
-