Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not use float64? #164

Open
woodliu opened this issue Jun 12, 2024 · 0 comments
Open

Why not use float64? #164

woodliu opened this issue Jun 12, 2024 · 0 comments

Comments

@woodliu
Copy link

woodliu commented Jun 12, 2024

func (p *PrometheusSink) AddSampleWithLabels(parts []string, val float32, labels []metrics.Label) {

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...

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"}})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant