Skip to content

feat: AWS X-Ray Remote Sampler Part 3 - Add Rate Limiter and Sampling Targets Poller Logic #1536

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jj22ee
Copy link
Contributor

@jj22ee jj22ee commented May 15, 2025

Description

This is the 3rd and final PR to address #1434 in order for OTel Ruby to support X-Ray Remote Sampling.

Changes:

  • Added logic to fetch sampling targets for each sampling_rule_applier.
    • The sampling targets are periodically fetched every 10 seconds by making the GetSamplingTargets API call to X-Ray.
    • The targets determine the reservoir quota and the rate at which a sampling_rule_applier will sample the requests.
    • Each rule applier keeps and updates a sampling statistics document which is required in GetSamplingTargets call to determine the next target
  • Added a rate_limiting_sampler (applied before the fixed rate sampler) to be used in each rule applier.
    • Together these samplers determine how many requests to sample every second and what percentage of additional requests to sample in that second.
    • The fallback_sampler is updated to be a combination of above samplers to sample 1 req/sec and 5% of additional requests in that second.
  • Added example/xray_sampling_on_rails_demonstration.ru that runs an example rails application that uses the OpenTelemetry X-Ray Sampler, with example instructions in the comments at the bottom of the file.

Testing

@kaylareopelle
Copy link
Contributor

Hi @jj22ee, thanks for your patience. I'll take a look at this PR later today. Will the new gem be ready for release after this PR?

@jj22ee
Copy link
Contributor Author

jj22ee commented Jun 4, 2025

Thanks @kaylareopelle! This new gem will be ready for releasing after this PR.

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.

2 participants