jupp0r / prometheus-cpp

Prometheus Client Library for Modern C++
Other
942 stars 330 forks source link

Standard metrics: CPU time, memory usage, process start time, etc. #259

Open Radrik5 opened 5 years ago

Radrik5 commented 5 years ago

Any plans for adding standard metrics like in official Go/Java/Python client libraries?

I understand it's difficult to make them in a cross-platform fashion but it would be very helpful to have them out of the box.

hhoffstaette commented 4 years ago

Love this idea, but since this ventures into app metrics (as the exporter library will be embedded elsewhere), platform dependencies & licensing I'd like to suggest we KISS this by only defining a bunch of callbacks to be implemented. The metrics themselves can be predefined so that they are consistent across implementations, but the actual delivery of the metric should be the task of the callbacks, which should be unimplemented & empty by default. For Unix-ish platforms it should be easy to provide a demo provider based on e.g. libstatgrab, which I've used in the past. But what really matters here is a consistent lifecycle API and setup of the counters/gauges to be exported.

nnWhisperer commented 4 years ago

Hi, I think adding process start time may not be that hard; here I've found a sample: https://github.com/ef-gy/prometheus-client-cpp/blob/master/include/prometheus/metric.h#L142 What do you think?

day253 commented 3 months ago

here is solution. @Radrik5

https://gist.github.com/day253/f4f4613c3fe855194332eebe986e50a5