Parcourir la source

Adjust collector name for pods to match convention.

Matt Bolt il y a 4 ans
Parent
commit
99563aab2b
2 fichiers modifiés avec 5 ajouts et 5 suppressions
  1. 1 1
      pkg/metrics/kubemetrics.go
  2. 4 4
      pkg/metrics/podmetrics.go

+ 1 - 1
pkg/metrics/kubemetrics.go

@@ -69,7 +69,7 @@ func InitKubeMetrics(clusterCache clustercache.ClusterCache, opts *KubeMetricsOp
 			prometheus.MustRegister(KubeNodeCollector{
 				KubeClusterCache: clusterCache,
 			})
-			prometheus.MustRegister(KubePodMetricCollector{
+			prometheus.MustRegister(KubePodCollector{
 				KubeClusterCache:   clusterCache,
 				emitPodAnnotations: opts.EmitPodAnnotations,
 			})

+ 4 - 4
pkg/metrics/podmetrics.go

@@ -12,18 +12,18 @@ import (
 )
 
 //--------------------------------------------------------------------------
-//  KubePodMetricCollector
+//  KubePodCollector
 //--------------------------------------------------------------------------
 
 // KubePodMetricCollector is a prometheus collector that emits pod metrics
-type KubePodMetricCollector struct {
+type KubePodCollector struct {
 	KubeClusterCache   clustercache.ClusterCache
 	emitPodAnnotations bool
 }
 
 // Describe sends the super-set of all possible descriptors of metrics
 // collected by this Collector.
-func (kpmc KubePodMetricCollector) Describe(ch chan<- *prometheus.Desc) {
+func (kpmc KubePodCollector) Describe(ch chan<- *prometheus.Desc) {
 	ch <- prometheus.NewDesc("kube_pod_labels", "All labels for each pod prefixed with label_", []string{}, nil)
 	if kpmc.emitPodAnnotations {
 		ch <- prometheus.NewDesc("kube_pod_annotations", "All annotations for each pod prefix with annotation_", []string{}, nil)
@@ -38,7 +38,7 @@ func (kpmc KubePodMetricCollector) Describe(ch chan<- *prometheus.Desc) {
 }
 
 // Collect is called by the Prometheus registry when collecting metrics.
-func (kpmc KubePodMetricCollector) Collect(ch chan<- prometheus.Metric) {
+func (kpmc KubePodCollector) Collect(ch chan<- prometheus.Metric) {
 	pods := kpmc.KubeClusterCache.GetAllPods()
 	for _, pod := range pods {
 		podName := pod.GetName()