metrics

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package metrics defines and registers all kro Prometheus metrics. Call Register with a prometheus.Registerer to wire everything up.

Index

Constants

This section is empty.

Variables

View Source
var (
	ExprEvalTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "cel_expr_eval_total",
			Help: "Total number of CEL expression evaluations",
		},
	)

	ExprEvalDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "cel_expr_eval_duration_seconds",
			Help:    "Duration of CEL expression evaluations in seconds",
			Buckets: prometheus.DefBuckets,
		},
	)
)
View Source
var (
	DynReconcileTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "dynamic_controller_reconcile_total",
			Help: "Total number of reconciliations per GVR",
		},
		[]string{"gvr"},
	)
	DynRequeueTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "dynamic_controller_requeue_total",
			Help: "Total number of requeues per GVR",
		},
		[]string{"gvr", "type"},
	)
	DynReconcileDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "dynamic_controller_reconcile_duration_seconds",
			Help:    "Duration of reconciliations per GVR",
			Buckets: []float64{.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20, 25, 30, 45, 60, 120},
		},
		[]string{"gvr"},
	)
	DynGVRCount = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "dynamic_controller_gvr_count",
			Help: "Number of Instance GVRs currently managed by the controller",
		},
	)
	DynQueueLength = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "dynamic_controller_queue_length",
			Help: "Current length of the workqueue",
		},
	)
	DynHandlerCount = prometheus.NewGaugeVec(prometheus.GaugeOpts{
		Name: "dynamic_controller_handler_count_total",
		Help: "Number of active handlers used for distributing events to instance controllers",
	}, []string{"type"})
	DynHandlerAttachTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "dynamic_controller_handler_attach_total",
		Help: "Total number of handler attachments by handler type",
	}, []string{"type"})
	DynHandlerDetachTotal = prometheus.NewCounterVec(prometheus.CounterOpts{
		Name: "dynamic_controller_handler_detach_total",
		Help: "Total number of handler detachments by handler type",
	}, []string{"type"})
	DynHandlerErrorsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "dynamic_controller_handler_errors_total",
			Help: "Total number of errors encountered by handlers per GVR",
		},
		[]string{"gvr"},
	)
	DynInformerSyncDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "dynamic_controller_informer_sync_duration_seconds",
			Help:    "Duration of informer cache sync per GVR",
			Buckets: []float64{.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20, 25, 30, 45, 60, 120},
		},
		[]string{"gvr"},
	)
	DynInformerEventsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "dynamic_controller_informer_events_total",
			Help: "Total number of events processed by informers per GVR and event type",
		},
		[]string{"gvr", "event_type"},
	)
	DynWatchCount = prometheus.NewGauge(
		prometheus.GaugeOpts{
			Name: "dynamic_controller_watch_count",
			Help: "Number of active informers managed by the WatchManager",
		},
	)
	DynInstanceWatchCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "dynamic_controller_instance_watch_count",
			Help: "Number of active instance watchers by parent GVR",
		},
		[]string{"parent_gvr"},
	)
	DynWatchRequestCount = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "dynamic_controller_watch_request_count",
			Help: "Number of active watch requests by GVR and type (scalar/collection)",
		},
		[]string{"gvr", "type"},
	)
	DynRouteTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "dynamic_controller_route_total",
			Help: "Total events routed through the coordinator by GVR",
		},
		[]string{"gvr"},
	)
	DynRouteMatchTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "dynamic_controller_route_match_total",
			Help: "Total events that matched at least one instance by GVR",
		},
		[]string{"gvr"},
	)
)
View Source
var (
	GraphRevisionCompileTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "graph_revision_compile_total",
			Help: "Total number of GraphRevision compile attempts by result",
		},
		graphRevisionCompileLabels,
	)

	GraphRevisionCompileDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "graph_revision_compile_duration_seconds",
			Help:    "Duration of GraphRevision compile attempts in seconds",
			Buckets: []float64{.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20, 25, 30, 45, 60, 120},
		},
		graphRevisionCompileLabels,
	)

	GraphRevisionStatusUpdateErrorsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "graph_revision_status_update_errors_total",
			Help: "Total number of GraphRevision status update failures",
		},
		[]string{},
	)

	GraphRevisionActivationDeferredTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "graph_revision_activation_deferred_total",
			Help: "Total number of times GraphRevision activation was deferred until status persistence succeeds",
		},
		[]string{},
	)

	GraphRevisionFinalizerEvictionsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "graph_revision_finalizer_evictions_total",
			Help: "Total number of registry evictions triggered by GraphRevision finalizer cleanup",
		},
		[]string{},
	)
)
View Source
var (
	InstanceStateTransitionsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "instance_state_transitions_total",
			Help: "Total number of instance state transitions per GVR",
		},
		[]string{"gvr", "from_state", "to_state"},
	)

	InstanceReconcileDurationSeconds = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "instance_reconcile_duration_seconds",
			Help:    "Duration of instance reconciliation in seconds per GVR",
			Buckets: []float64{.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20, 25, 30, 45, 60, 120},
		},
		[]string{"gvr"},
	)

	InstanceReconcileTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "instance_reconcile_total",
			Help: "Total number of instance reconciliations per GVR",
		},
		[]string{"gvr"},
	)

	InstanceReconcileErrorsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "instance_reconcile_errors_total",
			Help: "Total number of instance reconciliation errors per GVR",
		},
		[]string{"gvr"},
	)

	InstanceGraphResolutionSuccessTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "instance_graph_resolution_success_total",
			Help: "Total number of successful graph resolutions during instance reconciliation",
		},
		[]string{"gvr"},
	)

	InstanceGraphResolutionFailuresTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "instance_graph_resolution_failures_total",
			Help: "Total number of graph resolution failures during instance reconciliation",
		},
		[]string{"gvr", "reason"},
	)

	InstanceGraphResolutionPendingTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "instance_graph_resolution_pending_total",
			Help: "Total number of graph resolutions deferred due to pending revision",
		},
		[]string{"gvr"},
	)
)
View Source
var (
	GraphRevisionRegistryEntries = prometheus.NewGaugeVec(
		prometheus.GaugeOpts{
			Name: "graph_revision_registry_entries",
			Help: "Current number of GraphRevision entries in the in-memory registry by state",
		},
		graphRevisionRegistryStateLabels,
	)

	GraphRevisionRegistryTransitions = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "graph_revision_registry_transitions_total",
			Help: "Total number of GraphRevision registry state transitions",
		},
		graphRevisionRegistryTransitionLabels,
	)

	GraphRevisionRegistryEvictions = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "graph_revision_registry_evictions_total",
			Help: "Total number of GraphRevision registry evictions",
		},
		[]string{},
	)
)
View Source
var (
	RGDGraphBuildTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_build_total",
			Help: "Total number of resource graph builds",
		},
		rgdLabels,
	)

	RGDGraphBuildDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "rgd_graph_build_duration_seconds",
			Help:    "Duration of resource graph builds in seconds",
			Buckets: []float64{.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20, 25, 30, 45, 60, 120},
		},
		rgdLabels,
	)

	RGDGraphBuildErrorsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_build_errors_total",
			Help: "Total number of resource graph build errors",
		},
		rgdLabels,
	)

	RGDStateTransitionsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_state_transitions_total",
			Help: "Total number of RGD state transitions",
		},
		rgdStateTransitionLabels,
	)

	RGDDeletionsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_deletions_total",
			Help: "Total number of RGD deletions",
		},
		rgdLabels,
	)

	RGDDeletionDuration = prometheus.NewHistogramVec(
		prometheus.HistogramOpts{
			Name:    "rgd_deletion_duration_seconds",
			Help:    "Duration of RGD deletions in seconds",
			Buckets: []float64{.01, .05, .1, .25, .5, 1, 2.5, 5, 10, 15, 20, 25, 30, 45, 60, 120},
		},
		rgdLabels,
	)

	RGDGraphRevisionIssueTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_revision_issue_total",
			Help: "Total number of GraphRevision objects issued by the RGD controller",
		},
		rgdGraphRevisionReasonLabel,
	)

	RGDGraphRevisionWaitTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_revision_wait_total",
			Help: "Total number of times the RGD controller waited for GraphRevision progress",
		},
		rgdGraphRevisionReasonLabel,
	)

	RGDGraphRevisionResolutionTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_revision_resolution_total",
			Help: "Total number of GraphRevision resolution outcomes in the RGD controller",
		},
		rgdGraphRevisionResultLabel,
	)

	RGDGraphRevisionRegistryMissTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_revision_registry_miss_total",
			Help: "Total number of times the RGD controller observed GraphRevisions ahead of the in-memory registry",
		},
		rgdGraphRevisionReasonLabel,
	)

	RGDGraphRevisionGCDeletedTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_revision_gc_deleted_total",
			Help: "Total number of GraphRevision objects deleted by RGD garbage collection",
		},
		[]string{},
	)

	RGDGraphRevisionGCErrorsTotal = prometheus.NewCounterVec(
		prometheus.CounterOpts{
			Name: "rgd_graph_revision_gc_errors_total",
			Help: "Total number of GraphRevision garbage collection errors in the RGD controller",
		},
		[]string{},
	)
)
View Source
var (
	NodeEvalTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_node_eval_total",
			Help: "Total number of node evaluations during reconciliation",
		},
	)

	NodeEvalDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "runtime_node_eval_duration_seconds",
			Help:    "Duration of node evaluations during reconciliation in seconds",
			Buckets: prometheus.DefBuckets,
		},
	)

	NodeEvalErrorsTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_node_eval_errors_total",
			Help: "Total number of node evaluation errors",
		},
	)

	RuntimeCreationTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_creation_total",
			Help: "Total number of runtimes created",
		},
	)

	RuntimeCreationDuration = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "runtime_creation_duration_seconds",
			Help:    "Duration of runtime creation setup phase in seconds",
			Buckets: prometheus.DefBuckets,
		},
	)

	NodeIgnoredCheckTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_node_ignored_check_total",
			Help: "Total number of node includeWhen checks",
		},
	)

	NodeIgnoredTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_node_ignored_total",
			Help: "Total number of nodes skipped due to includeWhen conditions",
		},
	)

	NodeReadyCheckTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_node_ready_check_total",
			Help: "Total number of node readyWhen checks",
		},
	)

	NodeNotReadyTotal = prometheus.NewCounter(
		prometheus.CounterOpts{
			Name: "runtime_node_not_ready_total",
			Help: "Total number of times nodes were not ready and blocked reconciliation",
		},
	)

	CollectionSize = prometheus.NewHistogram(
		prometheus.HistogramOpts{
			Name:    "runtime_collection_size",
			Help:    "Number of items generated by forEach collection expansion",
			Buckets: prometheus.ExponentialBuckets(1, 2, 10),
		},
	)
)
View Source
var (
	SchemaResolverCacheHitsTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "schema_resolver_cache_hits_total",
		Help: "Total number of schema resolver cache hits",
	})
	SchemaResolverCacheMissesTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "schema_resolver_cache_misses_total",
		Help: "Total number of schema resolver cache misses",
	})

	SchemaResolverCacheSize = prometheus.NewGauge(prometheus.GaugeOpts{
		Name: "schema_resolver_cache_size",
		Help: "Current number of entries in the schema resolver cache",
	})

	SchemaResolverCacheEvictionsTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "schema_resolver_cache_evictions_total",
		Help: "Total number of entries evicted from the schema resolver cache",
	})

	SchemaResolverAPICallDuration = prometheus.NewHistogram(prometheus.HistogramOpts{
		Name:    "schema_resolver_api_call_duration_seconds",
		Help:    "Duration of API calls to fetch schemas",
		Buckets: prometheus.ExponentialBuckets(0.01, 2, 10),
	})

	SchemaResolverSingleflightDeduplicatedTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "schema_resolver_singleflight_deduplicated_total",
		Help: "Total number of requests that were deduplicated by singleflight",
	})

	SchemaResolutionErrorsTotal = prometheus.NewCounter(prometheus.CounterOpts{
		Name: "schema_resolver_errors_total",
		Help: "Total number of schema resolution errors",
	})
)

Functions

func Register

func Register(registry prometheus.Registerer)

Register registers all kro metrics with the given Prometheus registerer.

Types

This section is empty.

Jump to

Keyboard shortcuts

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