metrics

package
v0.31.0-rc.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

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

Jump to

Keyboard shortcuts

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