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

left-pad 64-bit B3 trace IDs #698

Merged
merged 5 commits into from May 5, 2020
Merged

Conversation

Aneurysm9
Copy link
Member

Fixes #686.

@lizthegrey
Copy link
Member

sorry about the spam, editing from github web ui is annoying, but handy in a pinch

@lizthegrey lizthegrey merged commit 0a9b2e0 into open-telemetry:master May 5, 2020
@Aneurysm9 Aneurysm9 deleted the 64bitB3 branch May 5, 2020 19:11
@@ -88,8 +88,15 @@ func (b3 B3) Extract(ctx context.Context, supplier propagation.HTTPSupplier) con
return ContextWithRemoteSpanContext(ctx, sc)
}

func fixB3TID(in string) string {
if len(in) == 16 {
in = strings.Repeat("0", 16) + in
Copy link
Contributor

Choose a reason for hiding this comment

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

Using a const here instead of strings.Repeat would be good for a future pass. There's a lot going on in Repeat.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I initially had strings.Repeat("0", 32-len(in)) but that failed the tests for invalid input IDs between 16 and 32 hex digits. I think it's more correct to only accept 16 or 32 hex digit values.

Copy link
Member Author

Choose a reason for hiding this comment

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

copybaranaut pushed a commit to pixie-io/pixie that referenced this pull request May 25, 2022
Summary:
OTel wants all trace ids to be 128bit.
However b3 trace ids can be 64 bit. See https://github.com/openzipkin/b3-propagation#traceid-1

So we should also support propagating 64 bit trace IDs. To ensure compatibility
with other OTel tooling, we left pad the trace IDs with zeroes and make it a
128 bit ID before passing it to the OTel endpoint. This mirrors the approach
taken by open-telemetry/opentelemetry-go#698

Test Plan:
Updated a test to use 64 bit trace ids and ensured that they get
left padded with zeroes as expexted.

Reviewers: nserrino, michelle, philkuz

Reviewed By: philkuz

JIRA Issues: PP-3407

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D11450

GitOrigin-RevId: 9f09a7e
orishuss pushed a commit to orishuss/pixie that referenced this pull request Jul 14, 2022
Summary:
OTel wants all trace ids to be 128bit.
However b3 trace ids can be 64 bit. See https://github.com/openzipkin/b3-propagation#traceid-1

So we should also support propagating 64 bit trace IDs. To ensure compatibility
with other OTel tooling, we left pad the trace IDs with zeroes and make it a
128 bit ID before passing it to the OTel endpoint. This mirrors the approach
taken by open-telemetry/opentelemetry-go#698

Test Plan:
Updated a test to use 64 bit trace ids and ensured that they get
left padded with zeroes as expexted.

Reviewers: nserrino, michelle, philkuz

Reviewed By: philkuz

JIRA Issues: PP-3407

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D11450

GitOrigin-RevId: 9f09a7e
orishuss pushed a commit to orishuss/pixie that referenced this pull request Jul 14, 2022
Summary:
OTel wants all trace ids to be 128bit.
However b3 trace ids can be 64 bit. See https://github.com/openzipkin/b3-propagation#traceid-1

So we should also support propagating 64 bit trace IDs. To ensure compatibility
with other OTel tooling, we left pad the trace IDs with zeroes and make it a
128 bit ID before passing it to the OTel endpoint. This mirrors the approach
taken by open-telemetry/opentelemetry-go#698

Test Plan:
Updated a test to use 64 bit trace ids and ensured that they get
left padded with zeroes as expexted.

Reviewers: nserrino, michelle, philkuz

Reviewed By: philkuz

JIRA Issues: PP-3407

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D11450

GitOrigin-RevId: 9f09a7e
orishuss pushed a commit to orishuss/pixie that referenced this pull request Jul 14, 2022
Summary:
OTel wants all trace ids to be 128bit.
However b3 trace ids can be 64 bit. See https://github.com/openzipkin/b3-propagation#traceid-1

So we should also support propagating 64 bit trace IDs. To ensure compatibility
with other OTel tooling, we left pad the trace IDs with zeroes and make it a
128 bit ID before passing it to the OTel endpoint. This mirrors the approach
taken by open-telemetry/opentelemetry-go#698

Test Plan:
Updated a test to use 64 bit trace ids and ensured that they get
left padded with zeroes as expexted.

Reviewers: nserrino, michelle, philkuz

Reviewed By: philkuz

JIRA Issues: PP-3407

Signed-off-by: Vihang Mehta <vihang@pixielabs.ai>

Differential Revision: https://phab.corp.pixielabs.ai/D11450

GitOrigin-RevId: 9f09a7e
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.

B3 Propagator doesn't handle 64-bit TraceIDs
4 participants