Skip to content

Conversation

@slashmo
Copy link
Member

@slashmo slashmo commented Oct 30, 2020

As part of an effort to enabling mutation of the sampled flag, I refactored traceParent.traceFlags to use an OptionSet. Because the W3C Trace Context spec only supports TraceFlags.sampled at this point, parent.traceFlags cannot be mutated directly. Instead, TraceContext itself now has a get/set sampled property that internally retrieves from/writes to parent.traceFlags.

When parsing TraceParent from its String representation, any traceFlags value higher than 01 will be ignored and traceFlags default to 00 (not sampled), as required in the spec:

The behavior of other flags, such as (00000100) is not defined and is reserved for future use. Vendors MUST set those to zero.

@slashmo slashmo added the enhancement New feature or request label Oct 30, 2020
@slashmo slashmo self-assigned this Oct 30, 2020
@slashmo
Copy link
Member Author

slashmo commented Oct 30, 2020

@ktoso I'd be very interested in your opinion of this implementation 🙂

@ktoso
Copy link
Contributor

ktoso commented Oct 31, 2020

Skimming it now and I think it looks good! I will give it another look once I get my hands on a MacBook later :)

@slashmo
Copy link
Member Author

slashmo commented Oct 31, 2020

@ktoso Thanks for the review 👍

@slashmo slashmo merged commit 3ae6490 into main Oct 31, 2020
@slashmo slashmo deleted the feature/trace-flags-type branch October 31, 2020 16:35
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.

3 participants