node: metrics: register podresources metrics

Because of a bug in the commit 1e7bb20c52,
podresources metrics were added, they are updated in the right
places, but they are never exported, so they cannot be consumed.
Fix trivially registering the metrics.

Signed-off-by: Francesco Romani <fromani@redhat.com>
This commit is contained in:
Francesco Romani 2022-10-06 14:15:07 +02:00
parent 3c60c1a10c
commit ba6b468982

View File

@ -527,6 +527,16 @@ func Register(collectors ...metrics.StableCollector) {
legacyregistry.MustRegister(RunningContainerCount)
legacyregistry.MustRegister(RunningPodCount)
legacyregistry.MustRegister(ManagedEphemeralContainers)
if utilfeature.DefaultFeatureGate.Enabled(features.KubeletPodResources) {
legacyregistry.MustRegister(PodResourcesEndpointRequestsTotalCount)
if utilfeature.DefaultFeatureGate.Enabled(features.KubeletPodResourcesGetAllocatable) {
legacyregistry.MustRegister(PodResourcesEndpointRequestsListCount)
legacyregistry.MustRegister(PodResourcesEndpointRequestsGetAllocatableCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsListCount)
legacyregistry.MustRegister(PodResourcesEndpointErrorsGetAllocatableCount)
}
}
legacyregistry.MustRegister(StartedPodsTotal)
legacyregistry.MustRegister(StartedPodsErrorsTotal)
legacyregistry.MustRegister(StartedContainersTotal)
@ -537,6 +547,7 @@ func Register(collectors ...metrics.StableCollector) {
}
legacyregistry.MustRegister(RunPodSandboxDuration)
legacyregistry.MustRegister(RunPodSandboxErrors)
for _, collector := range collectors {
legacyregistry.CustomMustRegister(collector)
}