census-instrumentation / opencensus-java

A stats collection and distributed tracing framework
https://opencensus.io
Apache License 2.0
672 stars 201 forks source link

fix: Shutdown Stackdriver MetricServiceClient properly #2091

Closed janhicken closed 2 years ago

janhicken commented 2 years ago

Using the default configuration of StackdriverStatsConfiguration, a MetricServiceClient is initialized by the StackdriverStatsExporter.

This client was never closed, this will be done now when the StackdriverStatsExporter.unregister() method is called.

If a custom MetricServiceStub is given by the user, it will not be closed as the user should be in charge of it.

This should fix #2007.