Interface SamplingResult
-
public interface SamplingResult
Sampling result returned bySampler.shouldSample(Context, String, String, Span.Kind, Attributes, List)
.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static SamplingResult
create(SamplingDecision decision)
static SamplingResult
create(SamplingDecision decision, io.opentelemetry.api.common.Attributes attributes)
io.opentelemetry.api.common.Attributes
getAttributes()
Return tags which will be attached to the span.SamplingDecision
getDecision()
Return decision on whether a span should be recorded, recorded and sampled or not recorded.default io.opentelemetry.api.trace.TraceState
getUpdatedTraceState(io.opentelemetry.api.trace.TraceState parentTraceState)
Return an optionally-updatedTraceState
, based on the parent TraceState.
-
-
-
Method Detail
-
create
static SamplingResult create(SamplingDecision decision)
Returns aSamplingResult
with no attributes andgetDecision()
returningdecision
.This is meant for use by custom
Sampler
implementations.Use
create(SamplingDecision, Attributes)
if you need attributes.- Parameters:
decision
- The decision made on the span.- Returns:
- A
SamplingResult
with empty attributes and the provideddecision
.
-
create
static SamplingResult create(SamplingDecision decision, io.opentelemetry.api.common.Attributes attributes)
Returns aSamplingResult
with the givenattributes
andgetDecision()
returningdecision
.This is meant for use by custom
Sampler
implementations.Using
create(SamplingDecision)
instead of this method is slightly faster and shorter if you don't need attributes.- Parameters:
decision
- The decision made on the span.attributes
- The attributes to return fromgetAttributes()
. A different object instance with the same elements may be returned.- Returns:
- A
SamplingResult
with the attributes equivalent toattributes
and the provideddecision
.
-
getDecision
SamplingDecision getDecision()
Return decision on whether a span should be recorded, recorded and sampled or not recorded.- Returns:
- sampling result.
-
getAttributes
io.opentelemetry.api.common.Attributes getAttributes()
Return tags which will be attached to the span.- Returns:
- attributes added to span. These attributes should be added to the span only when
the sampling decision is
SamplingDecision.RECORD_ONLY
orSamplingDecision.RECORD_AND_SAMPLE
.
-
getUpdatedTraceState
default io.opentelemetry.api.trace.TraceState getUpdatedTraceState(io.opentelemetry.api.trace.TraceState parentTraceState)
Return an optionally-updatedTraceState
, based on the parent TraceState. This may return the sameTraceState
that was provided originally, or an updated one.- Parameters:
parentTraceState
- The TraceState from the parent span. Might be an empty TraceState, if there is no parent. This will be the same TraceState that was passed in via theSpanContext
parameter on theSampler.shouldSample(Context, String, String, Span.Kind, Attributes, List)
call.
-
-