Fix/sampler shutdown lifecycle#8574
Conversation
230786a to
333c143
Compare
333c143 to
83b70e5
Compare
|
d8eb3fa to
f246d3e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8574 +/- ##
============================================
+ Coverage 90.96% 91.56% +0.59%
- Complexity 10207 10266 +59
============================================
Files 1013 1013
Lines 27160 27115 -45
Branches 3182 3184 +2
============================================
+ Hits 24706 24827 +121
+ Misses 1730 1564 -166
Partials 724 724 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
jkwatson
left a comment
There was a problem hiding this comment.
Thanks! I'll let @jack-berg also approve before merging, as there's an API change.
| * | ||
| * @return a {@link CompletableResultCode} which is completed when shutdown is finished. | ||
| */ | ||
| default CompletableResultCode shutdown() { |
There was a problem hiding this comment.
It would be most consistent to add both shutdown and update Sampler to extends Closeable, where the default implementation of close is:
@Override
default void close() {
shutdown().join(10, TimeUnit.SECONDS);
}
| CompletableResultCode.ofAll( | ||
| Arrays.asList( | ||
| activeSpanProcessor.shutdown(), | ||
| samplerShutdownResult == null |
There was a problem hiding this comment.
Why does this protect against sampler returning a null shutdown result, but not activeSpanProcessor?
| @Override | ||
| @SuppressWarnings("Interruption") | ||
| public void close() { | ||
| pollFuture.cancel(true); |
There was a problem hiding this comment.
Why switch from true to false for this?
| } | ||
|
|
||
| @Override | ||
| public CompletableResultCode shutdown() { |
There was a problem hiding this comment.
Should protect against calling this multiple times as we do elsewhere in the repo. For example:
|
This PR has review comments. Review suggestions, whether from maintainers or automated reviewers, aren't always correct or required. Please evaluate each comment on its merits, then make sure each thread has a clear outcome. For example, link to the commit if you applied a suggestion, explain why it wasn't applied, or ask a follow-up question. Automation flags a PR for human review once every review thread has a reply or is marked as resolved. Status across open PRs is visible on the pull request dashboard. |
Changes
Adds shutdown lifecycle support to Samplers.
Previously Sampler implementations had no way to release resources when
SdkTracerProvider was shut down. Resource-owning samplers such as
JaegerRemoteSampler could leave background executors and connections running.
This change:
Fixes #8535