Repository navigation
cli-plugins/plugin: add OnFinalize hook for shutting down otel providers - #7433
Open
jsternberg wants to merge 1 commit into
Open
jsternberg wants to merge 1 commit into
jsternberg wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟡 NEEDS ATTENTION
jsternberg
force-pushed
the
trace-and-metrics-shutdown
branch
from
October 23, 2026 18:52
bcd15ee to
f2a66e4
Compare
vvoland
reviewed
Oct 26, 2026
vvoland
reviewed
Oct 26, 2026
| } | ||
| }) | ||
| } | ||
| wg.Wait() |
Collaborator
There was a problem hiding this comment.
Do these Shutdown methods have a guarantee to finish in the given timeout?
If not, perhaps we should run this in a goroutine which we would only wait for the ExportTimeout and if they dont manage to return in that time, just continue with shutdown
Contributor
Author
There was a problem hiding this comment.
I think so but I'll just add an additional bit of time and do this just in case the Shutdown methods aren't cooperating for some reason.
jsternberg
force-pushed
the
trace-and-metrics-shutdown
branch
2 times, most recently
from
October 26, 2026 19:37
af5268d to
2927abc
Compare
vvoland
reviewed
Oct 26, 2026
jsternberg
force-pushed
the
trace-and-metrics-shutdown
branch
2 times, most recently
from
October 27, 2026 15:03
7f0dd35 to
81d4db6
Compare
jsternberg
force-pushed
the
trace-and-metrics-shutdown
branch
from
October 27, 2026 15:25
81d4db6 to
abdbe37
Compare
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟡 NEEDS ATTENTION
OTEL providers provided by this library to plugins were not properly shut down. Metrics from the CLI were forcibly flushed in a separate area and the `buildx` command does its own flushing, but this didn't apply to traces. Add shutdown on post run for plugins using `OnFinalize`. This will allow compose to use the tracer provider from this library rather than roll its own custom one. Signed-off-by: Jonathan A. Sternberg <[email protected]>
jsternberg
force-pushed
the
trace-and-metrics-shutdown
branch
from
October 27, 2026 17:36
abdbe37 to
29eb393
Compare
docker-agent
left a comment
Contributor
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
Lower-confidence findings (not posted inline)
- [low] cli-plugins/plugin/plugin.go:78 —
cobra.OnFinalizeregistered unconditionally even whentcmd.Initializefails (unverified; type assertions in the hook guard against uninitialized providers, so no crash occurs)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
OTEL providers provided by this library to plugins were not properly
shut down. Metrics from the CLI were forcibly flushed in a separate area
and the
buildxcommand does its own flushing, but this didn't apply totraces.
Add shutdown on post run for plugins using
OnFinalize. This will allow compose to use thetracer provider from this library rather than roll its own custom one.