Deprecated metrics under /metrics/resource/v1alpha1

This commit is contained in:
RainbowMango 2019-12-15 18:34:37 +08:00
parent 0db7074e1a
commit ecf5f7d749
3 changed files with 11 additions and 5 deletions

View File

@ -24,6 +24,11 @@ import (
"k8s.io/kubernetes/pkg/kubelet/server/stats"
)
// This file contains a series of deprecated metrics which we emit them by endpoint `/metrics/resource/v1alpha1`.
// These metrics have been adapted to new endpoint `/metrics/resource` as well as new `Desc`s.
// In general, we don't need to maintain these deprecated metrics any more.
// TODO(RainbowMango): Remove this file in release 1.20.0+.
// Version is the string representation of the version of this configuration
const Version = "v1alpha1"
@ -33,28 +38,28 @@ var (
nil,
nil,
metrics.ALPHA,
"")
"1.18.0")
nodeMemoryUsageDesc = metrics.NewDesc("node_memory_working_set_bytes",
"Current working set of the node in bytes",
nil,
nil,
metrics.ALPHA,
"")
"1.18.0")
containerCPUUsageDesc = metrics.NewDesc("container_cpu_usage_seconds_total",
"Cumulative cpu time consumed by the container in core-seconds",
[]string{"container", "pod", "namespace"},
nil,
metrics.ALPHA,
"")
"1.18.0")
containerMemoryUsageDesc = metrics.NewDesc("container_memory_working_set_bytes",
"Current working set of the container in bytes",
[]string{"container", "pod", "namespace"},
nil,
metrics.ALPHA,
"")
"1.18.0")
)
// getNodeCPUMetrics returns CPU utilization of a node.

View File

@ -320,6 +320,7 @@ func (s *Server) InstallDefaultHandlers(enableCAdvisorJSONEndpoints bool) {
compbasemetrics.HandlerFor(r, compbasemetrics.HandlerOpts{ErrorHandling: compbasemetrics.ContinueOnError}),
)
// deprecated endpoint which will be removed in release 1.20.0+.
v1alpha1ResourceRegistry := compbasemetrics.NewKubeRegistry()
v1alpha1ResourceRegistry.CustomMustRegister(stats.NewPrometheusResourceMetricCollector(s.resourceAnalyzer, v1alpha1.Config()))
s.restfulCont.Handle(path.Join(resourceMetricsPath, v1alpha1.Version),

View File

@ -60,7 +60,7 @@ func NewPrometheusResourceMetricCollector(provider SummaryProvider, config Resou
nil,
nil,
metrics.ALPHA,
""),
"1.18.0"),
}
}