Class TraceConfig
- java.lang.Object
-
- io.opentelemetry.sdk.trace.config.TraceConfig
-
@Immutable public abstract class TraceConfig extends Object
Class that holds global trace parameters.Note: To update the TraceConfig associated with a
SdkTracerManagement
, you should use thetoBuilder()
method on the TraceConfig currently assigned to the provider, make the changes desired to theTraceConfigBuilder
instance, then use theSdkTracerManagement.updateActiveTraceConfig(TraceConfig)
with the resulting TraceConfig instance.Configuration options for
TraceConfig
can be read from system properties, environment variables, orProperties
objects.For system properties and
Properties
objects,TraceConfig
will look for the following names:otel.config.sampler.probability
: to set the global default sampler which is used when constructing a newSpan
.otel.span.attribute.count.limit
: to set the global default max number of attributes perSpan
.otel.span.event.count.limit
: to set the global default max number of events perSpan
.otel.span.link.count.limit
: to set the global default max number of links perSpan
.otel.config.max.event.attrs
: to set the global default max number of attributes per event.otel.config.max.link.attrs
: to set the global default max number of attributes per link.otel.config.max.attr.length
: to set the global default max length of string attribute value in characters.
For environment variables,
TraceConfig
will look for the following names:OTEL_CONFIG_SAMPLER_PROBABILITY
: to set the global default sampler which is used when constructing a newSpan
.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT
: to set the global default max number of attributes perSpan
.OTEL_SPAN_EVENT_COUNT_LIMIT
: to set the global default max number of events perSpan
.OTEL_SPAN_LINK_COUNT_LIMIT
: to set the global default max number of links perSpan
.OTEL_CONFIG_MAX_EVENT_ATTRS
: to set the global default max number of attributes per event.OTEL_CONFIG_MAX_LINK_ATTRS
: to set the global default max number of attributes per link.OTEL_CONFIG_MAX_ATTR_LENGTH
: to set the global default max length of string attribute value in characters.
-
-
Field Summary
Fields Modifier and Type Field Description static int
UNLIMITED_ATTRIBUTE_LENGTH
Value for attribute length which indicates attributes should not be truncated.
-
Constructor Summary
Constructors Constructor Description TraceConfig()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TraceConfig
getDefault()
Returns the defaultTraceConfig
.abstract int
getMaxLengthOfAttributeValues()
Returns the global default max length of string attribute value in characters.abstract int
getMaxNumberOfAttributes()
Returns the global default max number of attributes perSpan
.abstract int
getMaxNumberOfAttributesPerEvent()
Returns the global default max number of attributes per event.abstract int
getMaxNumberOfAttributesPerLink()
Returns the global default max number of attributes per link.abstract int
getMaxNumberOfEvents()
Returns the global default max number of events perSpan
.abstract int
getMaxNumberOfLinks()
Returns the global default max number of links perSpan
.abstract Sampler
getSampler()
Returns the global defaultSampler
which is used when constructing a newSpan
.boolean
shouldTruncateStringAttributeValues()
TraceConfigBuilder
toBuilder()
Returns aTraceConfigBuilder
initialized to the same property values as the current instance.
-
-
-
Method Detail
-
getDefault
public static TraceConfig getDefault()
Returns the defaultTraceConfig
.- Returns:
- the default
TraceConfig
.
-
getSampler
public abstract Sampler getSampler()
Returns the global defaultSampler
which is used when constructing a newSpan
.- Returns:
- the global default
Sampler
.
-
getMaxNumberOfAttributes
public abstract int getMaxNumberOfAttributes()
Returns the global default max number of attributes perSpan
.- Returns:
- the global default max number of attributes per
Span
.
-
getMaxNumberOfEvents
public abstract int getMaxNumberOfEvents()
Returns the global default max number of events perSpan
.- Returns:
- the global default max number of events per
Span
.
-
getMaxNumberOfLinks
public abstract int getMaxNumberOfLinks()
Returns the global default max number of links perSpan
.- Returns:
- the global default max number of links per
Span
.
-
getMaxNumberOfAttributesPerEvent
public abstract int getMaxNumberOfAttributesPerEvent()
Returns the global default max number of attributes per event.- Returns:
- the global default max number of attributes per event.
-
getMaxNumberOfAttributesPerLink
public abstract int getMaxNumberOfAttributesPerLink()
Returns the global default max number of attributes per link.- Returns:
- the global default max number of attributes per link.
-
getMaxLengthOfAttributeValues
public abstract int getMaxLengthOfAttributeValues()
Returns the global default max length of string attribute value in characters.- Returns:
- the global default max length of string attribute value in characters.
- See Also:
shouldTruncateStringAttributeValues()
-
shouldTruncateStringAttributeValues
public boolean shouldTruncateStringAttributeValues()
-
toBuilder
public TraceConfigBuilder toBuilder()
Returns aTraceConfigBuilder
initialized to the same property values as the current instance.- Returns:
- a
TraceConfigBuilder
initialized to the same property values as the current instance.
-
-