Class 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 the toBuilder() method on the TraceConfig currently assigned to the provider, make the changes desired to the TraceConfigBuilder instance, then use the SdkTracerManagement.updateActiveTraceConfig(TraceConfig) with the resulting TraceConfig instance.

    Configuration options for TraceConfig can be read from system properties, environment variables, or Properties 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 new Span.
    • otel.span.attribute.count.limit: to set the global default max number of attributes per Span.
    • otel.span.event.count.limit: to set the global default max number of events per Span.
    • otel.span.link.count.limit: to set the global default max number of links per Span.
    • 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 new Span.
    • OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT: to set the global default max number of attributes per Span.
    • OTEL_SPAN_EVENT_COUNT_LIMIT: to set the global default max number of events per Span.
    • OTEL_SPAN_LINK_COUNT_LIMIT: to set the global default max number of links per Span.
    • 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.
    • Constructor Detail

      • TraceConfig

        public TraceConfig()
    • Method Detail

      • getDefault

        public static TraceConfig getDefault()
        Returns the default TraceConfig.
        Returns:
        the default TraceConfig.
      • getSampler

        public abstract Sampler getSampler()
        Returns the global default Sampler which is used when constructing a new Span.
        Returns:
        the global default Sampler.
      • getMaxNumberOfAttributes

        public abstract int getMaxNumberOfAttributes()
        Returns the global default max number of attributes per Span.
        Returns:
        the global default max number of attributes per Span.
      • getMaxNumberOfEvents

        public abstract int getMaxNumberOfEvents()
        Returns the global default max number of events per Span.
        Returns:
        the global default max number of events per Span.
      • getMaxNumberOfLinks

        public abstract int getMaxNumberOfLinks()
        Returns the global default max number of links per Span.
        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()