Package io.opentelemetry.api.trace
Class ArrayBasedTraceStateBuilder
java.lang.Object
io.opentelemetry.api.trace.ArrayBasedTraceStateBuilder
- All Implemented Interfaces:
TraceStateBuilder
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ArrayBasedTraceState
private static final int
private static final int
private static final int
private static final int
(package private) int
private static final int
-
Constructor Summary
ConstructorsConstructorDescription -
Method Summary
Modifier and TypeMethodDescriptionbuild()
Builds a TraceState by adding the entries to the parent in front of the key-value pairs list and removing duplicate entries.(package private) static TraceState
empty()
private static boolean
isKeyValid
(String key) Checks the validity of a key.private static boolean
isNotDigit
(char ch) private static boolean
isNotLegalKeyCharacter
(char c) private static boolean
isNotLowercaseLetterOrDigit
(char ch) private static boolean
isValueValid
(String value) Allows key value pairs to be added to the TraceState.Removes theEntry
that has the givenkey
if it is present.
-
Field Details
-
MAX_VENDOR_ID_SIZE
private static final int MAX_VENDOR_ID_SIZE- See Also:
-
EMPTY
-
MAX_ENTRIES
private static final int MAX_ENTRIES- See Also:
-
KEY_MAX_SIZE
private static final int KEY_MAX_SIZE- See Also:
-
VALUE_MAX_SIZE
private static final int VALUE_MAX_SIZE- See Also:
-
MAX_TENANT_ID_SIZE
private static final int MAX_TENANT_ID_SIZE- See Also:
-
reversedEntries
-
numEntries
int numEntries
-
-
Constructor Details
-
ArrayBasedTraceStateBuilder
ArrayBasedTraceStateBuilder() -
ArrayBasedTraceStateBuilder
ArrayBasedTraceStateBuilder(ArrayBasedTraceState parent)
-
-
Method Details
-
empty
-
put
Allows key value pairs to be added to the TraceState.- Specified by:
put
in interfaceTraceStateBuilder
- Parameters:
key
- is an 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 /. For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the vendor name. The tenant id (before the '@') is limited to 240 characters and the vendor id is limited to 13 characters. If in the multi-tenant vendor format, then the first character may additionally be numeric.value
- the value for theEntry
to be added.- Returns:
- this.
-
remove
Description copied from interface:TraceStateBuilder
Removes theEntry
that has the givenkey
if it is present.- Specified by:
remove
in interfaceTraceStateBuilder
- Parameters:
key
- the key for theEntry
to be removed.- Returns:
- this.
-
build
Description copied from interface:TraceStateBuilder
Builds a TraceState by adding the entries to the parent in front of the key-value pairs list and removing duplicate entries.- Specified by:
build
in interfaceTraceStateBuilder
- Returns:
- a TraceState with the new entries.
-
isKeyValid
Checks the validity of a key.- Parameters:
key
- is an 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 /. For multi-tenant vendor scenarios, an at sign (@) can be used to prefix the vendor name. The tenant id (before the '@') is limited to 240 characters and the vendor id is limited to 13 characters. If in the multi-tenant vendor format, then the first character may additionally be numeric.- Returns:
- boolean representing key validity
-
isNotLegalKeyCharacter
private static boolean isNotLegalKeyCharacter(char c) -
isNotLowercaseLetterOrDigit
private static boolean isNotLowercaseLetterOrDigit(char ch) -
isNotDigit
private static boolean isNotDigit(char ch) -
isValueValid
-