Skip to content

Conversation

@jj22ee
Copy link
Contributor

@jj22ee jj22ee commented Mar 19, 2025

Description

This is an initial PR to address #1434 in order for OTel Ruby to support X-Ray Remote Sampling. A series of PRs to fully implement this feature will follow this one.

Changes:

  • Add new package directory sampler/xray/lib/opentelemetry-sampler-xray.rb
  • Updated the OTel Contrib workflow to also run tests for this xray sampler gem
  • Code changes:
    • Add Sampling Client class to communicate with X-Ray Service for Sampling Rules/Targets
    • Add X-Ray Sampling Rules/Statistics related classes to help represent the Sampling data from X-Ray
    • Added the AWSXRayRemoteSampler skeleton class
      • Ensure AWSXRayRemoteSampler is a ParentBased Sampler, with internal logic inside InternalAWSXRayRemoteSampler
      • Run poller upon instantiation to regularly obtain X-Ray Sampling Rules from X-Ray

Testing

  • Unit Tests
  • This PR is not a full implementation of the sampler, so it cannot be tested for correct x-ray sampling functionality.
    Right now, it currently always return a Parent Based decision or a DROP decision as a placeholder.
  • A couple more PRs will follow-up to complete the implementation, which should look like this Sampler code from my fork. At that point in the future, a full E2E integration test will be run.

@jj22ee jj22ee changed the title AWS X-Ray Remote Sampler Part 1 - Initial Classes and Rules Poller Implementation feat: AWS X-Ray Remote Sampler Part 1 - Initial Classes and Rules Poller Implementation Mar 19, 2025
@jj22ee
Copy link
Contributor Author

jj22ee commented Mar 25, 2025

@kaylareopelle I've made the initial PR for X-Ray Sampler, will try to get someone from AWS who is familiar with X-Ray Sampling to help with the review.
Just not sure who can help review from OTel Ruby side since this is a new component.

@kaylareopelle
Copy link
Contributor

Hi @jj22ee, sorry about the delay in response on this one. Getting help from someone from AWS with X-Ray sampling experience would be a huge help. I can take care of the review for the parts related to adding new gems to this repo.

@jj22ee
Copy link
Contributor Author

jj22ee commented Apr 15, 2025

Will be getting help from @lukeina2z for X-Ray Sampler logic review.

module Utils
module_function

CLOUD_PLATFORM_MAPPING = {

Choose a reason for hiding this comment

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

This list does not match service type from the console. Let's say step fn is not listed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We won't include all services that are listed from X-Ray Sampling console. Services like APIGW and StepFn has their own dedicated Sampler logic that cannot be configured with OTel Ruby SDK. So this means we only have to care about the other cases like ebs, ec2, ecs, and eks.

Technically we should exclude Lambda too from this list because Lambda's sampling in not configurable, but I believe we include it in the sampler for all other languages for potential future-proofing for when Lambda may support Remote Sampling.

@kaylareopelle
Copy link
Contributor

Thanks, @lukeina2z for taking a look! And also, thank you, @jj22ee for submitting this PR. Looking forward to the next one!

@kaylareopelle kaylareopelle merged commit 26b6e2a into open-telemetry:main Apr 21, 2025
61 checks passed
yiyuan-he pushed a commit to yiyuan-he/opentelemetry-ruby-contrib that referenced this pull request Apr 30, 2025
…ler Implementation (open-telemetry#1453)

* AWS X-Ray Remote Sampler Part 1 - Initial Classes and Rules Poller Implementation

* fix workflow job name, fix jruby step

* update logging for utils

* bump rubocop and rubocop-performance gem versions

* update version and dep version

---------

Co-authored-by: Kayla Reopelle <[email protected]>
yiyuan-he pushed a commit to yiyuan-he/opentelemetry-ruby-contrib that referenced this pull request May 14, 2025
…ler Implementation (open-telemetry#1453)

* AWS X-Ray Remote Sampler Part 1 - Initial Classes and Rules Poller Implementation

* fix workflow job name, fix jruby step

* update logging for utils

* bump rubocop and rubocop-performance gem versions

* update version and dep version

---------

Co-authored-by: Kayla Reopelle <[email protected]>
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.

3 participants