Open woodliu opened 4 months ago
https://github.com/hashicorp/go-metrics/blob/0ec744010d013e2ce8d0d71c69a9c43bfe523efc/prometheus/prometheus.go#L329 I check the second parameter of AddSampleWithLabels, it all convert from float32 to float64, why not use float64 directly? As the example below, the result of time.Since(s).Milliseconds() is float64, i have to convert to float32, and in AddSampleWithLabels it will convert to float64 again...
AddSampleWithLabels
time.Since(s).Milliseconds()
float64
s := time.Now() err := srv.r.SetValue(c.Body()) utils.PromSink.AddSampleWithLabels(raft_set_latency, float32(time.Since(s).Milliseconds()), []metrics.Label{{Name: "version", Value: "v1.0"}})
https://github.com/hashicorp/go-metrics/blob/0ec744010d013e2ce8d0d71c69a9c43bfe523efc/prometheus/prometheus.go#L329 I check the second parameter of
AddSampleWithLabels
, it all convert from float32 to float64, why not use float64 directly? As the example below, the result oftime.Since(s).Milliseconds()
isfloat64
, i have to convert to float32, and inAddSampleWithLabels
it will convert to float64 again...