hashicorp / go-metrics

A Golang library for exporting performance and runtime metrics to external metrics systems (i.e. statsite, statsd)
MIT License
1.46k stars 177 forks source link

feat: Support float64 gauges #150

Open rzimmerman opened 1 year ago

rzimmerman commented 1 year ago

It can be useful to represent a Unix timestamp in a gauge. Prometheus metrics are float64s, so this works well when directly using the Prometheus libraries. However, because go-metrics Guage's are stored as float32s, there isn't enough precision to store a timestamp (https://go.dev/play/p/RvJ11Y8R7Cz) and times get truncated to about 2 minute intervals.

There's one instance of this in Vault: https://github.com/hashicorp/vault/blob/2dd4528ed8a8be83e0c1e0b48b1f23dab701181f/builtin/logical/pki/path_tidy.go#L1209 Which may be a bug.