Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make TraceState immutable #1597

Merged

Conversation

Flarna
Copy link
Member

@Flarna Flarna commented Oct 15, 2020

Which problem is this PR solving?

Spec requires that TraceState is immutable.
Fixes: #1596

Short description of the changes

Adapt TraceState API to return a TraceState for set/unset.
Adapt implementation of set/unset to clone the TraceState before mutating and return the cloned TraceState.

Spec requires that TraceState is immutable.

Adapt TraceState API to return a TraceState for set/unset.
Adapt implementation of set/unset to clone the TraceState before
mutating and return the cloned TraceState.
@Flarna Flarna force-pushed the immuteable-tracestate branch from 0a0c5fe to 5e412ac Compare October 15, 2020 09:20
@codecov
Copy link

codecov bot commented Oct 15, 2020

Codecov Report

Merging #1597 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1597      +/-   ##
==========================================
+ Coverage   91.18%   91.19%   +0.01%     
==========================================
  Files         164      164              
  Lines        5024     5033       +9     
  Branches     1026     1026              
==========================================
+ Hits         4581     4590       +9     
  Misses        443      443              
Impacted Files Coverage Δ
...ackages/opentelemetry-core/src/trace/TraceState.ts 100.00% <100.00%> (ø)

Copy link
Member

@dyladan dyladan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised only 3 files need to change. Is tracestate never updated anywhere?

@Flarna
Copy link
Member Author

Flarna commented Oct 15, 2020

I am surprised only 3 files need to change. Is tracestate never updated anywher

I was also surprised. Seems noone is using it. This explains that it was not noticed that it is not spec conform.

@dyladan dyladan added the enhancement New feature or request label Oct 21, 2020
@@ -25,30 +25,30 @@ describe('TraceState', () => {
});

it('must replace keys and move them to the front', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should update the description and mention that, "creates a new tracestate and replace..." WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@dyladan dyladan merged commit cd8e77b into open-telemetry:master Oct 22, 2020
@dyladan dyladan deleted the immuteable-tracestate branch October 22, 2020 13:23
dyladan pushed a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
dyladan pushed a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TraceState is mutated instead returning a new TraceState
4 participants