public interface BaggageInScope extends Closeable
BaggageField. Since some tracer implementations
require a scope to be wrapped around baggage, baggage must be closed so that the scope
does not leak. Some tracer implementations make baggage immutable (e.g. OpenTelemetry),
so when the value gets updated they might create new scope (others will return the same
one - e.g. OpenZipkin Brave).
Represents a single baggage entry.| Modifier and Type | Method and Description |
|---|---|
void |
close() |
String |
get() |
String |
get(TraceContext traceContext)
Retrieves baggage from the given
TraceContext. |
BaggageInScope |
makeCurrent()
Sets the current baggage in scope.
|
String |
name() |
BaggageInScope |
set(String value)
Sets the baggage value.
|
BaggageInScope |
set(TraceContext traceContext,
String value)
Sets the baggage value for the given
TraceContext. |
String name()
@Nullable String get()
null if not set.@Nullable String get(TraceContext traceContext)
TraceContext.traceContext - context containing baggagenull if not set.BaggageInScope set(String value)
value - to setBaggageInScope set(TraceContext traceContext, String value)
TraceContext.traceContext - context containing baggagevalue - to setBaggageInScope makeCurrent()
void close()
close in interface AutoCloseableclose in interface CloseableCopyright © 2021 Pivotal Software, Inc.. All rights reserved.