Class OpenTelemetrySpanFactory.Builder

java.lang.Object
org.axonframework.extension.tracing.opentelemetry.OpenTelemetrySpanFactory.Builder
Enclosing class:
OpenTelemetrySpanFactory

public static class OpenTelemetrySpanFactory.Builder extends Object
Builder class to instantiate a OpenTelemetrySpanFactory.

The SpanAttributeProvieders are defaulted to an empty list, the Tracer is defaulted to the tracer defined by GlobalOpenTelemetry, the TextMapSetter is defaulted to the MetadataContextSetter and the TextMapGetter is defaulted to the MetadataContextGetter.

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • addSpanAttributeProviders

      public OpenTelemetrySpanFactory.Builder addSpanAttributeProviders(@Nonnull List<SpanAttributesProvider> attributesProviders)
      Adds all provided SpanAttributesProviders to the SpanFactory.
      Parameters:
      attributesProviders - The SpanAttributesProviders to add.
      Returns:
      The current Builder instance, for fluent interfacing.
    • contextPropagators

      public OpenTelemetrySpanFactory.Builder contextPropagators(io.opentelemetry.context.propagation.TextMapPropagator propagator)
      Sets the propagator to be used. A propagator is used to propagate the current context into a message, so it can become the parent of another span despite being in another system.
      Parameters:
      propagator - The propagator to be used.
      Returns:
      The current Builder instance, for fluent interfacing.
    • tracer

      public OpenTelemetrySpanFactory.Builder tracer(@Nonnull io.opentelemetry.api.trace.Tracer tracer)
      Defines the Tracer from OpenTelemetry to use.
      Parameters:
      tracer - The Tracer to configure for use.
      Returns:
      The current Builder instance, for fluent interfacing.
    • textMapSetter

      public OpenTelemetrySpanFactory.Builder textMapSetter(io.opentelemetry.context.propagation.TextMapSetter<Map<String,String>> textMapSetter)
      Defines the TextMapSetter to use, which is used for propagating the context to another thread or service.
      Parameters:
      textMapSetter - The TextMapSetter to configure for use.
      Returns:
      The current Builder instance, for fluent interfacing.
    • textMapGetter

      public OpenTelemetrySpanFactory.Builder textMapGetter(io.opentelemetry.context.propagation.TextMapGetter<Message> textMapGetter)
      Defines the TextMapGetter to use, which is used for extracting the propagated context from another thread or service.
      Parameters:
      textMapGetter - The TextMapGetter to configure for use.
      Returns:
      The current Builder instance, for fluent interfacing.
    • build

      public OpenTelemetrySpanFactory build()
      Initializes the OpenTelemetrySpanFactory.
      Returns:
      The created OpenTelemetrySpanFactory with the provided configuration.