Class TracingConfig

java.lang.Object
codes.grow.packages.tempo.tracing.TracingConfig

public final class TracingConfig extends Object
Immutable tracing setup used by Tracing.initWith(codes.grow.packages.tempo.tracing.TracingConfig, codes.grow.packages.tempo.tracing.SpanExporterFactory).

 TracingConfig config = TracingConfig.builder("checkout")
     .serviceVersion("1.4.2")
     .environment("staging")
     .endpoint("http://otel-collector:4318")
     .build();
 
  • Field Details

    • DEFAULT_PROPAGATORS

      public static final List<String> DEFAULT_PROPAGATORS
      Default propagators.
  • Method Details

    • builder

      public static TracingConfig.Builder builder(String serviceName)
      Returns a builder.
      Parameters:
      serviceName - service.name of the traced application
      Returns:
      builder with the defaults
    • toBuilder

      public TracingConfig.Builder toBuilder()
      Returns a builder with these values.
      Returns:
      builder copy
    • serviceName

      public String serviceName()
      service.name.
      Returns:
      service name
    • serviceVersion

      public Optional<String> serviceVersion()
      service.version.
      Returns:
      version, if set
    • environment

      public Optional<String> environment()
      deployment.environment.name (and the legacy deployment.environment).
      Returns:
      environment, if set
    • resourceAttributes

      public Map<String,Object> resourceAttributes()
      Extra resource attributes.
      Returns:
      attributes
    • endpoint

      public Optional<String> endpoint()
      Export endpoint.
      Returns:
      endpoint, if set (the service default otherwise)
    • protocol

      public TracingConfig.Protocol protocol()
      Export protocol.
      Returns:
      protocol
    • headers

      public Map<String,String> headers()
      Extra export headers (for example authentication).
      Returns:
      headers
    • sampler

      public TracingConfig.SamplerType sampler()
      Sampler.
      Returns:
      sampler
    • samplerRatio

      public double samplerRatio()
      Ratio of the ratio samplers.
      Returns:
      ratio between 0 and 1
    • propagators

      public List<String> propagators()
      Propagator names.
      Returns:
      propagators
    • batch

      Batch processor settings.
      Returns:
      settings
    • tls

      public Optional<TlsOptions> tls()
      TLS settings of the exporter.
      Returns:
      TLS options, if set
    • compression

      public TracingConfig.Compression compression()
      Export compression.
      Returns:
      compression
    • setGlobal

      public boolean setGlobal()
      Returns:
      set-global flag
    • protocolExplicit

      public boolean protocolExplicit()
      Returns whether protocol() was set explicitly on the builder (rather than left at the SDK default), so a service package can apply its own default or the OTEL_* environment only when the caller did not choose.
      Returns:
      true when the builder setter was called
    • samplerExplicit

      public boolean samplerExplicit()
      Returns whether sampler() was set explicitly on the builder (rather than left at the SDK default), so a service package can apply its own default or the OTEL_* environment only when the caller did not choose.
      Returns:
      true when the builder setter was called
    • samplerRatioExplicit

      public boolean samplerRatioExplicit()
      Returns whether samplerRatio() was set explicitly on the builder (rather than left at the SDK default), so a service package can apply its own default or the OTEL_* environment only when the caller did not choose.
      Returns:
      true when the builder setter was called
    • propagatorsExplicit

      public boolean propagatorsExplicit()
      Returns whether propagators() was set explicitly on the builder (rather than left at the SDK default), so a service package can apply its own default or the OTEL_* environment only when the caller did not choose.
      Returns:
      true when the builder setter was called
    • compressionExplicit

      public boolean compressionExplicit()
      Returns whether compression() was set explicitly on the builder (rather than left at the SDK default), so a service package can apply its own default or the OTEL_* environment only when the caller did not choose.
      Returns:
      true when the builder setter was called
    • toString

      public String toString()
      Header values are redacted when the header name is sensitive.
      Overrides:
      toString in class Object