Class OpenTelemetrySpanFactory.Builder
java.lang.Object
org.axonframework.extension.tracing.opentelemetry.OpenTelemetrySpanFactory.Builder
- Enclosing class:
OpenTelemetrySpanFactory
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddSpanAttributeProviders(List<SpanAttributesProvider> attributesProviders) Adds all providedSpanAttributesProviders to theSpanFactory.build()Initializes theOpenTelemetrySpanFactory.contextPropagators(io.opentelemetry.context.propagation.TextMapPropagator propagator) Sets the propagator to be used.textMapGetter(io.opentelemetry.context.propagation.TextMapGetter<Message> textMapGetter) Defines theTextMapGetterto use, which is used for extracting the propagated context from another thread or service.textMapSetter(io.opentelemetry.context.propagation.TextMapSetter<Map<String, String>> textMapSetter) Defines theTextMapSetterto use, which is used for propagating the context to another thread or service.tracer(io.opentelemetry.api.trace.Tracer tracer) Defines theTracerfrom OpenTelemetry to use.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
addSpanAttributeProviders
public OpenTelemetrySpanFactory.Builder addSpanAttributeProviders(@Nonnull List<SpanAttributesProvider> attributesProviders) Adds all providedSpanAttributesProviders to theSpanFactory.- Parameters:
attributesProviders- TheSpanAttributesProviders 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
Defines theTracerfrom OpenTelemetry to use.- Parameters:
tracer- TheTracerto 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 theTextMapSetterto use, which is used for propagating the context to another thread or service.- Parameters:
textMapSetter- TheTextMapSetterto configure for use.- Returns:
- The current Builder instance, for fluent interfacing.
-
textMapGetter
public OpenTelemetrySpanFactory.Builder textMapGetter(io.opentelemetry.context.propagation.TextMapGetter<Message> textMapGetter) Defines theTextMapGetterto use, which is used for extracting the propagated context from another thread or service.- Parameters:
textMapGetter- TheTextMapGetterto configure for use.- Returns:
- The current Builder instance, for fluent interfacing.
-
build
Initializes theOpenTelemetrySpanFactory.- Returns:
- The created
OpenTelemetrySpanFactorywith the provided configuration.
-