Improve key validity code documentation for trace state (#3142)
* Improve key validity documentation for trace state * Address code style issues Addressed line length, indentation * spotlessapply to fix indent of javadoc param comment
This commit is contained in:
parent
ae60da66fa
commit
f5f0e1f63f
|
|
@ -40,6 +40,16 @@ final class ArrayBasedTraceStateBuilder implements TraceStateBuilder {
|
|||
this.parent = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows key value pairs to be added to the TraceState.
|
||||
*
|
||||
* @param 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.
|
||||
*/
|
||||
@Override
|
||||
public TraceStateBuilder put(String key, String value) {
|
||||
if (!isKeyValid(key)
|
||||
|
|
@ -93,13 +103,17 @@ final class ArrayBasedTraceStateBuilder implements TraceStateBuilder {
|
|||
return ArrayBasedTraceState.create(entries);
|
||||
}
|
||||
|
||||
// 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 /. 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 digit.
|
||||
//
|
||||
/**
|
||||
* Checks the validity of a key.
|
||||
*
|
||||
* @param 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.
|
||||
* @return boolean representing key validity
|
||||
*/
|
||||
// todo: benchmark this implementation
|
||||
private static boolean isKeyValid(@Nullable String key) {
|
||||
if (key == null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue