From a0008e37c1428aa566d4dffe333968d2c2ffcefd Mon Sep 17 00:00:00 2001 From: Marian Steinbach Date: Mon, 20 Nov 2023 21:47:34 +0100 Subject: [PATCH] Fix aggregation rules counting docker.io images (#964) * Fix aggregation rules counting docker.io images * Update CHANGELOG.md --- CHANGELOG.md | 6 ++++++ .../templates/recording-rules/grafana-cloud.rules.yml | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 143c89d70..995a426af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Fix counting of docker.io images by using the `image_spec` label instead of `image`: + - `aggregation:docker:containers_using_dockerhub_image` + - `aggregation:docker:containers_using_dockerhub_image_relative` + ## [2.142.1] - 2023-11-20 ### Changed diff --git a/helm/prometheus-rules/templates/recording-rules/grafana-cloud.rules.yml b/helm/prometheus-rules/templates/recording-rules/grafana-cloud.rules.yml index f5bef49c2..7fdda101a 100644 --- a/helm/prometheus-rules/templates/recording-rules/grafana-cloud.rules.yml +++ b/helm/prometheus-rules/templates/recording-rules/grafana-cloud.rules.yml @@ -105,9 +105,9 @@ spec: rules: - expr: sum(engine_daemon_image_actions_seconds_count) by (cluster_id, cluster_type, action) record: aggregation:docker:action_count - - expr: sum(kube_pod_container_info{image=~"docker\\.io/.*"} or kube_pod_init_container_info{image=~"docker\\.io/.*"}) + - expr: sum(kube_pod_container_info{image_spec=~"docker\\.io/.*"} or kube_pod_init_container_info{image_spec=~"docker\\.io/.*"}) record: aggregation:docker:containers_using_dockerhub_image - - expr: sum(kube_pod_container_info{image=~"docker\\.io/.*"} or kube_pod_init_container_info{image=~"docker\\.io/.*"}) / sum(kube_pod_container_info{} or kube_pod_init_container_info{}) + - expr: sum(kube_pod_container_info{image_spec=~"docker\\.io/.*"} or kube_pod_init_container_info{image_spec=~"docker\\.io/.*"}) / sum(kube_pod_container_info{} or kube_pod_init_container_info{}) record: aggregation:docker:containers_using_dockerhub_image_relative - name: certificates.grafana-cloud.recording rules: