census-ecosystem / opencensus-go-exporter-stackdriver

OpenCensus Go exporter for Stackdriver Monitoring and Trace
Apache License 2.0
67 stars 79 forks source link

Handle the case where grpc client connections are shared #298

Closed dashpole closed 2 years ago

dashpole commented 2 years ago

Follow-up to https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/pull/295. If using an Insecure client with the OpenTelemetry collector, it will use the WithGRPCConn option. This grpc connection is then used for both the trace and stats clients. When closing the exporter, the second Close() call fails with error(s) closing trace client (<nil>), or metrics client (rpc error: code = Canceled desc = grpc: the client connection is closing), which indicates the connection is already closed. Handle this case by ignoring that error.

This is required to fix unit test errors in https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/5990.

The go.sum changes must be left-over from a previous PR that didn't tidy?

dashpole commented 2 years ago

Added a test