Skip to content

Commit ab8bb23

Browse files
authored
Merge pull request kubernetes#82583 from RainbowMango/pr_wrap_buckets_functionality
Add wrapper for prometheus buckets functionality
2 parents 0dbb931 + 6420a31 commit ab8bb23

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

staging/src/k8s.io/component-base/metrics/histogram.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ import (
2121
"github.com/prometheus/client_golang/prometheus"
2222
)
2323

24+
// DefBuckets is a wrapper for prometheus.DefBuckets
25+
var DefBuckets = prometheus.DefBuckets
26+
27+
// LinearBuckets is a wrapper for prometheus.LinearBuckets.
28+
func LinearBuckets(start, width float64, count int) []float64 {
29+
return prometheus.LinearBuckets(start, width, count)
30+
}
31+
32+
// ExponentialBuckets is a wrapper for prometheus.ExponentialBuckets.
33+
func ExponentialBuckets(start, factor float64, count int) []float64 {
34+
return prometheus.ExponentialBuckets(start, factor, count)
35+
}
36+
2437
// Histogram is our internal representation for our wrapping struct around prometheus
2538
// histograms. Summary implements both kubeCollector and ObserverMetric
2639
type Histogram struct {

0 commit comments

Comments
 (0)