Top Description Fields Methods
io.micrometer.tracing

public Interface Baggage

extends BaggageView

Inspired by OpenZipkin Brave's BaggageField. Since some tracer implementations require a scope to be wrapped around baggage, baggage must be closed so that the scope does not leak, see BaggageInScope. 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.

Authors
Marcin Grzejszczak, Jonatan Ivanov
Since
1.0.0

Field Summary

Modifier and TypeField and Description
public static final Baggage
NOOP

Hides io.micrometer.tracing.BaggageView.NOOP.

A noop implementation.

Method Summary

Modifier and TypeMethod and Description
public BaggageInScope

Returns:

a BaggageInScope instance
makeCurrent
()

Sets the current baggage in scope.

public default BaggageInScope

Returns:

a BaggageInScope instance
makeCurrent
(String
to set
value
)

Sets the current baggage in scope with given value.

public default BaggageInScope

Returns:

a BaggageInScope instance
makeCurrent
(TraceContext
context containing baggage
traceContext
,
String
to set
value
)

Sets the current baggage in scope with given value.

public Baggage

Returns:

itself
set
(String
to set
value
)

Sets the baggage value.
public Baggage

Returns:

itself
set
(TraceContext
context containing baggage
traceContext
,
String
to set
value
)

Sets the baggage value for the given TraceContext.
Inherited from io.micrometer.tracing.BaggageView:
getgetname

Field Detail

NOOPback to summary
public static final Baggage NOOP

Hides io.micrometer.tracing.BaggageView.NOOP.

A noop implementation.

Method Detail

makeCurrentback to summary
public BaggageInScope makeCurrent()

Sets the current baggage in scope.

Returns:BaggageInScope

a BaggageInScope instance

makeCurrentback to summary
public default BaggageInScope makeCurrent(String value)

Sets the current baggage in scope with given value.

Parameters
value:String

to set

Returns:BaggageInScope

a BaggageInScope instance

makeCurrentback to summary
public default BaggageInScope makeCurrent(TraceContext traceContext, String value)

Sets the current baggage in scope with given value.

Parameters
traceContext:TraceContext

context containing baggage

value:String

to set

Returns:BaggageInScope

a BaggageInScope instance

setback to summary
public Baggage set(String value)

Sets the baggage value.

Parameters
value:String

to set

Returns:Baggage

itself

Annotations
@Deprecated
setback to summary
public Baggage set(TraceContext traceContext, String value)

Sets the baggage value for the given TraceContext.

Parameters
traceContext:TraceContext

context containing baggage

value:String

to set

Returns:Baggage

itself

Annotations
@Deprecated