Skip to content

Commit be1090b

Browse files
Flarnadyladan
authored andcommitted
fix: make TraceState immutable (open-telemetry#1597)
1 parent 9f672fd commit be1090b

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

api/src/trace/trace_state.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
export interface TraceState {
1718
/**
18-
* Adds or updates the TraceState that has the given `key` if it is
19-
* present. The new State will always be added in the front of the
20-
* list of states.
19+
* Create a new TraceState which inherits from this TraceState and has the
20+
* given key set.
21+
* The new entry will always be added in the front of the list of states.
2122
*
2223
* @param key key of the TraceState entry.
2324
* @param value value of the TraceState entry.
2425
*/
25-
set(key: string, value: string): void;
26+
set(key: string, value: string): TraceState;
2627

2728
/**
28-
* Removes the TraceState Entry that has the given `key` if it is present.
29+
* Return a new TraceState which inherits from this TraceState but does not
30+
* contain the given key.
2931
*
30-
* @param key the key for the TraceState Entry to be removed.
32+
* @param key the key for the TraceState entry to be removed.
3133
*/
32-
unset(key: string): void;
34+
unset(key: string): TraceState;
3335

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

0 commit comments

Comments
 (0)