Procházet zdrojové kódy

Merge pull request #1514 from opencost/kaelan-fix-disabled-metrics

Fix incorrect condition to disable some metrics
Ajay Tripathy před 3 roky
rodič
revize
13f6525c09
2 změnil soubory, kde provedl 4 přidání a 4 odebrání
  1. 2 2
      pkg/costmodel/metrics.go
  2. 2 2
      pkg/metrics/jobmetrics.go

+ 2 - 2
pkg/costmodel/metrics.go

@@ -38,7 +38,7 @@ type ClusterInfoCollector struct {
 // collected by this Collector.
 func (cic ClusterInfoCollector) Describe(ch chan<- *prometheus.Desc) {
 	disabledMetrics := cic.metricsConfig.GetDisabledMetricsMap()
-	if _, disabled := disabledMetrics["kube_pod_annotations"]; disabled {
+	if _, disabled := disabledMetrics["kubecost_cluster_info"]; disabled {
 		return
 	}
 
@@ -49,7 +49,7 @@ func (cic ClusterInfoCollector) Describe(ch chan<- *prometheus.Desc) {
 // Collect is called by the Prometheus registry when collecting metrics.
 func (cic ClusterInfoCollector) Collect(ch chan<- prometheus.Metric) {
 	disabledMetrics := cic.metricsConfig.GetDisabledMetricsMap()
-	if _, disabled := disabledMetrics["kube_pod_annotations"]; disabled {
+	if _, disabled := disabledMetrics["kubecost_cluster_info"]; disabled {
 		return
 	}
 

+ 2 - 2
pkg/metrics/jobmetrics.go

@@ -25,7 +25,7 @@ type KubeJobCollector struct {
 // collected by this Collector.
 func (kjc KubeJobCollector) Describe(ch chan<- *prometheus.Desc) {
 	disabledMetrics := kjc.metricsConfig.GetDisabledMetricsMap()
-	if _, disabled := disabledMetrics["kube_pod_annotations"]; disabled {
+	if _, disabled := disabledMetrics["kube_job_status_failed"]; disabled {
 		return
 	}
 
@@ -35,7 +35,7 @@ func (kjc KubeJobCollector) Describe(ch chan<- *prometheus.Desc) {
 // Collect is called by the Prometheus registry when collecting metrics.
 func (kjc KubeJobCollector) Collect(ch chan<- prometheus.Metric) {
 	disabledMetrics := kjc.metricsConfig.GetDisabledMetricsMap()
-	if _, disabled := disabledMetrics["kube_pod_annotations"]; disabled {
+	if _, disabled := disabledMetrics["kube_job_status_failed"]; disabled {
 		return
 	}