update cAdvisor to v0.37.0
This commit is contained in:
7
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
7
vendor/github.com/google/cadvisor/metrics/prometheus.go
generated
vendored
@@ -22,6 +22,7 @@ import (
|
||||
|
||||
"github.com/google/cadvisor/container"
|
||||
info "github.com/google/cadvisor/info/v1"
|
||||
v2 "github.com/google/cadvisor/info/v2"
|
||||
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
"k8s.io/klog/v2"
|
||||
@@ -97,13 +98,14 @@ type PrometheusCollector struct {
|
||||
containerMetrics []containerMetric
|
||||
containerLabelsFunc ContainerLabelsFunc
|
||||
includedMetrics container.MetricSet
|
||||
opts v2.RequestOptions
|
||||
}
|
||||
|
||||
// NewPrometheusCollector returns a new PrometheusCollector. The passed
|
||||
// ContainerLabelsFunc specifies which base labels will be attached to all
|
||||
// exported metrics. If left to nil, the DefaultContainerLabels function
|
||||
// will be used instead.
|
||||
func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetrics container.MetricSet, now clock.Clock) *PrometheusCollector {
|
||||
func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetrics container.MetricSet, now clock.Clock, opts v2.RequestOptions) *PrometheusCollector {
|
||||
if f == nil {
|
||||
f = DefaultContainerLabels
|
||||
}
|
||||
@@ -129,6 +131,7 @@ func NewPrometheusCollector(i infoProvider, f ContainerLabelsFunc, includedMetri
|
||||
},
|
||||
},
|
||||
includedMetrics: includedMetrics,
|
||||
opts: opts,
|
||||
}
|
||||
if includedMetrics.Has(container.CpuUsageMetrics) {
|
||||
c.containerMetrics = append(c.containerMetrics, []containerMetric{
|
||||
@@ -1780,7 +1783,7 @@ func BaseContainerLabels(whiteList []string) func(container *info.ContainerInfo)
|
||||
}
|
||||
|
||||
func (c *PrometheusCollector) collectContainersInfo(ch chan<- prometheus.Metric) {
|
||||
containers, err := c.infoProvider.SubcontainersInfo("/", &info.ContainerInfoRequest{NumStats: 1})
|
||||
containers, err := c.infoProvider.GetRequestedContainersInfo("/", c.opts)
|
||||
if err != nil {
|
||||
c.errors.Set(1)
|
||||
klog.Warningf("Couldn't get containers: %s", err)
|
||||
|
Reference in New Issue
Block a user