-
- All Implemented Interfaces:
-
io.opentelemetry.sdk.trace.SpanProcessor,java.io.Closeable,java.lang.AutoCloseable
public final class GlobalAttributesSpanAppender implements SpanProcessorA SpanProcessor implementation that appends a set of attributes to every span that is exported. The attributes are supplied via Supplier. This Supplier may alter its results and return different attributes over time. collection is mutable, and can be updated by calling update.
This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.
-
-
Method Summary
Modifier and Type Method Description static GlobalAttributesSpanAppendercreate(Attributes initialState)Returns a new GlobalAttributesSpanAppender with a given initial attributes. static GlobalAttributesSpanAppendercreate(Supplier<Attributes> attributeSupplier)Returns a new GlobalAttributesSpanAppender which calls the given supplier to populatethe global attributes; voidonStart(Context parentContext, ReadWriteSpan span)booleanisStartRequired()voidonEnd(ReadableSpan span)booleanisEndRequired()voidupdate(Consumer<AttributesBuilder> attributesUpdater)Update the global set of attributes to be appended to every span. voidupdate(Supplier<Attributes> attributesSupplier)Replaces the currently configured attributes Supplier with a new one. -
-
Method Detail
-
create
static GlobalAttributesSpanAppender create(Attributes initialState)
Returns a new GlobalAttributesSpanAppender with a given initial attributes.
- Parameters:
initialState- The initial collection of attributes to append to every span.
-
create
static GlobalAttributesSpanAppender create(Supplier<Attributes> attributeSupplier)
Returns a new GlobalAttributesSpanAppender which calls the given supplier to populatethe global attributes;
- Parameters:
attributeSupplier- a Supplier of Attributes to be placed on every span.
-
onStart
void onStart(Context parentContext, ReadWriteSpan span)
-
isStartRequired
boolean isStartRequired()
-
onEnd
void onEnd(ReadableSpan span)
-
isEndRequired
boolean isEndRequired()
-
update
void update(Consumer<AttributesBuilder> attributesUpdater)
Update the global set of attributes to be appended to every span.
Note: Calling this method invalidates the Supplier originally passed to this and any other previously updated Supplier.
- Parameters:
attributesUpdater- A function which will update the current set of attributes, byoperating on a AttributesBuilder from the current set.
-
-
-
-