Documentation
¶
Overview ¶
Package metrics provides centralized metric label key constants for deckhouse-controller. All metric label keys are defined here to ensure consistency and prevent typos.
Package metrics provides centralized metric names for deckhouse-controller. All metric names use constants to ensure consistency and prevent typos. The deckhouse_ placeholder is replaced by the metrics storage with the appropriate prefix.
Index ¶
- Constants
- func ExpireHooklane(g PackageGauges, pkg string)
- func ExpirePackage(g PackageGauges, pkg string)
- func ModuleConfigurationErrorLabels(moduleName, version, errorMsg string) map[string]string
- func ModuleReleaseMetricsGroupName(moduleName, version string) string
- func RegisterAddonHookMetrics(metricStorage metricsstorage.Storage) error
- func RegisterDeckhouseControllerMetrics(metricStorage metricsstorage.Storage) error
- func RegisterKubeEventsManagerMetrics(metricStorage metricsstorage.Storage, labels []string) error
- func RegisterShellCommonMetrics(metricStorage metricsstorage.Storage) error
- func RegisterShellHookMetrics(metricStorage metricsstorage.Storage) error
- func RegisterShellOperatorMetrics(metricStorage metricsstorage.Storage, kubeEventManagerLabels []string) error
- func SetHookLastRun(g PackageGauges, pkg, hook, binding string, took time.Duration)
- func SetHooklaneLength(g PackageGauges, pkg, lane string, length int)
- func SetHooklaneState(g PackageGauges, pkg, lane, state string, active bool)
- func SetPackageRun(g PackageGauges, pkg, phase string, took time.Duration)
- func SetPackageStartup(g PackageGauges, pkg, phase string, took time.Duration)
- func StartAddonLiveTicksUpdater(metricStorage metricsstorage.Storage)
- func WrapTelemetryMetric(metricName string) string
- type PackageGauges
Constants ¶
const ( // LabelModule is the label key for the module name. LabelModule = "module" // LabelSource is the label key for the module source name. LabelSource = "source" // LabelVersion is the label key for the release or module version. LabelVersion = "version" // LabelError is the label key for an error message. LabelError = "error" // LabelName is the label key for a generic resource name. LabelName = "name" // LabelModuleRelease is the label key for the module release name. LabelModuleRelease = "moduleRelease" // LabelRegistry is the label key for the registry URL. LabelRegistry = "registry" // LabelActualVersion is the label key for the currently deployed version. LabelActualVersion = "actualVersion" // LabelDeployingRelease is the label key for the name of the release being deployed. LabelDeployingRelease = "deployingRelease" // LabelManualApprovalRequired indicates whether manual approval is required. LabelManualApprovalRequired = "manualApproval" // LabelDisruptionApprovalRequired indicates whether disruption approval is required. LabelDisruptionApprovalRequired = "disruptionApproval" // LabelRequirementsNotMet indicates whether release requirements are not met. LabelRequirementsNotMet = "requirementsNotMet" // LabelReleaseQueueDepth is the label key for the release queue depth. LabelReleaseQueueDepth = "releaseQueueDepth" // LabelMajorReleaseDepth is the label key for the major release queue depth. LabelMajorReleaseDepth = "majorReleaseDepth" // LabelMajorReleaseName is the label key for the major release name. LabelMajorReleaseName = "majorReleaseName" // LabelFromToName is the label key for the from-to release name in step-by-step updates. LabelFromToName = "fromToName" // LabelNotificationNotSent indicates whether an update notification has not been sent. LabelNotificationNotSent = "notificationNotSent" // LabelHook is the label key for the hook name. LabelHook = "hook" // LabelBinding is the label key for the hook binding name. LabelBinding = "binding" // LabelKind is the Kubernetes kind a hook's binding watches. LabelKind = "kind" // LabelPackage is the label key for the package (module, application or global) a metric describes. LabelPackage = "package" // LabelPhase is the label key for the phase of a package's run or startup. LabelPhase = "phase" // LabelLane is the label key for the hook lane of a package. LabelLane = "lane" // LabelState is the label key for the state of a hook lane. LabelState = "state" // LabelQueue is the label key for the task queue name. LabelQueue = "queue" // LabelOperation is the label key for the Helm operation. LabelOperation = "operation" // LabelErrorType is the label key for the error type. LabelErrorType = "error_type" // LabelResource is the label key for the resource reference (namespace/kind/name). LabelResource = "resource" // LabelGVR is the label key for the GroupVersionResource of a shared informer. LabelGVR = "gvr" // LabelNamespace is the label key for the namespace. LabelNamespace = "namespace" // LabelWorkload is the label key for the name of an application workload. LabelWorkload = "workload" // LabelContainer is the label key for the name of a workload container. LabelContainer = "container" // LabelAutoscaler is the label key for the kind of autoscaler. LabelAutoscaler = "autoscaler" LabelBilling = "billing" LabelRecordID = "record_id" LabelLicense = "license" LabelType = "type" LabelStatus = "status" LabelReason = "reason" )
const ( // ============================================================================ // Configuration Metrics // ============================================================================ // BindingCount tracks the number of bindings per module and hook BindingCount = "deckhouse_binding_count" // ConfigValuesErrorsTotal counts ConfigMap validation errors ConfigValuesErrorsTotal = "deckhouse_config_values_errors_total" // ============================================================================ // Module Metrics // ============================================================================ // ModulesDiscoverErrorsTotal counts errors during module discovery ModulesDiscoverErrorsTotal = "deckhouse_modules_discover_errors_total" // ModuleDeleteErrorsTotal counts errors during module deletion ModuleDeleteErrorsTotal = "deckhouse_module_delete_errors_total" // ModuleRunSeconds measures module execution time ModuleRunSeconds = "deckhouse_module_run_seconds" // ModuleRunErrorsTotal counts module execution errors ModuleRunErrorsTotal = "deckhouse_module_run_errors_total" // ModulesHelmReleaseRedeployedTotal counts Helm release redeployments ModulesHelmReleaseRedeployedTotal = "deckhouse_modules_helm_release_redeployed_total" // ModulesAbsentResourcesTotal counts absent resources per module ModulesAbsentResourcesTotal = "deckhouse_modules_absent_resources_total" // ModuleInfoMetricName tracks module information ModuleInfoMetricName = "deckhouse_mm_module_info" // ModuleEnabledMetricName tracks enabled modules with their deployed version ModuleEnabledMetricName = "deckhouse_mm_module_enabled" // ModuleEnabledTelemetryMetricName mirrors ModuleEnabledMetricName under the // d8_telemetry_ prefix so flant-integration ships the metric to DOP. // It intentionally has no deckhouse_ prefix and must stay that way. ModuleEnabledTelemetryMetricName = "d8_telemetry_module_enabled" // ModuleMaintenanceMetricName tracks module maintenance state ModuleMaintenanceMetricName = "deckhouse_mm_module_maintenance" // ============================================================================ // Module Hook Metrics // ============================================================================ // ModuleHookRunSeconds measures module hook execution time ModuleHookRunSeconds = "deckhouse_module_hook_run_seconds" // ModuleHookRunUserCPUSeconds measures module hook user CPU usage ModuleHookRunUserCPUSeconds = "deckhouse_module_hook_run_user_cpu_seconds" // ModuleHookRunSysCPUSeconds measures module hook system CPU usage ModuleHookRunSysCPUSeconds = "deckhouse_module_hook_run_sys_cpu_seconds" // ModuleHookRunMaxRSSBytes tracks maximum resident set size for module hooks ModuleHookRunMaxRSSBytes = "deckhouse_module_hook_run_max_rss_bytes" // ModuleHookAllowedErrorsTotal counts allowed module hook errors ModuleHookAllowedErrorsTotal = "deckhouse_module_hook_allowed_errors_total" // ModuleHookErrorsTotal counts module hook execution errors ModuleHookErrorsTotal = "deckhouse_module_hook_errors_total" // ModuleHookSuccessTotal counts successful module hook executions ModuleHookSuccessTotal = "deckhouse_module_hook_success_total" // ============================================================================ // Global Hook Metrics // ============================================================================ // GlobalHookRunSeconds measures global hook execution time GlobalHookRunSeconds = "deckhouse_global_hook_run_seconds" // GlobalHookRunUserCPUSeconds measures global hook user CPU usage GlobalHookRunUserCPUSeconds = "deckhouse_global_hook_run_user_cpu_seconds" // GlobalHookRunSysCPUSeconds measures global hook system CPU usage GlobalHookRunSysCPUSeconds = "deckhouse_global_hook_run_sys_cpu_seconds" // GlobalHookRunMaxRSSBytes tracks maximum resident set size for global hooks GlobalHookRunMaxRSSBytes = "deckhouse_global_hook_run_max_rss_bytes" // GlobalHookAllowedErrorsTotal counts allowed global hook errors GlobalHookAllowedErrorsTotal = "deckhouse_global_hook_allowed_errors_total" // GlobalHookErrorsTotal counts global hook execution errors GlobalHookErrorsTotal = "deckhouse_global_hook_errors_total" // GlobalHookSuccessTotal counts successful global hook executions GlobalHookSuccessTotal = "deckhouse_global_hook_success_total" // ============================================================================ // Convergence Metrics // ============================================================================ // ConvergenceSeconds measures convergence duration ConvergenceSeconds = "deckhouse_convergence_seconds" // ConvergenceTotal counts convergence executions ConvergenceTotal = "deckhouse_convergence_total" // ============================================================================ // Helm Operations Metrics // ============================================================================ // HelmFallbackTotal counts how many times nelm operations had to fall back to helm3lib HelmFallbackTotal = "deckhouse_helm_fallback_total" // HelmFallbackTelemetryTotal mirrors HelmFallbackTotal under the d8_telemetry_ prefix so // flant-integration ships the metric to DOP. // It intentionally has no deckhouse_ prefix and must stay that way. HelmFallbackTelemetryTotal = "d8_telemetry_helm_fallback_total" // ============================================================================ // Live Ticks Metrics // ============================================================================ // AddonLiveTicks is a counter that increases every 10 seconds to indicate addon-operator is alive AddonLiveTicks = "deckhouse_live_ticks" )
Addon-operator metric names organized by functional area. Each constant represents a unique metric name used throughout addon-operator.
const ( // HookLastRunSeconds is the duration of the last run of a hook. HookLastRunSeconds = "deckhouse_hook_last_run_seconds" // PackageRunLastSeconds is the duration of the last successful phase of a package's run. PackageRunLastSeconds = "deckhouse_package_run_last_seconds" // PackageStartupLastSeconds is the duration of the last successful phase of a package's startup. PackageStartupLastSeconds = "deckhouse_package_startup_last_seconds" // ConvergenceLastSeconds is the duration of the last convergence, a startup one included. ConvergenceLastSeconds = "deckhouse_convergence_last_seconds" // HooklaneLength is the number of items in a hook lane, the one in flight included. HooklaneLength = "deckhouse_hooklane_length" // HooklaneState is 1 for the state a hook lane is in and 0 for the others. HooklaneState = "deckhouse_hooklane_state" )
Gauges of the package runtime: the last duration of a hook, of a phase of a package's run or startup, and of a convergence, and the state of the hook lanes.
const ( PhaseBeforeHelm = "before_helm" // PhaseBeforeHelm: the beforeHelm hooks of a run. PhaseHelm = "helm" // PhaseHelm: the release upgrade of a run. PhaseAfterHelm = "after_helm" // PhaseAfterHelm: the afterHelm hooks of a run. PhaseInitHooks = "init_hooks" // PhaseInitHooks: the hooks start and synchronize at startup. PhaseOnStartup = "on_startup" // PhaseOnStartup: the onStartup hooks of a startup. )
Phases of a package's run and startup.
const ( // ============================================================================ // Common Metrics // ============================================================================ // ShellLiveTicks is a counter that increases every 10 seconds to indicate shell-operator is alive ShellLiveTicks = "deckhouse_live_ticks" // ============================================================================ // Hook Execution Metrics // ============================================================================ // Kubernetes Bindings HookEnableKubernetesBindingsSeconds = "deckhouse_hook_enable_kubernetes_bindings_seconds" HookEnableKubernetesBindingsErrorsTotal = "deckhouse_hook_enable_kubernetes_bindings_errors_total" HookEnableKubernetesBindingsSuccess = "deckhouse_hook_enable_kubernetes_bindings_success" // Hook Runtime Metrics HookRunSeconds = "deckhouse_hook_run_seconds" HookRunUserCPUSeconds = "deckhouse_hook_run_user_cpu_seconds" HookRunSysCPUSeconds = "deckhouse_hook_run_sys_cpu_seconds" HookRunMaxRSSBytes = "deckhouse_hook_run_max_rss_bytes" // Hook Execution Results HookRunErrorsTotal = "deckhouse_hook_run_errors_total" HookRunAllowedErrorsTotal = "deckhouse_hook_run_allowed_errors_total" HookRunSuccessTotal = "deckhouse_hook_run_success_total" // ============================================================================ // Kubernetes Events Manager Metrics // ============================================================================ // KubeSnapshotObjects counts cached objects for particular bindings KubeSnapshotObjects = "deckhouse_kube_snapshot_objects" // KubeJqFilterDurationSeconds measures jq filter execution time KubeJqFilterDurationSeconds = "deckhouse_kube_jq_filter_duration_seconds" // KubeEventDurationSeconds measures Kubernetes event handling time KubeEventDurationSeconds = "deckhouse_kube_event_duration_seconds" // KubernetesClientWatchErrorsTotal counts Kubernetes client watch errors KubernetesClientWatchErrorsTotal = "deckhouse_kubernetes_client_watch_errors_total" // BindingMonitorMissingTotal counts snapshot reads for a configured kubernetes // binding whose monitor is not running: the hook receives an empty snapshot // instead of real cluster state. Non-zero values indicate lost or never-started // monitors (e.g. a Disable/Enable race) until the next EnableKubernetesBindings // repairs them. BindingMonitorMissingTotal = "deckhouse_binding_monitor_missing_total" // FactoryInformerDeadTotal counts dead shared informer factories detected and // recreated by FactoryStore.Start. Non-zero values mean some consumers lived // with a frozen snapshot until the recreation. FactoryInformerDeadTotal = "deckhouse_factory_informer_dead_total" )
Shell-operator metric names organized by functional area. Each constant represents a unique metric name used throughout shell-operator.
const ( // ============================================================================ // Module Manager Metrics // ============================================================================ // Migration and experimental module tracking MigratedModuleNotFoundMetricName = "d8_migrated_module_not_found" MigratedModuleNotDownloadedMetricName = "d8_migrated_module_not_downloaded" ExperimentalModulesAreAllowedMetricName = "is_experimental_modules_allowed" ExperimentalModuleIsEnabled = "is_experimental_module_enabled" DeprecatedModuleIsEnabled = "is_deprecated_module_enabled" // ============================================================================ // Deckhouse Release Controller Metrics // ============================================================================ // Registry and digest check counters DeckhouseRegistryCheckTotal = "deckhouse_registry_check_total" DeckhouseKubeImageDigestCheckTotal = "deckhouse_kube_image_digest_check_total" DeckhouseRegistryCheckErrorsTotal = "deckhouse_registry_check_errors_total" DeckhouseKubeImageDigestCheckSuccess = "deckhouse_kube_image_digest_check_success" // Update status gauges D8IsUpdating = "d8_is_updating" D8UpdatingIsFailed = "d8_updating_is_failed" // ============================================================================ // Module Config Controller Metrics // ============================================================================ // Configuration status tracking D8ModuleConfigObsoleteVersion = "d8_module_config_obsolete_version" D8ModuleAtConflict = "d8_module_at_conflict" D8ModuleConfigAllowedToDisable = "d8_moduleconfig_allowed_to_disable" // ============================================================================ // Module Source Controller Metrics // ============================================================================ // Source validation and sequence tracking D8ModuleUpdatingModuleIsNotValid = "d8_module_updating_module_is_not_valid" D8ModuleUpdatingBrokenSequence = "d8_module_updating_broken_sequence" // ============================================================================ // Module Release Controller Metrics // ============================================================================ // ============================================================================ // Licensing Controller Metrics // ============================================================================ D8LicenseComplianceState = "d8_license_compliance_state" D8LicenseLicensed = "d8_license_licensed" D8LicenseLimit = "d8_license_limit" D8LicenseConsumption = "d8_license_consumption" D8LicenseNodes = "d8_license_nodes" D8LicenseUnlicensedVCPU = "d8_license_unlicensed_vcpu" D8LicenseKeyExpiresInSeconds = "d8_license_key_expires_in_seconds" D8LicenseOverLimitSeconds = "d8_license_over_limit_seconds" D8LicenseRecords = "d8_license_records" D8LicenseRejectedKeys = "d8_license_rejected_keys" D8LicenseRecordActive = "d8_license_record_active" D8LicenseRecordAccepted = "d8_license_record_accepted" D8LicenseRecordGrant = "d8_license_record_grant" D8LicenseRecordExpiresInSeconds = "d8_license_record_expires_in_seconds" D8LicenseClusterKeyValid = "d8_license_cluster_key_valid" ModulePullSecondsTotal = "deckhouse_module_pull_seconds_total" ModuleSizeBytesTotal = "deckhouse_module_size_bytes_total" ModuleUpdatePolicyNotFound = "deckhouse_module_update_policy_not_found" ModuleConfigurationError = "deckhouse_module_configuration_error" // ============================================================================ // Application Metrics // ============================================================================ // ApplicationAutoscalerMissing is 1 for each range of an application's resource // requests that no autoscaler applies, so it falls back to fixed values; the // ApplicationHorizontalPodAutoscalerMissing and ApplicationVerticalPodAutoscalerMissing // alerts fire on it. ApplicationAutoscalerMissing = "deckhouse_application_autoscaler_missing" // ApplicationAutoscalerPinned is 1 for each fixed value of an application's resource // requests that an autoscaler scales, so the autoscaler is pinned to it; the // ApplicationHorizontalPodAutoscalerPinned and ApplicationVerticalPodAutoscalerPinned // alerts fire on it. ApplicationAutoscalerPinned = "deckhouse_application_autoscaler_pinned" // ============================================================================ // Module Installer Metrics // ============================================================================ // Module image downloads interrupted while the erofs image was built from them D8ModuleImageDownloadInterrupted = "d8_module_image_download_interrupted" )
Metric name constants organized by functional area. Each constant represents a unique metric name used throughout deckhouse-controller.
const ( MigratedModuleNotFoundGroup = "migrated_module_not_found" MigratedModuleNotDownloadedGroup = "migrated_module_not_downloaded" D8Updating = "d8_updating" D8ModuleUpdatingGroup = "d8_module_updating_group" ModuleReleaseGroup = "module_release_group" // LicensingGroup holds every licensing gauge, so that a series for a record // or a resource that disappeared from the policy expires with the group // instead of being exported forever at its last value. LicensingGroup = "d8_licensing" )
============================================================================ Metric Groups ============================================================================
const ( ObsoleteConfigMetricGroupTemplate = "obsoleteVersion_%s" ModuleConflictMetricGroupTemplate = "module_%s_at_conflict" ModuleImageDownloadMetricGroupTemplate = "module_%s_image_download" )
Group templates for dynamic metric names using fmt.Sprintf
const GlobalPackage = "global"
GlobalPackage is the package label of Global's hooks.
const Prefix = "deckhouse_"
Prefix is what every deckhouse-controller metric name starts with; the libraries' "{PREFIX}" placeholders resolve to it.
Variables ¶
This section is empty.
Functions ¶
func ExpireHooklane ¶ added in v1.78.0
func ExpireHooklane(g PackageGauges, pkg string)
ExpireHooklane drops the lane gauges of pkg, whose lanes are gone.
func ExpirePackage ¶ added in v1.78.0
func ExpirePackage(g PackageGauges, pkg string)
ExpirePackage drops every package-grouped gauge of pkg.
func ModuleConfigurationErrorLabels ¶ added in v1.75.0
ModuleConfigurationErrorLabels returns standard labels for the ModuleConfigurationError metric. This ensures consistent label usage across the codebase and matches the registered metric labels.
func ModuleReleaseMetricsGroupName ¶ added in v1.75.0
ModuleReleaseMetricsGroupName returns the unique metrics group name for a module release. This is a convenience function to standardize the naming of module release metrics groups in a centralized way.
func RegisterAddonHookMetrics ¶ added in v1.78.0
func RegisterAddonHookMetrics(metricStorage metricsstorage.Storage) error
RegisterAddonHookMetrics registers all addon-operator specific metrics with the provided storage. This includes configuration, module, hook, convergence and Helm metrics. Returns an error if any metric registration fails.
func RegisterDeckhouseControllerMetrics ¶ added in v1.73.0
func RegisterDeckhouseControllerMetrics(metricStorage metricsstorage.Storage) error
RegisterDeckhouseControllerMetrics registers all metrics used by deckhouse-controller. This function should be called during controller initialization to ensure all metrics are available when needed.
func RegisterKubeEventsManagerMetrics ¶ added in v1.78.0
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 RegisterShellCommonMetrics ¶ added in v1.78.0
func RegisterShellCommonMetrics(metricStorage metricsstorage.Storage) error
RegisterShellCommonMetrics registers base metrics used across shell-operator and addon-operator. These are fundamental metrics that indicate the health and activity of the operator.
func RegisterShellHookMetrics ¶ added in v1.78.0
func RegisterShellHookMetrics(metricStorage metricsstorage.Storage) error
RegisterShellHookMetrics registers all shell-operator hook-related metrics with the provided storage. This includes metrics for hook execution, Kubernetes bindings, and resource usage. Shell-operator registers them only when it runs standalone: under addon-operator the hook metrics come from RegisterAddonHookMetrics instead.
func RegisterShellOperatorMetrics ¶ added in v1.78.0
func RegisterShellOperatorMetrics(metricStorage metricsstorage.Storage, kubeEventManagerLabels []string) error
RegisterShellOperatorMetrics registers the built-in shell-operator metrics: common and Kubernetes events manager metrics. kubeEventManagerLabels are the label names of the Kubernetes events manager metrics, supplied by the embedding operator.
func SetHookLastRun ¶ added in v1.78.0
func SetHookLastRun(g PackageGauges, pkg, hook, binding string, took time.Duration)
SetHookLastRun records the duration of a hook's last run; Global's hooks use GlobalPackage.
func SetHooklaneLength ¶ added in v1.78.0
func SetHooklaneLength(g PackageGauges, pkg, lane string, length int)
SetHooklaneLength records the number of items in a lane.
func SetHooklaneState ¶ added in v1.78.0
func SetHooklaneState(g PackageGauges, pkg, lane, state string, active bool)
SetHooklaneState records whether a lane is in state.
func SetPackageRun ¶ added in v1.78.0
func SetPackageRun(g PackageGauges, pkg, phase string, took time.Duration)
SetPackageRun records the duration of a phase of a package's run.
func SetPackageStartup ¶ added in v1.78.0
func SetPackageStartup(g PackageGauges, pkg, phase string, took time.Duration)
SetPackageStartup records the duration of a phase of a package's startup.
func StartAddonLiveTicksUpdater ¶ added in v1.78.0
func StartAddonLiveTicksUpdater(metricStorage metricsstorage.Storage)
StartAddonLiveTicksUpdater starts a goroutine that periodically updates the live_ticks metric every 10 seconds. This metric can be used to verify that addon-operator is alive and functioning.
func WrapTelemetryMetric ¶ added in v1.73.0
WrapTelemetryMetric wraps a metric name with telemetry for consistent usage. This is a convenience function to standardize telemetry wrapping across the codebase.