Documentation
¶
Overview ¶
Package metrics provides centralized metric names and registration functions for shell-operator. All metric names use constants to ensure consistency and prevent typos. The {PREFIX} placeholder is replaced by the metrics storage with the appropriate prefix.
Index ¶
- Constants
- func RegisterCommonMetrics(metricStorage metricsstorage.Storage) error
- func RegisterHookMetrics(metricStorage metricsstorage.Storage) error
- func RegisterKubeEventsManagerMetrics(metricStorage metricsstorage.Storage, labels []string) error
- func RegisterOperatorMetrics(metricStorage metricsstorage.Storage, kubeEventManagerLabels []string) error
- func RegisterTaskQueueMetrics(metricStorage metricsstorage.Storage) error
Constants ¶
const ( // ============================================================================ // Common Metrics // ============================================================================ // LiveTicks is a counter that increases every 10 seconds to indicate shell-operator is alive LiveTicks = "{PREFIX}live_ticks" // ============================================================================ // Task Queue Metrics // ============================================================================ // TasksQueueActionDurationSeconds measures task queue operation durations TasksQueueActionDurationSeconds = "{PREFIX}tasks_queue_action_duration_seconds" // TasksQueueLength shows the current length of the task queue TasksQueueLength = "{PREFIX}tasks_queue_length" // TasksQueueCompactionInQueueTasks tracks telemetry for queue compaction TasksQueueCompactionInQueueTasks = "d8_telemetry_{PREFIX}tasks_queue_compaction_in_queue_tasks" // TasksQueueCompactionReached tracks when queue compaction is reached TasksQueueCompactionReached = "d8_telemetry_{PREFIX}tasks_queue_compaction_reached" // ============================================================================ // Hook Execution Metrics // ============================================================================ // Kubernetes Bindings HookEnableKubernetesBindingsSeconds = "{PREFIX}hook_enable_kubernetes_bindings_seconds" HookEnableKubernetesBindingsErrorsTotal = "{PREFIX}hook_enable_kubernetes_bindings_errors_total" HookEnableKubernetesBindingsSuccess = "{PREFIX}hook_enable_kubernetes_bindings_success" // Hook Runtime Metrics HookRunSeconds = "{PREFIX}hook_run_seconds" HookRunUserCPUSeconds = "{PREFIX}hook_run_user_cpu_seconds" HookRunSysCPUSeconds = "{PREFIX}hook_run_sys_cpu_seconds" HookRunMaxRSSBytes = "{PREFIX}hook_run_max_rss_bytes" // Hook Execution Results HookRunErrorsTotal = "{PREFIX}hook_run_errors_total" HookRunAllowedErrorsTotal = "{PREFIX}hook_run_allowed_errors_total" HookRunSuccessTotal = "{PREFIX}hook_run_success_total" // Task Queue Wait Time TaskWaitInQueueSecondsTotal = "{PREFIX}task_wait_in_queue_seconds_total" // ============================================================================ // Kubernetes Events Manager Metrics // ============================================================================ // KubeSnapshotObjects counts cached objects for particular bindings KubeSnapshotObjects = "{PREFIX}kube_snapshot_objects" // KubeJqFilterDurationSeconds measures jq filter execution time KubeJqFilterDurationSeconds = "{PREFIX}kube_jq_filter_duration_seconds" // KubeEventDurationSeconds measures Kubernetes event handling time KubeEventDurationSeconds = "{PREFIX}kube_event_duration_seconds" // KubernetesClientWatchErrorsTotal counts Kubernetes client watch errors KubernetesClientWatchErrorsTotal = "{PREFIX}kubernetes_client_watch_errors_total" )
Metric name constants organized by functional area. Each constant represents a unique metric name used throughout shell-operator.
Variables ¶
This section is empty.
Functions ¶
func RegisterCommonMetrics ¶
func RegisterCommonMetrics(metricStorage metricsstorage.Storage) error
RegisterCommonMetrics registers base metrics used across shell-operator and addon-operator. These are fundamental metrics that indicate the health and activity of the operator.
func RegisterHookMetrics ¶
func RegisterHookMetrics(metricStorage metricsstorage.Storage) error
RegisterHookMetrics registers all hook-related metrics with the provided storage. This includes metrics for hook execution, Kubernetes bindings, and resource usage. Used specifically by shell-operator's HookManager.
func RegisterKubeEventsManagerMetrics ¶
func RegisterKubeEventsManagerMetrics(metricStorage metricsstorage.Storage, labels []string) error
RegisterKubeEventsManagerMetrics registers metrics for Kubernetes events manager. These metrics monitor Kubernetes API interactions, object caching, and event processing. Used by both shell-operator and addon-operator.
func RegisterOperatorMetrics ¶
func RegisterOperatorMetrics(metricStorage metricsstorage.Storage, kubeEventManagerLabels []string) error
func RegisterTaskQueueMetrics ¶
func RegisterTaskQueueMetrics(metricStorage metricsstorage.Storage) error
RegisterTaskQueueMetrics registers metrics related to task queue operations and performance. Used by both shell-operator and addon-operator to monitor queue health and performance.
Types ¶
This section is empty.