We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1f5366 commit a9d0066Copy full SHA for a9d0066
prometheus/histogram.go
@@ -531,6 +531,11 @@ func (h *histogram) observe(v float64, bucket int) {
531
case v < -h.sparseThreshold:
532
whichSparse = -1
533
}
534
+ // TODO(beorn7): This sometimes gives inaccurate results for
535
+ // floats that are actual powers of 10, e.g. math.Log10(0.1) is
536
+ // calculated as -0.9999999999999999 rather than -1 and thus
537
+ // yields a key unexpectedly one off. Maybe special-case precise
538
+ // powers of 10.
539
sparseKey = int(math.Ceil(math.Log10(math.Abs(v)) * float64(h.sparseResolution)))
540
541
// We increment h.countAndHotIdx so that the counter in the lower
0 commit comments