Closed samsp-msft closed 3 months ago
redo of #1967
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 88.57%. Comparing base (
71655ce
) to head (fccfe25
). Report is 386 commits behind head on main.
I can see this is a direct copy of what's in Java and the rudimentary tests show it to work (on windows), but I don't understand the logic to know how this is meant to work.
Also, we'll need to figure out why the tests are failing on ubuntu.
I did some more experimentation, including running in WSL (Ubuntu). I had not accounted for the initial balance in the math in the test - with that, the first N asks will be sampled in as they chew through that balance. With this accounted for the expected value and actual are exact in my personal experiments, but I want to keep a small fudge factor as tests that rely on timing don't always work out the way you expect them to.
@cijothomas the ubuntu run should pass tests now.
@cijothomas - poke 😸
Port of https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/jaeger-remote-sampler/src/main/java/io/opentelemetry/sdk/extension/trace/jaeger/sampler/RateLimitingSampler.java to .NET
The rate limiting sampler is a sampler that will limit the number of traces to the specified rate per second. It is typically used in conjunction with the ParentBasedSampler to ensure that the rate limiting sampler is only applied to the root spans. If a request comes in without a sampling decision, the rate limiting sampler will make a decision based on the rate limit. The sampling decision is stored in the activity context, via the Recorded property, and is passed along with calls to other services called with HttpClient so the same decision is used for the entire trace.
Example of RateLimitingSampler usage:
Changes
Please provide a brief description of the changes here.
Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes