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

feat: OpenTracing propagator #318

Merged
merged 21 commits into from
Jan 29, 2021
Merged

Conversation

mwear
Copy link
Member

@mwear mwear commented Jan 22, 2021

Which problem is this PR solving?

  • This adds support for the semi-official OpenTracing (aka ot-tracer) header format.

Short description of the changes

@mwear mwear requested a review from a team January 22, 2021 22:19
@codecov
Copy link

codecov bot commented Jan 22, 2021

Codecov Report

Merging #318 (72c4e07) into main (2319ae8) will increase coverage by 0.04%.
The diff coverage is 97.27%.

@@            Coverage Diff             @@
##             main     #318      +/-   ##
==========================================
+ Coverage   95.44%   95.48%   +0.04%     
==========================================
  Files         115      119       +4     
  Lines        6126     6273     +147     
  Branches      597      609      +12     
==========================================
+ Hits         5847     5990     +143     
- Misses        279      283       +4     
Impacted Files Coverage Δ
.../opentelemetry-propagator-opentracing/.eslintrc.js 0.00% <0.00%> (ø)
...pentelemetry-propagator-opentracing/src/version.ts 0.00% <0.00%> (ø)
...ropagator-opentracing/src/OpenTracingPropagator.ts 95.83% <95.83%> (ø)
...tor-opentracing/test/OpenTracingPropagator.test.ts 100.00% <100.00%> (ø)

export const OT_SAMPLED_HEADER = 'ot-tracer-sampled';
export const OT_BAGGAGE_PREFIX = 'ot-baggage-';

const FIELDS = [OT_TRACE_ID_HEADER, OT_SPAN_ID_HEADER, OT_SAMPLED_HEADER];
Copy link
Member

Choose a reason for hiding this comment

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

The multi-header baggage breaks the fields usecase. Clearing fields out of an object won't work if we don't know all the fields that were used. Saving used fields might result in a memory leak. Not sure how to resolve this. It should at least be documented.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment further down above the fields() method.

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 this should be also mentioned in readme similar as the restrictions regarding traceId which are already there.

Copy link
Member

Choose a reason for hiding this comment

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

can we do opposite then, keep the names of fields that should be there and clear all the rest that are not on that list?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think that we actually use the fields method in the API or SDK, but it is there for users or instrumentation authors to use. I documented the special case on the readme. The specification seems to hint at this possibility as well:

Observe that some Propagators may define, besides the returned values, additional fields with variable names. To get a full list of fields for a specific carrier object, use the Keys operation.

From https:/open-telemetry/opentelemetry-specification/blob/master/specification/context/api-propagators.md#fields

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

lgtm

Base automatically changed from master to main January 27, 2021 22:21
@mwear mwear mentioned this pull request Jan 28, 2021
@dyladan dyladan added the enhancement New feature or request label Jan 29, 2021
@dyladan dyladan merged commit d59bd00 into open-telemetry:main Jan 29, 2021
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.

5 participants