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
TracerSdkManagement, you should use thetoBuilder()method on the TraceConfig currently assigned to the provider, make the changes desired to theTraceConfig.Builderinstance, then use theTracerSdkManagement.updateActiveTraceConfig(TraceConfig)with the resulting TraceConfig instance.Configuration options for
TraceConfigcan be read from system properties, environment variables, orPropertiesobjects.For system properties and
Propertiesobjects,TraceConfigwill 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,
TraceConfigwill 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTraceConfig.BuilderBuilder forTraceConfig.
-
Field Summary
Fields Modifier and Type Field Description static intUNLIMITED_ATTRIBUTE_LENGTH
-
Constructor Summary
Constructors Constructor Description TraceConfig()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static TraceConfiggetDefault()Returns the defaultTraceConfig.abstract intgetMaxLengthOfAttributeValues()Returns the global default max length of string attribute value in characters.abstract intgetMaxNumberOfAttributes()Returns the global default max number of attributes perSpan.abstract intgetMaxNumberOfAttributesPerEvent()Returns the global default max number of attributes per event.abstract intgetMaxNumberOfAttributesPerLink()Returns the global default max number of attributes per link.abstract intgetMaxNumberOfEvents()Returns the global default max number of events perSpan.abstract intgetMaxNumberOfLinks()Returns the global default max number of links perSpan.abstract SamplergetSampler()Returns the global defaultSamplerwhich is used when constructing a newSpan.booleanshouldTruncateStringAttributeValues()abstract TraceConfig.BuildertoBuilder()Returns aTraceConfig.Builderinitialized to the same property values as the current instance.
-
-
-
Field Detail
-
UNLIMITED_ATTRIBUTE_LENGTH
public static final int UNLIMITED_ATTRIBUTE_LENGTH
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefault
public static TraceConfig getDefault()
Returns the defaultTraceConfig.- Returns:
- the default
TraceConfig.
-
getSampler
public abstract Sampler getSampler()
Returns the global defaultSamplerwhich 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 abstract TraceConfig.Builder toBuilder()
Returns aTraceConfig.Builderinitialized to the same property values as the current instance.- Returns:
- a
TraceConfig.Builderinitialized to the same property values as the current instance.
-
-