From ed9697339008c9e5cecfb1bf74060e1c681b9923 Mon Sep 17 00:00:00 2001 From: Chi Wai Chan Date: Thu, 5 Dec 2024 12:15:43 +0800 Subject: [PATCH] Add "flavor" label to uniquely identify metrics Sometime during instance resizing, nova will create a new instance on different host with the same uuid and instance name, and this will cause some query failed on "many-to-many matching not allowed: matching labels must be unique on one side". Adding extra "flavor" label might help resolving the uniqueness of metrics during resizing. See issue: https://github.com/canonical/openstack-exporter-operator/issues/120 Change-Id: I49dcd22c90dacb52952461f37a043b48912d5e01 --- .../src/grafana_dashboards/compute.json | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/charms/openstack-exporter-k8s/src/grafana_dashboards/compute.json b/charms/openstack-exporter-k8s/src/grafana_dashboards/compute.json index e26d3726..e38d35b9 100644 --- a/charms/openstack-exporter-k8s/src/grafana_dashboards/compute.json +++ b/charms/openstack-exporter-k8s/src/grafana_dashboards/compute.json @@ -840,7 +840,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "rate(libvirt_domain_info_cpu_time_seconds_total[$__rate_interval]) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "rate(libvirt_domain_info_cpu_time_seconds_total[$__rate_interval]) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -849,7 +849,7 @@ "refId": "cpu_time" }, { - "expr": "libvirt_domain_info_memory_usage_bytes * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "libvirt_domain_info_memory_usage_bytes * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -858,7 +858,7 @@ "refId": "mem_usage" }, { - "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_bytes_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_bytes_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_bytes_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_bytes_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -867,7 +867,7 @@ "refId": "net_throughput" }, { - "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_packets_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_packets_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_packets_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_packets_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -876,7 +876,7 @@ "refId": "packets_rate" }, { - "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_errors_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_errors_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_errors_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_errors_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -885,7 +885,7 @@ "refId": "net_errors" }, { - "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_drops_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_drops_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_drops_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_drops_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -894,7 +894,7 @@ "refId": "packets_drops" }, { - "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_read_requests_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_write_requests_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_read_requests_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_write_requests_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -903,7 +903,7 @@ "refId": "disks_iops" }, { - "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_read_bytes_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_write_bytes_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "(sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_read_bytes_total[$__rate_interval])) + sum by(juju_unit, domain) (rate(libvirt_domain_block_stats_write_bytes_total[$__rate_interval]))) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "hide": false, "instant": true, @@ -1043,7 +1043,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "rate(libvirt_domain_info_cpu_time_seconds_total[$__rate_interval]) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "rate(libvirt_domain_info_cpu_time_seconds_total[$__rate_interval]) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "{{project_name}} | {{instance_name}} | {{uuid}}", "refId": "A" @@ -1247,7 +1247,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "libvirt_domain_info_memory_usage_bytes * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "libvirt_domain_info_memory_usage_bytes * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "{{project_name}} | {{instance_name}} | {{uuid}}", "refId": "A" @@ -1372,7 +1372,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "libvirt_domain_info_maximum_memory_bytes * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "libvirt_domain_info_maximum_memory_bytes * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "format": "table", "instant": true, "interval": "", @@ -1502,13 +1502,13 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "rx: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "A" }, { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "tx: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "B" @@ -1598,13 +1598,13 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_packets_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_packets_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "rx: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "A" }, { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_packets_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_packets_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "tx: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "B" @@ -1889,25 +1889,25 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_errors_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_errors_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "rx err: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "A" }, { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_errors_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_errors_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "tx err: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "B" }, { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_drops_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_receive_drops_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "rx drop: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "C" }, { - "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_drops_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain) (rate(libvirt_domain_interface_stats_transmit_drops_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "tx drop: {{project_name}} | {{instance_name}} | {{uuid}}", "refId": "D" @@ -2020,7 +2020,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_read_requests_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_read_requests_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "{{project_name}} | {{instance_name}} | {{uuid}} | {{target_device}}", "refId": "A" @@ -2110,7 +2110,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_write_requests_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_write_requests_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "{{project_name}} | {{instance_name}} | {{uuid}} | {{target_device}}", "refId": "A" @@ -2200,7 +2200,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_read_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_read_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "{{project_name}} | {{instance_name}} | {{uuid}} | {{target_device}}", "refId": "A" @@ -2290,7 +2290,7 @@ "pluginVersion": "9.2.1", "targets": [ { - "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_write_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid) libvirt_domain_info_meta{project_name=~\"$project\"}", + "expr": "sum by(juju_unit, domain, target_device) (rate(libvirt_domain_block_stats_write_bytes_total[$__rate_interval])) * on(juju_unit, domain) group_left(project_name, instance_name, uuid, flavor) libvirt_domain_info_meta{project_name=~\"$project\"}", "interval": "", "legendFormat": "{{project_name}} | {{instance_name}} | {{uuid}} | {{target_device}}", "refId": "A"