Prevent large integers from being displayed in scientific notation in golang

47 views
Skip to first unread message

Ken Sato

unread,
Nov 20, 2020, 7:44:34 PM11/20/20
to Prometheus Users
Hello,

I wonder how can I show large integers as integers with the client_golang. For example, if I set 1234567 in a gauge, it is displayed like this

  sample_gauge 1.234567e+06

I would like to show it as follows.

  sample_gauge 1234567

I understand the value of metrics is float64 and it should use scientific notation for a very large number, but it must be possible to show a 7 digits number as is. Does anybody know how to control the format of the metrics value?

Thanks
Ken SATO

b.ca...@pobox.com

unread,
Nov 21, 2020, 4:21:49 AM11/21/20
to Prometheus Users
Why does this matter to you - in other words, what problem are you trying to solve?

This is an accurate representation of the float64 value, and doesn't affect the value which is stored in prometheus, nor how it's rendered in any client which might process that data, such as Grafana.

Ken Sato

unread,
Nov 21, 2020, 8:45:16 AM11/21/20
to Prometheus Users
Hi,
Thank you for your response.

I'm currently thinking of re-implementing an existing exporter with golang. The original one is here https://github.com/ksato9700/bitcoind-exporter and it emits 7 digits integer value for some metrics. You're right that the difference of notation wouldn't cause any issues, but I thought it was nice if the new exporter can output exactly same as the original one (to make debug easily). 

Thanks
Ken SATO
Reply all
Reply to author
Forward
0 new messages