Class ParentBasedSampler
java.lang.Object
io.opentelemetry.sdk.trace.samplers.ParentBasedSampler
- All Implemented Interfaces:
Sampler
A Sampler that uses the sampled flag of the parent Span, if present. If the span has no parent,
this Sampler will use the "root" sampler that it is built with. See documentation on the
ParentBasedSamplerBuilder methods for the details on the various configurable options.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the description of thisSampler.inthashCode()shouldSample(Context parentContext, String traceId, String name, SpanKind spanKind, Attributes attributes, List<LinkData> parentLinks) Called duringSpancreation to make a sampling samplingResult.toString()
-
Field Details
-
root
-
remoteParentSampled
-
remoteParentNotSampled
-
localParentSampled
-
localParentNotSampled
-
-
Constructor Details
-
ParentBasedSampler
-
-
Method Details
-
shouldSample
public SamplingResult shouldSample(Context parentContext, String traceId, String name, SpanKind spanKind, Attributes attributes, List<LinkData> parentLinks) Description copied from interface:SamplerCalled duringSpancreation to make a sampling samplingResult.- Specified by:
shouldSamplein interfaceSampler- Parameters:
parentContext- the parent span'sSpanContext. This can beSpanContext.INVALIDif this is a root span.traceId- theTraceIdfor the newSpan. This will be identical to that in the parentContext, unless this is a root span.name- the name of the newSpan.spanKind- theSpanKindof theSpan.attributes-Attributesassociated with the span.parentLinks- the parentLinks associated with the newSpan.- Returns:
- sampling samplingResult whether span should be sampled or not.
-
getDescription
Description copied from interface:SamplerReturns the description of thisSampler. This may be displayed on debug pages or in the logs.Example: "TraceIdRatioBased{0.000100}"
- Specified by:
getDescriptionin interfaceSampler- Returns:
- the description of this
Sampler.
-
toString
-
equals
-
hashCode
public int hashCode()
-