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(propagator-jaeger):extract 1 digit traceFlag(0) return 1 #2906

Merged
merged 7 commits into from
Apr 24, 2022

Conversation

shmilyoo
Copy link
Contributor

Which problem is this PR solving?

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

Fixes # (issue)

Short description of the changes

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • add a test case "should extract context of a sampled span from carrier with 1 bit flag(0)"
  • rename "should extract context of a sampled span from carrier with 1 bit flag" to "should extract context of a sampled span from carrier with 1 bit flag(1)"

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@shmilyoo shmilyoo requested a review from a team April 19, 2022 07:25
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Apr 19, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@codecov
Copy link

codecov bot commented Apr 19, 2022

Codecov Report

Merging #2906 (4a7ca04) into main (a0a670a) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main    #2906   +/-   ##
=======================================
  Coverage   92.81%   92.81%           
=======================================
  Files         184      184           
  Lines        6066     6066           
  Branches     1296     1296           
=======================================
  Hits         5630     5630           
  Misses        436      436           
Impacted Files Coverage Δ
...elemetry-propagator-jaeger/src/JaegerPropagator.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.

LGTM. Please fix the linting errors and make a CHANGELOG entry and this can be merged.

@shmilyoo
Copy link
Contributor Author

@dyladan CHANGELOG done

@shmilyoo
Copy link
Contributor Author

@dyladan lint fixed

@@ -159,7 +159,7 @@ describe('JaegerPropagator', () => {
});
});

it('should extract context of a sampled span from carrier with 1 bit flag', () => {
it('should extract context of a sampled span from carrier with 1 bit flag(1)', () => {
Copy link
Member

Choose a reason for hiding this comment

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

nit: What does it mean "1 bit flag"? Should it say "1 hex digit flag" or "1 character flag"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, the original test description string is a bit ambiguous.
I think it would be more accurate to use "a single digit character" to describe this, right?

Copy link
Member

Choose a reason for hiding this comment

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

I think it is "with flag 1 set" and 1 is just the example. Could easily have been 3

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is there anything else I can do?
There are very few flag bits that can cause problems in production

Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
it('should extract context of a sampled span from carrier with 1 bit flag(1)', () => {
it('should extract context of a sampled span from carrier with sampled bit (bit 1) set', () => {

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I think the essence of the test is to check that the flags work when encoded with a single hex character (the thing this PR fixes).
The previous test ("should extract context of a sampled span from carrier") covers the case where flags are 2 digits.

I am good with any name, it's really a nit, don't want to block anything.
If you change the name, please do it also for the other (new) test as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree
This is just a description issue, and any developer who sees this test case will not misunderstand it.
We need to solve the problem that the traceFlag length can be 1 and 2 because of the standard definition and compatibility.
In fact, there are four possible values, 0/00/01/1. If some value such as 02 or 2 appear, it is not the library's problem, but the developer's problem who generated the trace header

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand.
The PR is great, I only suggested improving the test name as it is currently not very clear.
If you want to do it - amazing. If not, let's merge it as is :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

let's merge it as is :)

@blumamir blumamir merged commit 4584c36 into open-telemetry:main Apr 24, 2022
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.

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