prom-client icon indicating copy to clipboard operation
prom-client copied to clipboard

Report data from custom collectors

Open mayurkale22 opened this issue 6 years ago • 4 comments

Hi !

This is Mayur from OpenCensus team. Recently we've been working on adding already aggregated metrics data to (Counter, Gauge and Histogram) prom-client. As data is already aggregated it does not make sense to report them using counter.inc(val) and histogram.observe(val);. This client doesn't seem to support custom collectors.

Is it possible to add new APIs similar to https://github.com/prometheus/client_python/blob/624bb61e6f15e0c3739fec853edaea2b91d1674f/prometheus_client/metrics_core.py#L178 and https://github.com/prometheus/client_java/blob/master/simpleclient/src/main/java/io/prometheus/client/Collector.java#L75 to report data from custom collectors?

OR

In order to record already aggregated data with Counter and Histogram, we should include set()/addMetric() method. I think this would be simpler and straight-forward approach.

Let me know your views, I can help you to send PR.

mayurkale22 avatar Jan 17 '19 01:01 mayurkale22

I would actually like if prom-client had support for custom collections since it's been requested before too. But for this it might be better to take then more simple approach.. @SimenB, @zbjornson what do you think?

siimon avatar Jan 21 '19 09:01 siimon

Any update here?

mayurkale22 avatar Jan 28 '19 17:01 mayurkale22

Sorry about the late response..

After giving it some more thought I actually prefer your first suggestion, even if it's more work. I have concerns that if a set function is added to Counters it will be misused and also confusing.

I, however, do not know the requirements specially for custom collectors so I will not be much of help other than code reviewing if anyone is willing to do some work on it!

siimon avatar Feb 06 '19 22:02 siimon

See also #197

christian-2 avatar Apr 17 '20 03:04 christian-2