Skip to content

[aws-xray] Update SamplerRulesApplier to recognize new HTTP/URL semconv. #1959

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

Merged
merged 14 commits into from
Jul 23, 2025

Conversation

AsakerMohd
Copy link
Contributor

Description:
The HTTP/URL semantic conventions were updated making the X-Ray Sampler outdated since it only recognizes the older HTTP semantic conventions. I've updated the SamplingRuleApplier to look at both the old and new conventions for backwards compatibility.

Testing:
Updated unit tests and are now passing.

Manual Testing:

For the manual testing. I created three sampling rules in the X-Ray console

  1. Default one with zero sampling
  2. Second one with path = /aws-sdk-call with 100% sampling
  3. Third one with path = /outgoing-http-call with 100% sampling

I used a sample app with two APIs:

  1. /outgoing-http-call
  2. /aws-sdk-call

Before the change, calling any of the above APIs wasn't being matched when it should. After the change, the rules were being matched and each rule showed the correct stats.

Before the change:
Screenshot 2025-06-01 at 11 34 56 PM

After the change:
Screenshot 2025-06-01 at 11 29 54 PM

@AsakerMohd AsakerMohd requested a review from a team June 12, 2025 04:03
httpTarget = (String) entry.getValue();
} else if (entry.getKey().equals(HTTP_URL)) {
} else if (entry.getKey().equals(HTTP_URL) || entry.getKey().equals(UrlAttributes.URL_FULL)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

server instrumentations don't fill url.full, would that be an issue?

Copy link
Contributor Author

@AsakerMohd AsakerMohd Jul 7, 2025

Choose a reason for hiding this comment

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

That should be fine. It's there incase URL_PATH isn't being populated and the idea here is to then extract the path from URL_FULL.

@otelbot-java-contrib
Copy link
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

@otelbot-java-contrib
Copy link
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

@trask trask added this to the v1.48.0 milestone Jul 16, 2025
@otelbot-java-contrib
Copy link
Contributor

🔧 The result from spotlessApply was committed to the PR branch.

@trask trask enabled auto-merge July 22, 2025 01:53
@trask trask added this pull request to the merge queue Jul 23, 2025
Merged via the queue into open-telemetry:main with commit 28d67ea Jul 23, 2025
31 checks passed
Copy link

@mcmho mcmho left a comment

Choose a reason for hiding this comment

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

i ran the test. and also, lgtm.

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.

5 participants