-
Notifications
You must be signed in to change notification settings - Fork 26
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
"ValueError: Duplicated timeseries in CollectorRegistry" in latest version (v0.6.0) #25
Comments
Thanks for reporting. What if you just create one |
Unfortunately that isn't possible in my use case. I'm using multiple gRPC connections to different services, each which require their own instance of the |
What I am suggesting is make a single instance of "PromClientInterceptor", then you can used it in multiple clients. .e.g.
Would that work? |
That will work, however my issue with it as a solution is that that is a non-standard way to implement an interceptor with prometheus. Also, there is nothing stopping someone else coming across the same issue as I have. Moving the metrics definition back to the file level solves the problem, and allows both of these ways to define an interceptor to be usable. I can open a PR making the required changes to fix this issue when I get the time over the next few days, if changing the metric definitions back to file level is OK with you? |
+1, I ran into this error as well. |
The latest version v0.6.0 is raising the following error by
prometheus_client/registry.py
, when using thePromClientInterceptor()
"ValueError: Duplicated timeseries in CollectorRegistry: {'grpc_client_started_created', 'grpc_client_started', 'grpc_client_started_total'}"
I think I've narrowed down the issue to being a side effect of changes from #21,
specifically https://github.com/lchenn/py-grpc-prometheus/pull/21/files#diff-04b7eb91d0278b63925e45233c6beffcf6d3f4acb166c847d08982268c8cf111L4 where the metrics are changed from being defined at the file level to being defined per interceptor instance via
init_metrics()
. This is causing duplication of metrics registration when thePromClientInterceptor
is defined multiple times to intercept different GRPC calls.I've included a simple test which reproduces the error:
when run
The text was updated successfully, but these errors were encountered: