Package io.opencensus.trace
Class Tracestate
- java.lang.Object
-
- io.opencensus.trace.Tracestate
-
- Direct Known Subclasses:
AutoValue_Tracestate
@Immutable @ExperimentalApi public abstract class Tracestate extends java.lang.Object
Carries tracing-system specific context in a list of key-value pairs. TraceState allows different vendors propagate additional information and inter-operate with their legacy Id formats.Implementation is optimized for a small list of key-value pairs.
Key is opaque string up to 256 characters printable. It MUST begin with a lowercase letter, and can only contain lowercase letters a-z, digits 0-9, underscores _, dashes -, asterisks *, and forward slashes /.
Value is opaque string up to 256 characters printable ASCII RFC0020 characters (i.e., the range 0x20 to 0x7E) except comma , and =.
- Since:
- 0.16
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Tracestate.Builder
Builder class forMessageEvent
.static class
Tracestate.Entry
Immutable key-value pair forTracestate
.
-
Field Summary
Fields Modifier and Type Field Description private static int
KEY_MAX_SIZE
private static int
MAX_KEY_VALUE_PAIRS
private static int
VALUE_MAX_SIZE
-
Constructor Summary
Constructors Constructor Description Tracestate()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static Tracestate.Builder
builder()
Returns aBuilder
based on an emptyTracestate
.private static Tracestate
create(java.util.List<Tracestate.Entry> entries)
java.lang.String
get(java.lang.String key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.abstract java.util.List<Tracestate.Entry>
getEntries()
Returns aList
view of the mappings contained in thisTraceState
.Tracestate.Builder
toBuilder()
Returns aBuilder
based on thisTracestate
.private static boolean
validateKey(java.lang.String key)
private static boolean
validateValue(java.lang.String value)
-
-
-
Field Detail
-
KEY_MAX_SIZE
private static final int KEY_MAX_SIZE
- See Also:
- Constant Field Values
-
VALUE_MAX_SIZE
private static final int VALUE_MAX_SIZE
- See Also:
- Constant Field Values
-
MAX_KEY_VALUE_PAIRS
private static final int MAX_KEY_VALUE_PAIRS
- See Also:
- Constant Field Values
-
-
Method Detail
-
get
@Nullable public java.lang.String get(java.lang.String key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.- Parameters:
key
- with which the specified value is to be associated- Returns:
- the value to which the specified key is mapped, or null if this map contains no mapping for the key.
- Since:
- 0.16
-
getEntries
public abstract java.util.List<Tracestate.Entry> getEntries()
Returns aList
view of the mappings contained in thisTraceState
.- Returns:
- a
List
view of the mappings contained in thisTraceState
. - Since:
- 0.16
-
builder
public static Tracestate.Builder builder()
Returns aBuilder
based on an emptyTracestate
.- Returns:
- a
Builder
based on an emptyTracestate
. - Since:
- 0.16
-
toBuilder
public Tracestate.Builder toBuilder()
Returns aBuilder
based on thisTracestate
.- Returns:
- a
Builder
based on thisTracestate
. - Since:
- 0.16
-
validateKey
private static boolean validateKey(java.lang.String key)
-
validateValue
private static boolean validateValue(java.lang.String value)
-
create
private static Tracestate create(java.util.List<Tracestate.Entry> entries)
-
-