Package brave.baggage
Class BaggageFields
- java.lang.Object
-
- brave.baggage.BaggageFields
-
public final class BaggageFields extends Object
This contains pre-defined fields, such asTRACE_ID
and a way to create a constant field.Built-in fields
The following are fields that dispatch to methods on theTraceContext
. They are available regardless ofBaggagePropagation
. None will return in lookups such asBaggageField.getAll(TraceContext)
orBaggageField.getByName(TraceContext, String)
- Since:
- 5.11
-
-
Field Summary
Fields Modifier and Type Field Description static BaggageField
PARENT_ID
Typically only useful when spans are parsed from log records.static BaggageField
SAMPLED
This is only useful whenTRACE_ID
is also a baggage field.static BaggageField
SPAN_ID
Used withTRACE_ID
to correlate a log line with a span.static BaggageField
TRACE_ID
This is the most common log correlation field.
-
Constructor Summary
Constructors Constructor Description BaggageFields()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static BaggageField
constant(String name, String value)
Creates a local baggage field based on a possibly null constant, such as an ENV variable.
-
-
-
Field Detail
-
TRACE_ID
public static final BaggageField TRACE_ID
This is the most common log correlation field.- Since:
- 5.11
- See Also:
TraceContext.traceIdString()
-
PARENT_ID
public static final BaggageField PARENT_ID
Typically only useful when spans are parsed from log records.- Since:
- 5.11
- See Also:
TraceContext.parentIdString()
-
SPAN_ID
public static final BaggageField SPAN_ID
Used withTRACE_ID
to correlate a log line with a span.- Since:
- 5.11
- See Also:
TraceContext.spanIdString()
-
SAMPLED
public static final BaggageField SAMPLED
This is only useful whenTRACE_ID
is also a baggage field. It is a hint that a trace may exist in Zipkin, when a user is viewing logs. For example, unsampled traces are not typically reported to Zipkin.- Since:
- 5.11
- See Also:
SamplingFlags.sampled()
-
-
Method Detail
-
constant
public static BaggageField constant(String name, @Nullable String value)
Creates a local baggage field based on a possibly null constant, such as an ENV variable.Ex.
CLOUD_REGION = BaggageFields.constant("region", System.getEnv("CLOUD_REGION"));
- Since:
- 5.11
-
-