Enum AlwaysOnSampler
- java.lang.Object
-
- java.lang.Enum<AlwaysOnSampler>
-
- io.opentelemetry.sdk.trace.samplers.AlwaysOnSampler
-
- All Implemented Interfaces:
Sampler
,java.io.Serializable
,java.lang.Comparable<AlwaysOnSampler>
@Immutable enum AlwaysOnSampler extends java.lang.Enum<AlwaysOnSampler> implements Sampler
-
-
Enum Constant Summary
Enum Constants Enum Constant Description INSTANCE
-
Constructor Summary
Constructors Modifier Constructor Description private
AlwaysOnSampler()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getDescription()
Returns the description of thisSampler
.SamplingResult
shouldSample(Context parentContext, java.lang.String traceId, java.lang.String name, SpanKind spanKind, Attributes attributes, java.util.List<LinkData> parentLinks)
Called duringSpan
creation to make a sampling samplingResult.java.lang.String
toString()
static AlwaysOnSampler
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static AlwaysOnSampler[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
INSTANCE
public static final AlwaysOnSampler INSTANCE
-
-
Method Detail
-
values
public static AlwaysOnSampler[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (AlwaysOnSampler c : AlwaysOnSampler.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static AlwaysOnSampler valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
shouldSample
public SamplingResult shouldSample(Context parentContext, java.lang.String traceId, java.lang.String name, SpanKind spanKind, Attributes attributes, java.util.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
public java.lang.String 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
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Enum<AlwaysOnSampler>
-
-