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

Added changes to AWSXRayPropagator #2359

Merged
merged 3 commits into from
Dec 9, 2024
Merged

Conversation

AsakerMohd
Copy link
Contributor

@AsakerMohd AsakerMohd commented Dec 5, 2024

Changes

While doing some auto instrumentation testing, we found that adding the AWSXRayPropagator and AWS SDK instrumentation causes a conflict with the propagated X-Amzn-Trace-Id . This is a header that is used to propagate X-Ray trace context for trace linking. Lets assume we have an application that makes a call to AWS S3. There will be 2 activities in this case, the S3 activity created by the instrumentation Amazon.AWS.AWSClientInstrumentation and then a System.Net.Http.HttpRequestOut activity which is an http call to s3.amazonaws.com. The issue here is that when the httpRequest is created, the AWS SDK injects the traceHeader where the traceId and parent id is set to the Amazon.AWS.AWSClientInstrumentation S3 activity. However, since System.Net.Http.HttpRequestOut is the last outgoing call, the propagator injects the traceHeader from HttpRequestOut, basically overwriting the previous context.

To overcome this, a change is made is made so that If X-Amzn-Trace-Id already exists in the headers and the carrier is of HttpRequestMessage, This means that the request is coming from the AWS SDK Instrumentation library and in this case, we don't want to overwrite the propagation context from the AWS SDK Span with the context from the outgoing HttpRequestOut.

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)

@AsakerMohd AsakerMohd requested a review from a team as a code owner December 5, 2024 04:57
@github-actions github-actions bot requested review from ppittle and srprash December 5, 2024 04:57
@github-actions github-actions bot added the comp:extensions.aws Things related to OpenTelemetry.Extensions.AWS label Dec 5, 2024
Copy link

codecov bot commented Dec 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.39%. Comparing base (71655ce) to head (c78563f).
Report is 642 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #2359       +/-   ##
===========================================
+ Coverage   73.91%   86.39%   +12.48%     
===========================================
  Files         267       34      -233     
  Lines        9615      897     -8718     
===========================================
- Hits         7107      775     -6332     
+ Misses       2508      122     -2386     
Flag Coverage Δ
unittests-Instrumentation.AWS 86.39% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...elemetry.Extensions.AWS/Trace/AWSXRayPropagator.cs 81.10% <100.00%> (+1.59%) ⬆️

... and 273 files with indirect coverage changes

@AsakerMohd AsakerMohd force-pushed the main branch 3 times, most recently from 82b6a23 to 85931f7 Compare December 5, 2024 06:04
@Kielek
Copy link
Contributor

Kielek commented Dec 6, 2024

Please double check if it does not require changelog entry. Based on the answer, it can be merged as is.

@AsakerMohd
Copy link
Contributor Author

Please double check if it does not require changelog entry. Based on the answer, it can be merged as is.

Yes it doesn't require any changelog entry so can be merged as is.

Copy link
Contributor

@Kielek Kielek left a comment

Choose a reason for hiding this comment

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

Approving/merging based on @ppittle review.

@Kielek Kielek merged commit 92b48e1 into open-telemetry:main Dec 9, 2024
60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:extensions.aws Things related to OpenTelemetry.Extensions.AWS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants