package metrics

import "k8s.io/apiserver/pkg/storage/value/encrypt/envelope/metrics"

Index

Constants

const (
	FromStorageLabel = "from_storage"
	ToStorageLabel   = "to_storage"
)

Variables

var (
	KMSOperationsLatencyMetric = metrics.NewHistogramVec(
		&metrics.HistogramOpts{
			Namespace:      namespace,
			Subsystem:      subsystem,
			Name:           "kms_operations_latency_seconds",
			Help:           "KMS operation duration with gRPC error code status total.",
			StabilityLevel: metrics.ALPHA,

			Buckets: metrics.ExponentialBuckets(0.0001, 2, 20),
		},
		[]string{"provider_name", "method_name", "grpc_status_code"},
	)

	KeyIDHashTotal = metrics.NewCounterVec(
		&metrics.CounterOpts{
			Namespace:      namespace,
			Subsystem:      subsystem,
			Name:           "key_id_hash_total",
			Help:           "Number of times a keyID is used split by transformation type, provider, and apiserver identity.",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{"transformation_type", "provider_name", "key_id_hash", "apiserver_id_hash"},
	)

	KeyIDHashLastTimestampSeconds = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Namespace:      namespace,
			Subsystem:      subsystem,
			Name:           "key_id_hash_last_timestamp_seconds",
			Help:           "The last time in seconds when a keyID was used.",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{"transformation_type", "provider_name", "key_id_hash", "apiserver_id_hash"},
	)

	KeyIDHashStatusLastTimestampSeconds = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Namespace:      namespace,
			Subsystem:      subsystem,
			Name:           "key_id_hash_status_last_timestamp_seconds",
			Help:           "The last time in seconds when a keyID was returned by the Status RPC call.",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{"provider_name", "key_id_hash", "apiserver_id_hash"},
	)

	InvalidKeyIDFromStatusTotal = metrics.NewCounterVec(
		&metrics.CounterOpts{
			Namespace:      namespace,
			Subsystem:      subsystem,
			Name:           "invalid_key_id_from_status_total",
			Help:           "Number of times an invalid keyID is returned by the Status RPC call split by error.",
			StabilityLevel: metrics.ALPHA,
		},
		[]string{"provider_name", "error"},
	)

	DekSourceCacheSize = metrics.NewGaugeVec(
		&metrics.GaugeOpts{
			Namespace:      namespace,
			Subsystem:      subsystem,
			Name:           "dek_source_cache_size",
			Help:           "" /* 182 byte string literal not displayed */,
			StabilityLevel: metrics.ALPHA,
		},
		[]string{"provider_name"},
	)
)

* By default, all the following metrics are defined as falling under * ALPHA stability level https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/1209-metrics-stability/kubernetes-control-plane-metrics-stability.md#stability-classes) * * Promoting the stability level of the metric is a responsibility of the component owner, since it * involves explicitly acknowledging support for the metric across multiple releases, in accordance with * the metric stability policy.

Functions

func RecordArrival

func RecordArrival(transformationType string, start time.Time)

func RecordDekCacheFillPercent

func RecordDekCacheFillPercent(percent float64)

func RecordDekSourceCacheSize

func RecordDekSourceCacheSize(providerName string, size int)

func RecordInvalidKeyIDFromStatus

func RecordInvalidKeyIDFromStatus(providerName, errCode string)

func RecordKMSOperationLatency

func RecordKMSOperationLatency(providerName, methodName string, duration time.Duration, err error)

RecordKMSOperationLatency records the latency of KMS operation.

func RecordKeyID

func RecordKeyID(transformationType, providerName, keyID, apiServerID string)

RecordKeyID records total count and last time in seconds when a KeyID was used for TransformFromStorage and TransformToStorage operations

func RecordKeyIDFromStatus

func RecordKeyIDFromStatus(providerName, keyID, apiServerID string)

RecordKeyIDFromStatus records last time in seconds when a KeyID was returned by the Status RPC call.

func RegisterMetrics

func RegisterMetrics()

Source Files

metrics.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
7 hours ago

Tools for package owners.