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

Add TraceState to SpanContext #217

Merged
merged 14 commits into from
Sep 17, 2020

Conversation

awiede
Copy link

@awiede awiede commented Sep 12, 2020

Resolves #211

Adds TraceState to SpanContext and gives TraceState new methods per spec.

Andreas Wiede added 4 commits September 12, 2020 09:56
Initial creation of TraceState type.
Add tests for TraceState.
Clean up unit tests.
Add trace state to propagators.
@awiede awiede requested a review from a team September 12, 2020 14:00
Andreas Wiede added 2 commits September 12, 2020 10:12
Dummy commit.
Clean up base64 test.
Copy link
Member

@jtescher jtescher left a comment

Choose a reason for hiding this comment

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

Great start @awiede! added a few ideas for potential allocation improvements

Andreas Wiede added 3 commits September 14, 2020 10:09
Address PR comments.
Clean up TraceState to not use a hashmap. Update from_kv method to use
iterator.
Export TraceState and add example for from_key_value.
@awiede
Copy link
Author

awiede commented Sep 14, 2020

@jtescher - I think I addressed all of your comments. RE: using a BTreeMap, I don't think that will work since we aren't sorting on the keys, but instead on the insertion order. Given that this should be a relatively small data set, I updated to just use an ordered collection of tuples. TraceState::get is now O(n) instead O(constant), but given the limitations on the size of tracestate itself (I think the spec says 32 elements), I don't know if that's a big deal.

@awiede awiede requested a review from jtescher September 14, 2020 14:59
Copy link
Member

@jtescher jtescher left a comment

Choose a reason for hiding this comment

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

@awiede yeah that makes sense I hadn't read the spec all that closely 😬, looked it over and noticed a few other changes we may want to do

Andreas Wiede added 5 commits September 14, 2020 16:57
Clean up trace state methods.
Validate keys and values.
Validate inputs on TraceState creation.
Make modification methods `Fn`.
Restrict tracestate keys to lowercase.
@awiede awiede requested a review from jtescher September 15, 2020 18:00
@awiede
Copy link
Author

awiede commented Sep 15, 2020

@jtescher updated to Fn for insert and delete. Spec technically says that keys should be lowercase which leads to some annoying conflicts with the AWS propagator. I think it's fine for now since the AWS reserved keys only capitalize the first character, custom camel cased keys might get hairy.

Copy link
Member

@jtescher jtescher left a comment

Choose a reason for hiding this comment

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

Looks good thanks @awiede

@jtescher jtescher merged commit 5eacf03 into open-telemetry:master Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add TraceState operations
2 participants