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

propagator-jaeger extract header(traceFlag 0) returned result is incorrect, but traceFlag 1 is ok #2905

Closed
shmilyoo opened this issue Apr 19, 2022 · 0 comments · Fixed by #2906
Labels
bug Something isn't working

Comments

@shmilyoo
Copy link
Contributor

Please answer these questions before submitting a bug report.

What version of OpenTelemetry are you using?

@opentelemetry/propagator-jaeger: 1.0.1

What version of Node are you using?

node 14,16

What did you do?

extract jaeger header, uber-trace-id: '0000000000000000ffc0efb753f8cd38:ffc0efb753f8cd38:0000000000000000:0'
return spanContext
{
traceId: '0000000000000000ffc0efb753f8cd38',
spanId: 'ffc0efb753f8cd38',
isRemote: true,
traceFlags: 1
}

What did you expect to see?

traceFlags should be 0

What did you see instead?

traceFlags is 0

Additional context

if the traceFlag in header is 00, the extract result is right.

I check the code , in packages/opentelemetry-propagator-jaege/src/JaegerPropagator.ts , function deserializeSpanContext

const traceFlags = flags.match(/^[0-9a-f]{2}$/i) ? parseInt(flags) & 1 : 1;

should be

const traceFlags = flags.match(/^[0-9a-f]{1,2}$/i) ? parseInt(flags) & 1 : 1;

We can see the flags define in https://www.jaegertracing.io/docs/1.33/client-libraries/

One byte bitmap, as one or two hex digits (leading zero may be omitted)

And you have also taken into account the 1-digit and 2-digit compatibility, as I have seen in the unit tests

it 'should extract context of a sampled span from carrier with 1 bit flag'

But the test case passes with flag(1), but not with 0.

This causes an exception to the sampling judgment of baseParent. Maybe I can give a PR.

@shmilyoo shmilyoo added the bug Something isn't working label Apr 19, 2022
@dyladan dyladan linked a pull request Apr 19, 2022 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant