| 1 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
package metrics |
| 6 |
|
| 7 |
// Float64Histogram represents a distribution of float64 values. |
| 8 |
type Float64Histogram struct { |
| 9 |
// Counts contains the weights for each histogram bucket. |
| 10 |
// |
| 11 |
// Given N buckets, Count[n] is the weight of the range |
| 12 |
// [bucket[n], bucket[n+1]), for 0 <= n < N. |
| 13 |
Counts []uint64 |
| 14 |
|
| 15 |
// Buckets contains the boundaries of the histogram buckets, in increasing order. |
| 16 |
// |
| 17 |
// Buckets[0] is the inclusive lower bound of the minimum bucket while |
| 18 |
// Buckets[len(Buckets)-1] is the exclusive upper bound of the maximum bucket. |
| 19 |
// Hence, there are len(Buckets)-1 counts. Furthermore, len(Buckets) != 1, always, |
| 20 |
// since at least two boundaries are required to describe one bucket (and 0 |
| 21 |
// boundaries are used to describe 0 buckets). |
| 22 |
// |
| 23 |
// Buckets[0] is permitted to have value -Inf and Buckets[len(Buckets)-1] is |
| 24 |
// permitted to have value Inf. |
| 25 |
// |
| 26 |
// For a given metric name, the value of Buckets is guaranteed not to change |
| 27 |
// between calls until program exit. |
| 28 |
// |
| 29 |
// This slice value is permitted to alias with other Float64Histograms' Buckets |
| 30 |
// fields, so the values within should only ever be read. If they need to be |
| 31 |
// modified, the user must make a copy. |
| 32 |
Buckets []float64 |
| 33 |
} |