mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-25 18:21:01 +00:00
prober: make histogram buckets cumulative
Histogram buckets should include counts for all values under the bucket ceiling, not just those between the ceiling and the next lower ceiling. See https://prometheus.io/docs/tutorials/understanding_metric_types/\#histogram Updates tailscale/corp#24522 Signed-off-by: Percy Wegmann <percy@tailscale.com>
This commit is contained in:
parent
3adad364f1
commit
5095efd628
@ -45,6 +45,5 @@ func (h *histogram) add(v float64) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
h.bucketedCounts[b] += 1
|
h.bucketedCounts[b] += 1
|
||||||
break
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ func TestHistogram(t *testing.T) {
|
|||||||
if diff := cmp.Diff(h.sum, 7.5); diff != "" {
|
if diff := cmp.Diff(h.sum, 7.5); diff != "" {
|
||||||
t.Errorf("wrong sum; (-got+want):%v", diff)
|
t.Errorf("wrong sum; (-got+want):%v", diff)
|
||||||
}
|
}
|
||||||
if diff := cmp.Diff(h.bucketedCounts, map[float64]uint64{1: 2, 2: 2}); diff != "" {
|
if diff := cmp.Diff(h.bucketedCounts, map[float64]uint64{1: 2, 2: 4}); diff != "" {
|
||||||
t.Errorf("wrong bucketedCounts; (-got+want):%v", diff)
|
t.Errorf("wrong bucketedCounts; (-got+want):%v", diff)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user