package metrics
import "k8s.io/apiserver/plugin/pkg/authorizer/webhook/metrics"
Index ¶
- func RegisterWebhookMetrics()
- func ResetMetricsForTest()
- func ResetWebhookMetricsForTest()
- type AuthorizerMetrics
- type NoopAuthorizerMetrics
- type NoopRequestMetrics
- func (NoopRequestMetrics) RecordRequestLatency(context.Context, string, float64)
- func (NoopRequestMetrics) RecordRequestTotal(context.Context, string)
- type NoopWebhookMetrics
- func (NoopWebhookMetrics) RecordWebhookDuration(ctx context.Context, name, result string, duration float64)
- func (NoopWebhookMetrics) RecordWebhookEvaluation(ctx context.Context, name, result string)
- func (NoopWebhookMetrics) RecordWebhookFailOpen(ctx context.Context, name, result string)
- type RequestMetrics
- type WebhookMetrics
Functions ¶
func RegisterWebhookMetrics ¶
func RegisterWebhookMetrics()
RegisterMetrics registers authorizer metrics.
func ResetMetricsForTest ¶
func ResetMetricsForTest()
func ResetWebhookMetricsForTest ¶
func ResetWebhookMetricsForTest()
Types ¶
type AuthorizerMetrics ¶
type AuthorizerMetrics interface {
// Request total and latency metrics
RequestMetrics
// Webhook count, latency, and fail open metrics
WebhookMetrics
// match condition metrics
cel.MatcherMetrics
}
AuthorizerMetrics specifies a set of methods that are used to register various metrics for the webhook authorizer
type NoopAuthorizerMetrics ¶
type NoopAuthorizerMetrics struct {
NoopRequestMetrics
NoopWebhookMetrics
cel.NoopMatcherMetrics
}
type NoopRequestMetrics ¶
type NoopRequestMetrics struct{}
func (NoopRequestMetrics) RecordRequestLatency ¶
func (NoopRequestMetrics) RecordRequestLatency(context.Context, string, float64)
func (NoopRequestMetrics) RecordRequestTotal ¶
func (NoopRequestMetrics) RecordRequestTotal(context.Context, string)
type NoopWebhookMetrics ¶
type NoopWebhookMetrics struct{}
func (NoopWebhookMetrics) RecordWebhookDuration ¶
func (NoopWebhookMetrics) RecordWebhookDuration(ctx context.Context, name, result string, duration float64)
func (NoopWebhookMetrics) RecordWebhookEvaluation ¶
func (NoopWebhookMetrics) RecordWebhookEvaluation(ctx context.Context, name, result string)
func (NoopWebhookMetrics) RecordWebhookFailOpen ¶
func (NoopWebhookMetrics) RecordWebhookFailOpen(ctx context.Context, name, result string)
type RequestMetrics ¶
type RequestMetrics interface {
// RecordRequestTotal increments the total number of requests for the webhook authorizer
RecordRequestTotal(ctx context.Context, code string)
// RecordRequestLatency measures request latency in seconds for webhooks. Broken down by status code.
RecordRequestLatency(ctx context.Context, code string, latency float64)
}
type WebhookMetrics ¶
type WebhookMetrics interface {
// RecordWebhookEvaluation increments with each round-trip of a webhook authorizer.
// result is one of:
// - canceled: the call invoking the webhook request was canceled
// - timeout: the webhook request timed out
// - error: the webhook response completed and was invalid
// - success: the webhook response completed and was well-formed
RecordWebhookEvaluation(ctx context.Context, name, result string)
// RecordWebhookDuration records latency for each round-trip of a webhook authorizer.
// result is one of:
// - canceled: the call invoking the webhook request was canceled
// - timeout: the webhook request timed out
// - error: the webhook response completed and was invalid
// - success: the webhook response completed and was well-formed
RecordWebhookDuration(ctx context.Context, name, result string, duration float64)
// RecordWebhookFailOpen increments when a webhook timeout or error results in a fail open
// of a request which has not been canceled.
// result is one of:
// - timeout: the webhook request timed out
// - error: the webhook response completed and was invalid
RecordWebhookFailOpen(ctx context.Context, name, result string)
}
func NewWebhookMetrics ¶
func NewWebhookMetrics() WebhookMetrics
Source Files ¶
metrics.go
- Version
- v0.36.0 (latest)
- Published
- Apr 22, 2026
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 4 days ago –
Tools for package owners.