metrics

package
v8.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CreateSnapshotOperationName is the operation that tracks how long the controller takes to create a snapshot.
	// Specifically, the operation metric is emitted based on the following timestamps:
	// - Start_time: controller notices the first time that there is a new VolumeSnapshot CR to dynamically provision a snapshot
	// - End_time:   controller notices that the CR has a status with CreationTime field set to be non-nil
	CreateSnapshotOperationName = "CreateSnapshot"

	// CreateSnapshotAndReadyOperationName is the operation that tracks how long the controller takes to create a snapshot and for it to be ready.
	// Specifically, the operation metric is emitted based on the following timestamps:
	// - Start_time: controller notices the first time that there is a new VolumeSnapshot CR(both dynamic and pre-provisioned cases)
	// - End_time:   controller notices that the CR has a status with Ready field set to be true
	CreateSnapshotAndReadyOperationName = "CreateSnapshotAndReady"

	// DeleteSnapshotOperationName is the operation that tracks how long a snapshot deletion takes.
	// Specifically, the operation metric is emitted based on the following timestamps:
	// - Start_time: controller notices the first time that there is a deletion timestamp placed on the VolumeSnapshot CR and the CR is ready to be deleted. Note that if the CR is being used by a PVC for rehydration, the controller should *NOT* set the start_time.
	// - End_time: controller removed all finalizers on the VolumeSnapshot CR such that the CR is ready to be removed in the API server.
	DeleteSnapshotOperationName = "DeleteSnapshot"

	// DynamicSnapshotType represents a snapshot that is being dynamically provisioned
	DynamicSnapshotType = snapshotProvisionType("dynamic")
	// PreProvisionedSnapshotType represents a snapshot that is pre-provisioned
	PreProvisionedSnapshotType = snapshotProvisionType("pre-provisioned")

	// SnapshotStatusTypeUnknown represents that the status is unknown
	SnapshotStatusTypeUnknown snapshotStatusType = "unknown"
	// Success and Cancel are statuses for operation time (operation_total_seconds) as seen by snapshot controller
	// SnapshotStatusTypeSuccess represents that a CreateSnapshot, CreateSnapshotAndReady,
	// or DeleteSnapshot has finished successfully.
	// Individual reconciliations (reconciliation_total_seconds) also use this status.
	SnapshotStatusTypeSuccess snapshotStatusType = "success"
	// SnapshotStatusTypeCancel represents that a CreateSnapshot, CreateSnapshotAndReady,
	// or DeleteSnapshot has been deleted before finishing.
	SnapshotStatusTypeCancel snapshotStatusType = "cancel"
)
View Source
const (
	// CreateGroupSnapshotOperationName is the operation that tracks how long the controller takes to create a groupsnapshot.
	// Specifically, the operation metric is emitted based on the following timestamps:
	// - Start_time: controller notices the first time that there is a new VolumeGroupSnapshot CR to dynamically provision a groupsnapshot
	// - End_time:   controller notices that the CR has a status with CreationTime field set to be non-nil
	CreateGroupSnapshotOperationName = "CreateGroupSnapshot"

	// CreateGroupSnapshotAndReadyOperationName is the operation that tracks how long the controller takes to create a groupsnapshot and for it to be ready.
	// Specifically, the operation metric is emitted based on the following timestamps:
	// - Start_time: controller notices the first time that there is a new VolumeGroupSnapshot CR(both dynamic and pre-provisioned cases)
	// - End_time:   controller notices that the CR has a status with Ready To Use field set to be true
	CreateGroupSnapshotAndReadyOperationName = "CreateGroupSnapshotAndReady"

	// DeleteGroupSnapshotOperationName is the operation that tracks how long a groupsnapshot deletion takes.
	// Specifically, the operation metric is emitted based on the following timestamps:
	// - Start_time: controller notices the first time that there is a deletion timestamp placed on the VolumeGroupSnapshot CR and the CR is ready to be deleted.
	// Note that if the CR is being used by a PVC for rehydration, the controller should *NOT* set the start_time.
	// - End_time: controller removed all finalizers on the VolumeGroupSnapshot CR such that the CR is ready to be removed in the API server.
	DeleteGroupSnapshotOperationName = "DeleteGroupSnapshot"
	// DynamicGroupSnapshotType represents a groupsnapshot that is being dynamically provisioned
	DynamicGroupSnapshotType = snapshotProvisionType("dynamic")
	// PreProvisionedGroupSnapshotType represents a groupsnapshot that is pre-provisioned
	PreProvisionedGroupSnapshotType = snapshotProvisionType("pre-provisioned")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MetricsManager

type MetricsManager interface {
	// PrepareMetricsPath prepares the metrics path the specified pattern for
	// metrics managed by this MetricsManager.
	// If the "pattern" is empty (i.e., ""), it will not be registered.
	// An error will be returned if there is any.
	PrepareMetricsPath(mux *http.ServeMux, pattern string, logger promhttp.Logger) error

	// OperationStart takes in an operation and caches its start time.
	// if the operation already exists, it's an no-op.
	OperationStart(key OperationKey, val OperationValue)

	// DropOperation removes an operation from cache.
	// if the operation does not exist, it's an no-op.
	DropOperation(op OperationKey)

	// RecordMetrics records a metric point. Note that it will be an no-op if an
	// operation has NOT been marked "Started" previously via invoking "OperationStart".
	// Invoking of RecordMetrics effectively removes the cached entry.
	// op - the operation which the metric is associated with.
	// status - the operation status, if not specified, i.e., status == nil, an
	//          "Unknown" status of the passed-in operation is assumed.
	RecordMetrics(op OperationKey, status OperationStatus, driverName string)

	// RecordVolumeGroupSnapshotMetrics records a metric for operations related to
	// VolumeGroupSnapshot
	RecordVolumeGroupSnapshotMetrics(op OperationKey, status OperationStatus, driverName string)

	// GetRegistry() returns the metrics.KubeRegistry used by this metrics manager.
	GetRegistry() k8smetrics.KubeRegistry
}

func NewMetricsManager

func NewMetricsManager() MetricsManager

NewMetricsManager creates a new MetricsManager instance

type OperationKey

type OperationKey struct {
	// Name is the name of the operation, for example: "CreateSnapshot", "DeleteSnapshot"
	Name string
	// ResourceID is the resource UID to which the operation has been executed against
	ResourceID types.UID
}

OperationKey is a structure which holds information to uniquely identify a snapshot related operation

func NewOperationKey

func NewOperationKey(name string, snapshotUID types.UID) OperationKey

NewOperationKey initializes a new OperationKey

type OperationStatus

type OperationStatus interface {
	String() string
}

OperationStatus is the interface type for representing an operation's execution status, with the nil value representing an "Unknown" status of the operation.

type OperationValue

type OperationValue struct {
	// Driver is the driver name which executes the operation
	Driver string
	// SnapshotType represents the snapshot type, for example: "dynamic", "pre-provisioned"
	SnapshotType string
	// contains filtered or unexported fields
}

OperationValue is a structure which holds operation metadata

func NewOperationValue

func NewOperationValue(driver string, snapshotType snapshotProvisionType) OperationValue

NewOperationValue initializes a new OperationValue

type SnapshotOperationStatus

type SnapshotOperationStatus struct {
	// contains filtered or unexported fields
}

SnapshotOperationStatus represents the status for a snapshot controller operation

func NewSnapshotOperationStatus

func NewSnapshotOperationStatus(status snapshotStatusType) SnapshotOperationStatus

NewSnapshotOperationStatus returns a new SnapshotOperationStatus

func (SnapshotOperationStatus) String

func (sos SnapshotOperationStatus) String() string

Jump to

Keyboard shortcuts

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