deadtrickster / prometheus.erl

Prometheus.io client in Erlang
MIT License
341 stars 117 forks source link

Undefined behaviour with duration_unit #104

Closed bastien-fieldbox closed 4 years ago

bastien-fieldbox commented 4 years ago

Hello, first let me tell you that this library looks fantastic and the dashboards as well!

Now for the issue part, I'm trying to implement the BEAM dashboard and there is some missing values such as "uptime" (process_uptime_seconds).

So I tried to fill it myself:

prometheus_gauge:new([{name, process_uptime_seconds}, {help, "Uptime"}]),
prometheus_gauge:set(process_uptime_seconds, 5),
io:format(prometheus_text_format:format()).

It results in:

# TYPE process_uptime_seconds gauge
# HELP process_uptime_seconds Uptime
process_uptime_seconds 5.0e-9

This confuse me. I read through the code and it looks like it's doing some conversion because the name of the metrics contains _seconds.

What's going on? I could not find doc on this subject and I don't understand the intent behind this?

Regards, Bastien

bastien-fieldbox commented 4 years ago

I have found in here: https://github.com/deadtrickster/prometheus.erl/blob/master/doc/prometheus_time.md

that I can pass {duration_unit, false} and fixes the issue.

IMO we should have that kind of behaviour only with set_duration.

Cheers