Documentation
¶
Overview ¶
Package metrics is for metrics, used in CSI
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( //nolint Branch string //nolint Revision string )
var BuildInfo = prometheus.NewGaugeFunc( prometheus.GaugeOpts{ Name: "build_info", Help: "A metric with a constant '1' value labeled by version, revision, branch", ConstLabels: prometheus.Labels{"version": base.PluginVersion, "revision": Revision, "branch": Branch}, }, func() float64 { return 1 }, )
BuildInfo used to expose information of the current build
var ExtendedDefBuckets = []float64{.025, .05, .1, .5, 1, 3, 5, 10, 15, 30, 45, 90, 180}
ExtendedDefBuckets is a default buckets used for csi driver
Functions ¶
This section is empty.
Types ¶
type Metrics ¶
type Metrics struct {
OperationsDuration *prometheus.HistogramVec
}
Metrics is a structure, which encapsulate prometheus histogram structure. It used for volume operation metrics
func NewMetrics ¶
func NewMetrics(opts prometheus.HistogramOpts, labels ...string) *Metrics
NewMetrics initializes operations duration metrics
func (*Metrics) Collect ¶
func (m *Metrics) Collect() prometheus.Collector
Collect returns prometheus.Collector slice with OperationsDuration histogram
func (*Metrics) EvaluateDuration ¶
func (m *Metrics) EvaluateDuration(labels prometheus.Labels) func()
EvaluateDuration evaluate duration from start for a given method and put it into histogram Receive prometheus.Labels.
func (*Metrics) EvaluateDurationForMethod ¶
EvaluateDurationForMethod of the method call
func (*Metrics) EvaluateDurationForType ¶
EvaluateDurationForType evaluate function call with "type" label
type Statistic ¶
type Statistic interface { Collect() prometheus.Collector EvaluateDuration(labels prometheus.Labels) func() EvaluateDurationForMethod(method string) func() EvaluateDurationForType(t string) func() }
Statistic is a common interface for histogram metrics