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

Now MultiTextMapPropagator allows to select extractors and injectors separately #3366

Closed

Conversation

slinkydeveloper
Copy link

@slinkydeveloper slinkydeveloper commented Jul 2, 2021

Fix #3364

This PR includes:

  • A patch for MultiTextMapPropagator to select extractors and injectors separately, also rename the class to CompositeTextMapPropagator
  • The builder CompositeTextMapPropagatorBuilder
  • Unit test

Signed-off-by: Francesco Guardiani [email protected]

Signed-off-by: Francesco Guardiani <[email protected]>
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Jul 2, 2021

CLA Signed

The committers are authorized under a signed CLA.

@jkwatson
Copy link
Contributor

jkwatson commented Jul 2, 2021

@slinkydeveloper this proposed change includes additions to stable public APIs. Can you run ./gradlew build and include the changes in doc/apidiffs in this PR so we can examine and document what public API changes you are proposing? Thanks!

Signed-off-by: Francesco Guardiani <[email protected]>
Signed-off-by: Francesco Guardiani <[email protected]>
Signed-off-by: Francesco Guardiani <[email protected]>
Signed-off-by: Francesco Guardiani <[email protected]>
@slinkydeveloper
Copy link
Author

Pushed the doc changes as well

@slinkydeveloper slinkydeveloper requested a review from anuraaga July 5, 2021 08:18
Copy link
Contributor

@anuraaga anuraaga left a comment

Choose a reason for hiding this comment

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

Thanks!

this.injectors = new TextMapPropagator[injectors.size()];
injectors.toArray(this.injectors);

this.allFields = Collections.unmodifiableList(getAllFields(this.injectors));
Copy link
Contributor

Choose a reason for hiding this comment

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

is this right? The fields are only from the injectors? I think this might need to be the union of the extractors and injectors, rather than just the injectors.

Copy link
Author

Choose a reason for hiding this comment

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

That's not what I understood from the fields() javadoc, it rather seems to me that method is used only when writing the context back to the wire, and not while extracting it...

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the javadoc provides that as a usage (to clear out headers if the header implementation is re-used), but I think fields() could also be used by extraction in some cases. I'm honestly not 100% sure what the behavior should be in this case when injection doesn't necessarily match extraction.

Copy link
Contributor

Choose a reason for hiding this comment

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

I created a spec issue for this, since I don't think I know what the answer should be: open-telemetry/opentelemetry-specification#1809

Copy link

Choose a reason for hiding this comment

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

I second @jkwatson with this - I know at least one case in instrumentation where fields are considered during extraction (see io.opentelemetry.instrumentation.awslambda.v1_0.TracingRequestStreamHandler)

Copy link
Contributor

Choose a reason for hiding this comment

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

Please comment on the spec issue. :)

Copy link

Choose a reason for hiding this comment

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

Weighting issues - sub-optimal performance vs actual bug I'd say that keeping all fields still wins. But yeah, spec issue is the proper place to discuss this.

Copy link
Member

Choose a reason for hiding this comment

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

@kubawach please provide a permalink to your example of TracingRequestStreamHandler, I couldn't find it.

Copy link

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

@kubawach thanks. If I am reading this correctly, I wouldn't classify this usage as "on the extract path", and I probably would've implemented that check differently in the first place, the use of fields() to determine "noHttpPropagationNeeded" seems a bit round-about. Here's the exact usage link, for reference:

https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/1b5df6d78a6877dab38f573b44d0358927d1ab3d/instrumentation/aws-lambda-1.0/library/src/main/java/io/opentelemetry/instrumentation/awslambda/v1_0/ApiGatewayProxyRequest.java#L27

@codecov
Copy link

codecov bot commented Jul 9, 2021

Codecov Report

Merging #3366 (27b4eda) into main (fffc831) will increase coverage by 90.96%.
The diff coverage is 96.96%.

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #3366       +/-   ##
===========================================
+ Coverage        0   90.96%   +90.96%     
- Complexity      0     3172     +3172     
===========================================
  Files           0      364      +364     
  Lines           0     9794     +9794     
  Branches        0      983      +983     
===========================================
+ Hits            0     8909     +8909     
- Misses          0      585      +585     
- Partials        0      300      +300     
Impacted Files Coverage Δ
...propagation/CompositeTextMapPropagatorBuilder.java 94.11% <94.11%> (ø)
...ontext/propagation/CompositeTextMapPropagator.java 100.00% <100.00%> (ø)
...lemetry/context/propagation/TextMapPropagator.java 100.00% <100.00%> (ø)
...dk/metrics/export/IntervalMetricReaderBuilder.java 92.85% <0.00%> (ø)
.../opentelemetry/api/baggage/propagation/Parser.java 98.18% <0.00%> (ø)
...opentelemetry/sdk/metrics/data/MetricDataType.java 100.00% <0.00%> (ø)
...y/sdk/trace/samplers/TraceIdRatioBasedSampler.java 85.71% <0.00%> (ø)
...a/io/opentelemetry/api/baggage/ImmutableEntry.java 100.00% <0.00%> (ø)
...i/trace/propagation/W3CTraceContextPropagator.java 98.24% <0.00%> (ø)
...a/io/opentelemetry/sdk/trace/SdkTracerBuilder.java 100.00% <0.00%> (ø)
... and 357 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fffc831...27b4eda. Read the comment docs.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Definition of fields with separate injectors / extractors needs clarification before merging.

@jkwatson jkwatson added the blocked:spec blocked on open or unresolved spec label Jul 9, 2021
@jkwatson jkwatson removed the request for review from tylerbenson April 8, 2022 17:26
@github-actions
Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jun 22, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2022

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Jul 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked:spec blocked on open or unresolved spec Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Composite extractors and injectors
4 participants