metrics

package
v0.2.2-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package metrics is for metrics, used in CSI

Index

Constants

This section is empty.

Variables

View Source
var (
	//nolint
	Branch string
	//nolint
	Revision string
)
View Source
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

View Source
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

func (m *Metrics) EvaluateDurationForMethod(method string) func()

EvaluateDurationForMethod of the method call

func (*Metrics) EvaluateDurationForType

func (m *Metrics) EvaluateDurationForType(t string) func()

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL