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 allow dynamic updates of
TraceConfigyou should register aSupplierwithSdkTracerProviderBuilder.setTraceConfig(java.util.function.Supplier)which supplies dynamic configs when queried.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.
-
-
Field Summary
Fields Modifier and Type Field Description static intUNLIMITED_ATTRIBUTE_LENGTHValue 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 TraceConfigBuilderbuilder()Returns a newTraceConfigBuilderto construct aTraceConfig.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()TraceConfigBuildertoBuilder()Returns aTraceConfigBuilderinitialized to the same property values as the current instance.
-
-
-
Method Detail
-
getDefault
public static TraceConfig getDefault()
Returns the defaultTraceConfig.- Returns:
- the default
TraceConfig.
-
builder
public static TraceConfigBuilder builder()
Returns a newTraceConfigBuilderto construct aTraceConfig.
-
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 TraceConfigBuilder toBuilder()
Returns aTraceConfigBuilderinitialized to the same property values as the current instance.- Returns:
- a
TraceConfigBuilderinitialized to the same property values as the current instance.
-
-