Merge pull request #63792 from serathius/prometheus-fix-test-filter-image

Automatic merge from submit-queue (batch tested with PRs 63792, 63495, 63742, 63332, 63779). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

[prometheus addon] Add filter out timeseries without image in prometheus integration cpu tests

This PR fixes prometheus integration tests https://k8s-testgrid.appspot.com/sig-instrumentation#gce-prometheus

New pod timeseries was introduced (https://github.com/kubernetes/kubernetes/pull/63406/files) that has same labels for namespace and
pod_name resulting in doubling value in old query. New metric is not
based on containers so filtering on image solves that problem.


```release-note
NONE
```
/cc @brancz
This commit is contained in:
Kubernetes Submit Queue 2018-05-15 09:04:17 -07:00 committed by GitHub
commit 2955d450ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -91,7 +91,7 @@ var _ = instrumentation.SIGDescribe("[Feature:PrometheusMonitoring] Prometheus",
})
func prometheusCPUQuery(namespace, podNamePrefix string, rate time.Duration) string {
return fmt.Sprintf(`sum(irate(container_cpu_usage_seconds_total{namespace="%v",pod_name=~"%v.*"}[%vm]))`,
return fmt.Sprintf(`sum(irate(container_cpu_usage_seconds_total{namespace="%v",pod_name=~"%v.*",image!=""}[%vm]))`,
namespace, podNamePrefix, int64(rate.Minutes()))
}