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 ArrayBasedTraceStateprivate static final intprivate static final intprivate static final intprivate static final int(package private) intprivate 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 TraceStateempty()private static booleanisKeyValid(String key) Checks the validity of a key.private static booleanisNotDigit(char ch) private static booleanisNotLegalKeyCharacter(char c) private static booleanisNotLowercaseLetterOrDigit(char ch) private static booleanisValueValid(String value) Allows key value pairs to be added to the TraceState.Removes theEntrythat has the givenkeyif 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:
putin 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 theEntryto be added.- Returns:
- this.
-
remove
Description copied from interface:TraceStateBuilderRemoves theEntrythat has the givenkeyif it is present.- Specified by:
removein interfaceTraceStateBuilder- Parameters:
key- the key for theEntryto be removed.- Returns:
- this.
-
build
Description copied from interface:TraceStateBuilderBuilds a TraceState by adding the entries to the parent in front of the key-value pairs list and removing duplicate entries.- Specified by:
buildin 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
-