Stop OpenCensus worker on Close
enocom opened this issue · 2 comments
With #371 we now have a way to stop the goroutine started by OpenCensus.
When a client calls Close
on the Dialer, we should stop the OpenCensus goroutine too.
When a client calls Close on the Dialer, we should stop the OpenCensus goroutine too.
I am wondering if this is always a good idea.
For example, what would happen in the following situations in a program embedding the Cloud SQL Go Connector?
- The Dialer is closed, but a new one is created in replacement
- A package other than the Cloud SQL Go Connector also registers OpenCensus views via
view.Register()
Shouldn't the OpenCensus worker be kept alive in these cases?
I am under the impression that the state of the default global worker exposed via go.opencensus.io/stats/view
shouldn't be managed by libraries such as the Cloud SQL Go Connector.
IMHO, it is up to the developer of the program embedding the Cloud SQL Go Connector to decide if/when that worked should be stopped.
@maximerety I agree -- I was hoping this would make it easier to clean up the OpenCensus goroutine for clients, but after some experimentation clients will have to do this work themselves.