-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
plugins: support Close() for Tracer plugins as well #6672
Conversation
CI failure is unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comments but overall I'm in favor of this change.
plugin/tracer.go
Outdated
@@ -6,6 +6,7 @@ import ( | |||
|
|||
// PluginTracer is an interface that can be implemented to add a tracer | |||
type PluginTracer interface { | |||
Plugin | |||
Closer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't force tracers to have a close method.
plugin/loader/loader.go
Outdated
@@ -266,7 +266,7 @@ func (loader *PluginLoader) Close() error { | |||
started := loader.started | |||
loader.started = nil | |||
for _, pl := range started { | |||
if pl, ok := pl.(plugin.PluginDaemon); ok { | |||
if pl, ok := pl.(plugin.Closer); ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plugin.Closer
feels a bit overkill. What about just type-asserting pl.(io.Closer)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm ok with that if you are, I just though the semantic was a bit off (it's not really an I/O).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
io.Closer
is really just the standard "closer" at this point.
Most of the tracers available need to properly close to send the remaining traces before the process exit.
92ae72f
to
72026b8
Compare
Fixed as your were suggesting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Most of the tracers available need to properly close to send the remaining traces before the process exit.