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 TypeMethodDescriptionboolean
Returns the description of thisSampler
.int
hashCode()
shouldSample
(Context parentContext, String traceId, String name, SpanKind spanKind, Attributes attributes, List<LinkData> parentLinks) Called duringSpan
creation 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:Sampler
Called duringSpan
creation to make a sampling samplingResult.- Specified by:
shouldSample
in interfaceSampler
- Parameters:
parentContext
- the parent span'sSpanContext
. This can beSpanContext.INVALID
if this is a root span.traceId
- theTraceId
for the newSpan
. This will be identical to that in the parentContext, unless this is a root span.name
- the name of the newSpan
.spanKind
- theSpanKind
of theSpan
.attributes
-Attributes
associated 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:Sampler
Returns the description of thisSampler
. This may be displayed on debug pages or in the logs.Example: "TraceIdRatioBased{0.000100}"
- Specified by:
getDescription
in interfaceSampler
- Returns:
- the description of this
Sampler
.
-
toString
-
equals
-
hashCode
public int hashCode()
-