Documentation
¶
Overview ¶
Package histogram provides primitives for working with histograms, particularly towards building Prometheus exporters.
Example ¶
// Create a new descriptor.
desc := prometheus.NewDesc(
"foo_bar_metric",
"The number of foos that have been bared",
nil,
nil,
)
// Create a Histogram.
c := Config{
BucketLimits: []float64{0, 1, 5},
}
h, _ := New(c)
// Add entries to the Histogram as part of the exporter,
// e.g: latency of network connections.
h.Add(0.2)
// Convert the Histogram into a metric.
metric := prometheus.MustNewConstHistogram(
desc, h.Count(), h.Sum(), h.Buckets(),
)
fmt.Println(metric)
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
Types ¶
type Config ¶
type Config struct {
// BucketLimits is the upper limit of each bucket in the histogram.
// See https://godoc.org/github.com/prometheus/client_golang/prometheus#HistogramOpts.
BucketLimits []float64
}
type Histogram ¶
type Histogram struct {
// contains filtered or unexported fields
}
Histogram is a data structure suitable for providing the inputs to a Prometheus Histogram. See https://godoc.org/github.com/prometheus/client_golang/prometheus#MustNewConstHistogram.
Click to show internal directories.
Click to hide internal directories.