metrics

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	WorkQueueSubsystem         = "workqueue"
	DepthKey                   = "depth"
	AddsKey                    = "adds_total"
	QueueLatencyKey            = "queue_duration_seconds"
	WorkDurationKey            = "work_duration_seconds"
	UnfinishedWorkKey          = "unfinished_work_seconds"
	LongestRunningProcessorKey = "longest_running_processor_seconds"
	RetriesKey                 = "retries_total"
)

Metrics subsystem and all keys used by the workqueue.

Variables

View Source
var (
	TotalControllerExecutions = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Subsystem: lassoSubsystem,
			Name:      "total_handler_execution",
			Help:      "Total count of handler executions",
		},
		[]string{controllerNameLabel, handlerNameLabel, hasErrorLabel},
	)
	TotalCachedObjects = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Subsystem: lassoSubsystem,
			Name:      "total_cached_object",
			Help:      "Total count of cached objects",
		},
		[]string{contextLabel, groupLabel, versionLabel, kindLabel},
	)
)

Functions

func ContextID added in v0.2.0

func ContextID(ctx context.Context) string

ContextID extracts the identifier previously set by WithContextID, returning an empty string otherwise

func DelTotalCachedObjects added in v0.2.0

func DelTotalCachedObjects(ctxID string, gvk schema.GroupVersionKind)

DelTotalCachedObjects deletes the cached items count metric matching the provided content and GroupVersionKind

func Enabled added in v0.2.0

func Enabled() bool

func IncTotalCachedObjects

func IncTotalCachedObjects(ctxID string, gvk schema.GroupVersionKind, count int)

IncTotalCachedObjects sets the cached items count for the specified context and GroupVersionKind

func IncTotalHandlerExecutions

func IncTotalHandlerExecutions(controllerName, handlerName string, hasError bool)

func MustRegister added in v0.2.0

func MustRegister(registerer prometheus.Registerer)

MustRegister registers only lasso-specific metrics. This must be used if attempting to register Lasso metrics to the same registerer as used by Kubernetes itself, otherwise prometheus will panic when both packages register metrics with the same name.

func MustRegisterWithWorkqueue added in v0.2.0

func MustRegisterWithWorkqueue(registerer prometheus.Registerer)

MustRegisterWithWorkqueue registers all metrics, including Kubernetes internal workqueue metrics, with the provided registerer

func ReportReconcileTime

func ReportReconcileTime(controllerName, handlerName string, hasError bool, observeTime float64)

func WithContextID added in v0.2.0

func WithContextID(ctx context.Context, id string) context.Context

WithContextID stores an identifier within the Context for later use when collecting metrics

Types

This section is empty.

Jump to

Keyboard shortcuts

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