Interface SingleLineValue
-
public interface SingleLineValue
Wrapper for supporting injecting and extracting single-string values.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static java.lang.String
format(long traceId, long spanId, java.lang.Long parentSpanId)
Formats the provided trace information.static java.lang.String
format(java.lang.String traceIdHex, java.lang.String spanIdHex, java.lang.String parentSpanIdHex)
Formats the provided trace information.static java.lang.String
format(java.lang.String traceIdHex, java.lang.String spanIdHex, java.lang.String parentSpanIdHex, boolean isSampled)
Formats the provided trace information.java.lang.String
get()
Gets the value.static SingleLineValue
of(java.lang.String value)
Returns aSingleLineValue
backed by a fixed string.void
set(java.lang.String value)
Sets the value.static SingleLineValue
to(java.util.function.Consumer<java.lang.String> consumer)
Returns aSingleLineValue
which supports injection.
-
-
-
Method Detail
-
get
@Nullable java.lang.String get()
Gets the value.- Returns:
- the value
-
set
void set(java.lang.String value)
Sets the value.- Parameters:
value
- the value
-
of
static SingleLineValue of(@Nullable java.lang.String value)
Returns aSingleLineValue
backed by a fixed string.- Parameters:
value
- string value- Returns:
- a read-only
SingleLineValue
-
to
static SingleLineValue to(java.util.function.Consumer<java.lang.String> consumer)
Returns aSingleLineValue
which supports injection.- Parameters:
consumer
- consumer to call when a value is injected- Returns:
- a write-only
SingleLineValue
-
format
static java.lang.String format(long traceId, long spanId, @Nullable java.lang.Long parentSpanId)
Formats the provided trace information.- Parameters:
traceId
- the trace ID.spanId
- the span ID.parentSpanId
- the parent span ID, ornull
if none available.- Returns:
- the formatted trace information as
String
.
-
format
static java.lang.String format(java.lang.String traceIdHex, java.lang.String spanIdHex, @Nullable java.lang.String parentSpanIdHex)
Formats the provided trace information.- Parameters:
traceIdHex
- the trace ID as HEXString
.spanIdHex
- the span ID as HEXString
.parentSpanIdHex
- the parent span ID as HEXString
, ornull
if none available.- Returns:
- the formatted trace information as
String
.
-
format
static java.lang.String format(java.lang.String traceIdHex, java.lang.String spanIdHex, @Nullable java.lang.String parentSpanIdHex, boolean isSampled)
Formats the provided trace information.- Parameters:
traceIdHex
- the trace ID as HEXString
.spanIdHex
- the span ID as HEXString
.parentSpanIdHex
- the parent span ID as HEXString
, ornull
if none available.isSampled
-true
if the span is sampled.- Returns:
- the formatted trace information as
String
.
-
-