Conversation
The default MetricsRegistry used by OpenCensus is a singleton that does not allow the same metrics to be registered multiple times. The session pool metrics gathering did not take this into account, and when multiple session pools were created within the same class loader, it would throw an InvalidArgumentException for the second session pool. Fixes #106.
|
Although this fix looks good to me, I have implemented fix in OpenCensus (census-instrumentation/opencensus-java#2017) to allow users to register the same metrics multiple times without exception. I am planning to release a cut either on Monday or Tuesday. What do you think about my fix? |
@mayurkale22 Could you elaborate a little on how your fix will work when the same metric is registered multiple times both with the same label values and different label values? In the current implementation in the Spanner client the metrics are given label values to identify the database. The following situations are however possible:
See also this question: https://github.com/census-instrumentation/opencensus-java/pull/2017/files#r392709160 |
|
Closing in favor of census-instrumentation/opencensus-java#2017 |
The default MetricsRegistry used by OpenCensus is a singleton that does not allow the same metrics to be registered multiple times. The session pool metrics gathering did not take this into account, and when multiple session pools were created within the same class loader, it would throw
an InvalidArgumentException for the second session pool.
Fixes #106.