Class BaggageSpanProcessor
java.lang.Object
io.opentelemetry.contrib.baggage.processor.BaggageSpanProcessor
- All Implemented Interfaces:
io.opentelemetry.sdk.trace.SpanProcessor,Closeable,AutoCloseable
public final class BaggageSpanProcessor
extends Object
implements io.opentelemetry.sdk.trace.SpanProcessor
This span processor copies attributes stored in
Baggage into each newly created Span.-
Constructor Summary
ConstructorsConstructorDescriptionBaggageSpanProcessor(Collection<String> included, Collection<String> excluded) Creates a newBaggageSpanProcessorthat copies baggage entries with keys that pass the provided include/exclude filtering into the newly createdSpan, when both arguments are null or empty all baggage are included.BaggageSpanProcessor(Predicate<String> baggageKeyPredicate) Deprecated. -
Method Summary
Modifier and TypeMethodDescriptionstatic BaggageSpanProcessorCreates a newBaggageSpanProcessorthat copies all baggage entries into the newly created span.booleanbooleanvoidonEnd(io.opentelemetry.sdk.trace.ReadableSpan span) voidonStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.opentelemetry.sdk.trace.SpanProcessor
close, forceFlush, shutdown
-
Constructor Details
-
BaggageSpanProcessor
Deprecated.UseBaggageSpanProcessor(Collection, Collection)instead. Most usages of this method should be replaceable with glob patterns, but not all thus this method is kept to preserve compatibility. -
BaggageSpanProcessor
public BaggageSpanProcessor(@Nullable Collection<String> included, @Nullable Collection<String> excluded) Creates a newBaggageSpanProcessorthat copies baggage entries with keys that pass the provided include/exclude filtering into the newly createdSpan, when both arguments are null or empty all baggage are included.- Parameters:
included- list of included baggage key patterns to includeexcluded- list of excluded baggage key patterns to exclude
-
-
Method Details
-
allowAllBaggageKeys
Creates a newBaggageSpanProcessorthat copies all baggage entries into the newly created span.- Returns:
- baggage span processor including all attributes
-
onStart
public void onStart(io.opentelemetry.context.Context parentContext, io.opentelemetry.sdk.trace.ReadWriteSpan span) - Specified by:
onStartin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
isStartRequired
public boolean isStartRequired()- Specified by:
isStartRequiredin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
onEnd
public void onEnd(io.opentelemetry.sdk.trace.ReadableSpan span) - Specified by:
onEndin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
isEndRequired
public boolean isEndRequired()- Specified by:
isEndRequiredin interfaceio.opentelemetry.sdk.trace.SpanProcessor
-
toString
-
BaggageSpanProcessor(Collection, Collection)instead.