-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[exporter/loadbalancer] close exporters on shutdown #36024
[exporter/loadbalancer] close exporters on shutdown #36024
Conversation
8ad359b
to
8059a83
Compare
064a037
to
dd8e814
Compare
@@ -220,6 +220,10 @@ func endpointFound(endpoint string, endpoints []string) bool { | |||
func (lb *loadBalancer) Shutdown(ctx context.Context) error { | |||
err := lb.res.shutdown(ctx) | |||
lb.stopped = true | |||
|
|||
for _, e := range lb.exporters { | |||
err = errors.Join(err, e.Shutdown(ctx)) |
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.
maybe this can be optimized down the road with a slice pre-allocated for number of exporters, and append errors to it and call errors.Join at the end. However, this is likely to not matter much here as a few exporters would exist here.
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.
Agree.
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
@jpkrohling @open-telemetry/collector-contrib-approvers can someone take a look? |
…6024) #### Description I noticed that we don't close the exporters during shutdown. This PR iterates through the exporters and closes them in a graceful manner.
…6024) #### Description I noticed that we don't close the exporters during shutdown. This PR iterates through the exporters and closes them in a graceful manner.
Description
I noticed that we don't close the exporters during shutdown. This PR iterates through the exporters and closes them in a graceful manner.