metrics

package
v0.28.13 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: 6 Imported by: 109

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Metrics provides access to all admission metrics.
	Metrics = newAdmissionMetrics()
)

Functions

func WithControllerMetrics

func WithControllerMetrics(i admission.Interface, name string) admission.Interface

WithControllerMetrics is a decorator for named admission handlers.

func WithMetrics

func WithMetrics(i admission.Interface, observer ObserverFunc, extraLabels ...string) admission.Interface

WithMetrics is a decorator for admission handlers with a generic observer func.

func WithStepMetrics

func WithStepMetrics(i admission.Interface) admission.Interface

WithStepMetrics is a decorator for a whole admission phase, i.e. admit or validation.admission step.

Types

type AdmissionMetrics

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

AdmissionMetrics instruments admission with prometheus metrics.

func (*AdmissionMetrics) ObserveAdmissionController

func (m *AdmissionMetrics) ObserveAdmissionController(ctx context.Context, elapsed time.Duration, rejected bool, attr admission.Attributes, stepType string, extraLabels ...string)

ObserveAdmissionController records admission related metrics for a built-in admission controller, identified by it's plugin handler name.

func (*AdmissionMetrics) ObserveAdmissionStep

func (m *AdmissionMetrics) ObserveAdmissionStep(ctx context.Context, elapsed time.Duration, rejected bool, attr admission.Attributes, stepType string, extraLabels ...string)

ObserveAdmissionStep records admission related metrics for a admission step, identified by step type.

func (*AdmissionMetrics) ObserveMatchConditionEvalError added in v0.27.0

func (m *AdmissionMetrics) ObserveMatchConditionEvalError(ctx context.Context, name, kind, stepType, operation string)

ObserveMatchConditionEvalError records validating or mutating webhook that are not called due to match conditions

func (*AdmissionMetrics) ObserveMatchConditionEvaluationTime added in v0.28.0

func (m *AdmissionMetrics) ObserveMatchConditionEvaluationTime(ctx context.Context, elapsed time.Duration, name, kind, stepType, operation string)

ObserveMatchConditionEvaluationTime records duration of match condition evaluation process.

func (*AdmissionMetrics) ObserveMatchConditionExclusion added in v0.28.0

func (m *AdmissionMetrics) ObserveMatchConditionExclusion(ctx context.Context, name, kind, stepType, operation string)

ObserveMatchConditionExclusion records validating or mutating webhook that are not called due to match conditions

func (*AdmissionMetrics) ObserveWebhook

func (m *AdmissionMetrics) ObserveWebhook(ctx context.Context, name string, elapsed time.Duration, rejected bool, attr admission.Attributes, stepType string, code int)

ObserveWebhook records admission related metrics for a admission webhook.

func (*AdmissionMetrics) ObserveWebhookFailOpen added in v0.24.0

func (m *AdmissionMetrics) ObserveWebhookFailOpen(ctx context.Context, name, stepType string)

ObserveWebhookFailOpen records validating or mutating webhook that fail open.

func (*AdmissionMetrics) ObserveWebhookRejection added in v0.16.4

func (m *AdmissionMetrics) ObserveWebhookRejection(ctx context.Context, name, stepType, operation string, errorType WebhookRejectionErrorType, rejectionCode int)

ObserveWebhookRejection records admission related metrics for an admission webhook rejection.

type ObserverFunc

type ObserverFunc func(ctx context.Context, elapsed time.Duration, rejected bool, attr admission.Attributes, stepType string, extraLabels ...string)

ObserverFunc is a func that emits metrics.

type WebhookRejectionErrorType added in v0.16.4

type WebhookRejectionErrorType string

WebhookRejectionErrorType defines different error types that happen in a webhook rejection.

const (

	// WebhookRejectionCallingWebhookError identifies a calling webhook error which causes
	// a webhook admission to reject a request
	WebhookRejectionCallingWebhookError WebhookRejectionErrorType = "calling_webhook_error"
	// WebhookRejectionAPIServerInternalError identifies an apiserver internal error which
	// causes a webhook admission to reject a request
	WebhookRejectionAPIServerInternalError WebhookRejectionErrorType = "apiserver_internal_error"
	// WebhookRejectionNoError identifies a webhook properly rejected a request
	WebhookRejectionNoError WebhookRejectionErrorType = "no_error"
)

Jump to

Keyboard shortcuts

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