Composing metrics with client_python

33 views
Skip to first unread message

Thomas Schmidt

unread,
Oct 22, 2020, 10:56:35 AM10/22/20
to Prometheus Users
Hello all, 

I have the following use-case: I'm instrumenting a python codebase where backing services (eg. Kafka, S3, HDFS, HTTP client) are injected into a service that provides the business logic. 

In some cases there may be multiple instance of the same backing service per service, which creates either: 
* Issue with the python client, which justifiably refuses to register metrics that already exist
* Issue with the exposition that exposes multiple instance of each metrics (unsure if duplication exist in that case, but it seems to)

What I would like is to have a base CollectorRegistry that can be use for collecting lower-level metrics, but if a metric already exist, instead of raising an exception, simply pass over it, so that multiple instances of a backing service would report as a single set of metrics. 

Is there a simple way to achieve that using the python client currently, and if not what are possible alternatives?

Thank you all in advance, 


– Thomas 

Brian Brazil

unread,
Oct 22, 2020, 11:46:45 AM10/22/20
to Thomas Schmidt, Prometheus Users
If it's the same backing service, why aren't they all using the same metric objects? Metrics are meant to be defined at the file level, which shouldn't have these problems.
 
--
Reply all
Reply to author
Forward
0 new messages