Package brave.baggage
Class BaggageFields
java.lang.Object
brave.baggage.BaggageFields
public final class BaggageFields extends Object
This contains pre-defined fields, such as
TRACE_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 of BaggagePropagation
. None will return in lookups such as BaggageField.getAll(TraceContext)
or BaggageField.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
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 Details
-
TRACE_ID
This is the most common log correlation field.- Since:
- 5.11
- See Also:
TraceContext.traceIdString()
-
PARENT_ID
Typically only useful when spans are parsed from log records.- Since:
- 5.11
- See Also:
TraceContext.parentIdString()
-
SPAN_ID
Used withTRACE_ID
to correlate a log line with a span.- Since:
- 5.11
- See Also:
TraceContext.spanIdString()
-
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()
-
-
Constructor Details
-
BaggageFields
public BaggageFields()
-
-
Method Details
-
constant
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
-