metrics

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2019 License: Apache-2.0 Imports: 9 Imported by: 43

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func VerifyMetricsMatch

func VerifyMetricsMatch(expectedMetrics, actualMetrics string, metricToIgnore string) error

VerifyMetricsMatch is a helper function that verifies that the expected and actual metrics are identical excluding metricToIgnore. This method is only used by tests. Ideally it should be in the _test file, but *_test.go files are compiled into the package only when running go test for that package and this method is used by metrics_test as well as connection_test. If there are more consumers in the future, we can consider moving it to a new, standalone package.

Types

type CSIMetricsManager

type CSIMetricsManager interface {
	// GetRegistry() returns the metrics.KubeRegistry used by this metrics manager.
	GetRegistry() metrics.KubeRegistry

	// RecordMetrics must be called upon CSI Operation completion to record
	// the operation's metric.
	// operationName - Name of the CSI operation.
	// operationErr - Error, if any, that resulted from execution of operation.
	// operationDuration - time it took for the operation to complete
	RecordMetrics(
		operationName string,
		operationErr error,
		operationDuration time.Duration)

	// SetDriverName is called to update the CSI driver name. This should be done
	// as soon as possible, otherwise metrics recorded by this manager will be
	// recorded with an "unknown-driver" driver_name.
	// driverName - Name of the CSI driver against which this operation was executed.
	SetDriverName(driverName string)

	// StartMetricsEndpoint starts the metrics endpoint at the specified address/path
	// for this metrics manager.
	// If the metricsAddress is an empty string, this will be a no op.
	StartMetricsEndpoint(metricsAddress, metricsPath string)
}

CSIMetricsManager exposes functions for recording metrics for CSI operations.

func NewCSIMetricsManager

func NewCSIMetricsManager(driverName string) CSIMetricsManager

NewCSIMetricsManager creates and registers metrics for for CSI Sidecars and returns an object that can be used to trigger the metrics. driverName - Name of the CSI driver against which this operation was executed.

If unknown, leave empty, and use SetDriverName method to update later.

Jump to

Keyboard shortcuts

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