metrics

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (

	// MetricLabelErrorDefaultVal is the default string value that represents "error type unknown"
	MetricLabelErrorDefaultVal = ""
	// Well-known metricLabelError values
	NodeClaimNotFoundError    = "NodeClaimNotFoundError"
	NodeClassNotReadyError    = "NodeClassNotReadyError"
	InsufficientCapacityError = "InsufficientCapacityError"
)

Variables

View Source
var (
	ErrorsTotal = opmetrics.NewPrometheusCounter(
		crmetrics.Registry,
		prometheus.CounterOpts{
			Namespace: metrics.Namespace,
			Subsystem: "cloudprovider",
			Name:      "errors_total",
			Help:      "Total number of errors returned from CloudProvider calls.",
		},
		[]string{
			metricLabelController,
			metricLabelMethod,
			metricLabelProvider,
			metricLabelError,
		},
	)
)
View Source
var MethodDuration = opmetrics.NewPrometheusHistogram(
	crmetrics.Registry,
	prometheus.HistogramOpts{
		Namespace: metrics.Namespace,
		Subsystem: "cloudprovider",
		Name:      "duration_seconds",
		Help:      "Duration of cloud provider method calls. Labeled by the controller, method name and provider.",
	},
	[]string{
		metricLabelController,
		metricLabelMethod,
		metricLabelProvider,
	},
)

Functions

func Decorate

Decorate returns a new `CloudProvider` instance that will delegate all method calls to the argument, `cloudProvider`, and publish aggregated latency metrics. The value used for the metric label, "controller", is taken from the `Context` object passed to the methods of `CloudProvider`.

Do not decorate a `CloudProvider` multiple times or published metrics will contain duplicated method call counts and latencies.

func GetErrorTypeLabelValue

func GetErrorTypeLabelValue(err error) string

GetErrorTypeLabelValue is a convenience func that returns a string representation of well-known CloudProvider error types

Types

This section is empty.

Jump to

Keyboard shortcuts

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