Skip to content

Commit

Permalink
Add comment about TraceState class
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 committed Jun 26, 2019
1 parent 930c7e6 commit e21d549
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/opentelemetry-core/src/trace/TraceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ const MAX_TRACE_STATE_LEN = 512;
const LIST_MEMBERS_SEPARATOR = ',';
const LIST_MEMBER_KEY_VALUE_SPLITTER = '=';

/**
* TraceState must be a class and not a simple object type because of the spec
* requirement (https://www.w3.org/TR/trace-context/#tracestate-field).
*
* Here is the list of allowed mutations:
* - New key-value pair should be added into the beginning of the list
* - The value of any key can be updated. Modified keys MUST be moved to the
* beginning of the list.
*/
export class TraceState implements types.TraceState {
private _internalState: Map<string, string> = new Map();

Expand Down

0 comments on commit e21d549

Please sign in to comment.