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

Add getter and setter arguments to propagation API #827

Merged
merged 11 commits into from
Mar 5, 2020

Conversation

@dyladan dyladan added enhancement New feature or request API labels Mar 2, 2020
@dyladan dyladan added this to the Beta milestone Mar 2, 2020
@dyladan dyladan mentioned this pull request Mar 2, 2020
46 tasks
@codecov-io
Copy link

codecov-io commented Mar 2, 2020

Codecov Report

Merging #827 into master will decrease coverage by 1.91%.
The diff coverage is 80.64%.

@@            Coverage Diff             @@
##           master     #827      +/-   ##
==========================================
- Coverage   94.47%   92.55%   -1.92%     
==========================================
  Files         249      251       +2     
  Lines       11005    10977      -28     
  Branches     1059     1061       +2     
==========================================
- Hits        10397    10160     -237     
- Misses        608      817     +209
Impacted Files Coverage Δ
...-api/test/noop-implementations/noop-tracer.test.ts 47.82% <0%> (-52.18%) ⬇️
...s/opentelemetry-core/test/context/B3Format.test.ts 47.57% <100%> (-52.43%) ⬇️
...try-propagator-jaeger/src/JaegerHttpTraceFormat.ts 96.42% <100%> (ø) ⬆️
...elemetry-core/src/context/propagation/composite.ts 100% <100%> (ø) ⬆️
...-api/src/context/propagation/NoopHttpTextFormat.ts 100% <100%> (ø) ⬆️
...y-core/src/context/propagation/HttpTraceContext.ts 100% <100%> (ø) ⬆️
.../opentelemetry-core/test/context/composite.test.ts 96.42% <100%> (+0.06%) ⬆️
...lemetry-core/test/context/HttpTraceContext.test.ts 100% <100%> (ø) ⬆️
...opagator-jaeger/test/JaegerHttpTraceFormat.test.ts 100% <100%> (ø) ⬆️
...ackages/opentelemetry-shim-opentracing/src/shim.ts 84.25% <100%> (+0.14%) ⬆️
... and 70 more

* @param context Context carrying tracing data to inject. Defaults to the currently active context.
*/
public inject(carrier: Carrier, context = contextApi.active()): void {
return this._propagator.inject(context, carrier);
public inject<Carrier = any>(
Copy link
Member

Choose a reason for hiding this comment

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

would it be better to put unknown instead of any if we need to modify those functions later ?

Copy link
Member Author

Choose a reason for hiding this comment

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

1c06785 what about this?

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

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

Nice! Added a few comments.

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

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

lgtm

@mayurkale22
Copy link
Member

@open-telemetry/javascript-approvers we need more reviews on this!

* @param context Context carrying tracing data to inject. Defaults to the currently active context.
*/
public inject(carrier: Carrier, context = contextApi.active()): void {
return this._propagator.inject(context, carrier);
public inject<Carrier>(
Copy link
Member

Choose a reason for hiding this comment

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

why the order of params has changed ? I see later the order is correct (carrier, context, setter)

Copy link
Member Author

Choose a reason for hiding this comment

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

It is based on which arguments are most likely to be omitted. The most common use case is extract(carrier), the second most common is extract(carrier, getter), the third most common is extract(carrier, getter, context).

The order of the actual propagator itself has context first because that was the order before. Originally, before the global API, it was inject(spanContext, format, carrier). Format has been removed, but the other order was preserved.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm I'm a bit confused with this as for for interface HttpTextFormat the order is (carrier, context, setter/getter), maybe I'm wrong but my understanding is that it should be the same in both cases ?

Copy link
Member Author

Choose a reason for hiding this comment

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

One is the order of the public API, which I have ordered for the reasons above (some arguments optional and unlikely to be used). The other is the order of the interface, which accepts all arguments. I kept the order of the interface for now, but it can be made consistent in a future PR if we want.

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

@dyladan dyladan merged commit 5c4c57e into open-telemetry:master Mar 5, 2020
@dyladan dyladan deleted the getter-setter branch March 5, 2020 19:01
dyladan added a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
* feat: add getter and setter arguments to propagation API

* chore: add getter and setter to composite propagator
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
* feat: add getter and setter arguments to propagation API

* chore: add getter and setter to composite propagator
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
* docs: readme instrumentations aws-sdk and fastify
* docs: add instrumentation-long-task to readme
* docs: sort web instrumentations alphbetically
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.

Propagator interface missing Setter and Getter arguments
5 participants