Repository navigation
Conversation
|
|
Pull request dashboard statusWaiting on the author · refreshed 2026-11-09 19:24 UTC Respond to 1 review item (e.g. link a commit, explain why not, ask a follow-up):
Status above doesn't look right?
|
JaegerRemoteSampler built a new sampler from every poll response, even when the strategy had not changed. For a RATE_LIMITING strategy that means a new RateLimiter with a full balance on every poll, so under load each poll lets through up to maxTracesPerSecond extra traces. Remember the last applied response and keep the current sampler when the response bytes are the same. Keeping the limiter state when only the rate changes is left for a follow-up. Part of open-telemetry#2465
df22bfd to
ede2837
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (36.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #8946 +/- ##
============================================
- Coverage 90.65% 90.28% -0.38%
- Complexity 10887 11022 +135
============================================
Files 1015 1021 +6
Lines 29731 30177 +446
Branches 3876 3950 +74
============================================
+ Hits 26953 27245 +292
- Misses 1860 1962 +102
- Partials 918 970 +52 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
|
||
| @GuardedBy("lock") | ||
| @Nullable | ||
| private byte[] lastResponseMessage; |
There was a problem hiding this comment.
Approach makes sense, but let's store the parsed SamplingStrategyResponse and do an equality check against that instead of the raw bytes.
The unchanged check held the last response message and compared bytes, so a semantically identical strategy that happened to be encoded differently would still have replaced the sampler. Give SamplingStrategyResponse and its nested strategies equals/hashCode and keep the last parsed response instead.
|
Done — it now keeps the last parsed That needed It is also stricter than the byte comparison was: two responses that mean the same thing but arrive encoded differently now count as unchanged, where before they would have replaced the sampler.
|
| } | ||
|
|
||
| @Override | ||
| public boolean equals(@Nullable Object o) { |
There was a problem hiding this comment.
Test these new equals/hashcode implementations with equalsverifier. Example: https://github.com/open-telemetry/opentelemetry-java/blob/main/api/all/src/test/java/io/opentelemetry/api/common/AttributeKeyTest.java
Part of #2465
JaegerRemoteSamplerbuilds a new sampler from every poll response, even when the strategy has not changed. For aRATE_LIMITINGstrategy that means a newRateLimiterthat starts with a full balance, so under load each poll (every 60 seconds by default) lets through up tomaxTracesPerSecondextra traces.This change remembers the last applied response and keeps the current sampler when the response bytes are the same. If the bytes differ for any reason, the sampler is rebuilt as it is today. The bytes are saved only after the new sampler is built, so a response that fails to parse does not cause the next unchanged response to rebuild the sampler. The sender handles responses asynchronously and the next poll does not wait for the previous response, so two responses can be handled at the same time; a dedicated lock keeps the sampler and the saved bytes in step. Comparing raw bytes keeps the change small; I can compare the decoded
SamplingStrategyResponseinstead if you prefer.This covers the first part of the issue. Keeping the limiter's state when only the rate changes (the
Update()approach from jaeger-client-go mentioned in the issue) needs aRateLimiterthat can change its rate in place, and that class lives in sdk-common's internal package, so I'd rather do it in a separate PR and leave the issue open. For comparison, jaeger-client-java also replaced its rate limiting sampler with a new one whenever the rate changed.Added
JaegerRemoteSamplerTest#unchangedStrategy_keepsSampler, which fails without the fix and passes with it../gradlew :sdk-extensions:jaeger-remote-sampler:checkpasses.