Skip to content

Commit

Permalink
fix: make TraceState immutable (open-telemetry#1597)
Browse files Browse the repository at this point in the history
  • Loading branch information
Flarna authored and dyladan committed Feb 18, 2021
1 parent 67d5781 commit ede3838
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions api/src/trace/trace_state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,25 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export interface TraceState {
/**
* Adds or updates the TraceState that has the given `key` if it is
* present. The new State will always be added in the front of the
* list of states.
* Create a new TraceState which inherits from this TraceState and has the
* given key set.
* The new entry will always be added in the front of the list of states.
*
* @param key key of the TraceState entry.
* @param value value of the TraceState entry.
*/
set(key: string, value: string): void;
set(key: string, value: string): TraceState;

/**
* Removes the TraceState Entry that has the given `key` if it is present.
* Return a new TraceState which inherits from this TraceState but does not
* contain the given key.
*
* @param key the key for the TraceState Entry to be removed.
* @param key the key for the TraceState entry to be removed.
*/
unset(key: string): void;
unset(key: string): TraceState;

/**
* Returns the value to which the specified key is mapped, or `undefined` if
Expand Down

0 comments on commit ede3838

Please sign in to comment.