metrics

package
v0.29.8 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

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

Variables

View Source
var (

	// These metrics are made public to be used by unit tests.
	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 is the number of times a keyID is used
	// e.g. apiserver_envelope_encryption_key_id_hash_total counter
	// apiserver_envelope_encryption_key_id_hash_total{apiserver_id_hash="sha256",key_id_hash="sha256",
	// provider_name="providerName",transformation_type="from_storage"} 1
	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 is the last time in seconds when a keyID was used
	// e.g. apiserver_envelope_encryption_key_id_hash_last_timestamp_seconds{apiserver_id_hash="sha256",key_id_hash="sha256", provider_name="providerName",transformation_type="from_storage"} 1.674865558833728e+09
	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 is the last time in seconds when a keyID was returned by the Status RPC call.
	// e.g. apiserver_envelope_encryption_key_id_hash_status_last_timestamp_seconds{apiserver_id_hash="sha256",key_id_hash="sha256", provider_name="providerName"} 1.674865558833728e+09
	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:           "Number of records in data encryption key (DEK) source cache. On a restart, this value is an approximation of the number of decrypt RPC calls the server will make to the KMS plugin.",
			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 added in v0.29.0

func RecordDekSourceCacheSize(providerName string, size int)

func RecordInvalidKeyIDFromStatus added in v0.27.0

func RecordInvalidKeyIDFromStatus(providerName, errCode string)

func RecordKMSOperationLatency added in v0.27.0

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

RecordKMSOperationLatency records the latency of KMS operation.

func RecordKeyID added in v0.27.0

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 added in v0.27.0

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()

Types

This section is empty.

Jump to

Keyboard shortcuts

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