Report data from custom collectors
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.
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?
Any update here?
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!
See also #197