Repository navigation
Add uid to every Grafana dashboard that lacks one - #117
Open
sheikh-arman wants to merge 6 commits into
Open
sheikh-arman wants to merge 6 commits into
sheikh-arman wants to merge 6 commits into
Conversation
Eight Grafana dashboards had no top-level uid, so Grafana generated a random one on each import: the MongoDB Pod and Database/ReplicaSet dashboards, the three mongodb/legacy dashboards and the three Qdrant dashboards. With file provisioning that gives a different uid per instance, and links to the dashboards are not stable. Each uid matches the metadata.name of the dashboard's Perses twin from #109, so a dashboard has one identity in both formats. The one exception is mongodb/legacy/mongodb-database-replset-dashboard.json: its Perses name kubedb-mongodb-database-replicaset-legacy is 41 characters, and Grafana rejects a uid longer than 40, so it uses kubedb-mongodb-database-replset-legacy. Supersedes #115, which named the ReplicaSet dashboard kubedb-mongodb-database instead of kubedb-mongodb-database-replicaset and did not cover Qdrant or mongodb/legacy. Signed-off-by: SK Ali Arman <arman@appscode.com>
The built-in "Annotations & Alerts" entry of 93 Grafana dashboards queried a Prometheus datasource: ${datasource} in 89, the hardcoded name "Prometheus" in the 2 Cassandra dashboards, and the instance uid e105d3fd-... from the exporting Grafana in the 2 Ignite dashboards. Prometheus has no Grafana annotations or alert state, so annotations saved on these dashboards and alert-rule markers never showed, without any error. Grafana keeps the setting when it migrates the dashboard schema.
Set it to {"type": "grafana", "uid": "-- Grafana --"}, the value Grafana writes for a new dashboard and that pgpool already uses. Only that field changes; panel queries keep ${datasource}.
Signed-off-by: SK Ali Arman <arman@appscode.com>
…rules
The CPU and memory usage and quota panels of 27 Summary dashboards queried node_namespace_pod_container:container_cpu_usage_seconds_total:sum_irate and node_namespace_pod_container:container_memory_working_set_bytes, and one dashboard queried cluster:namespace:pod_{cpu,memory}:active:kube_pod_container_resource_{requests,limits}. These series come from kube-prometheus-stack recording rules. With Grafana Alloy / k8s-monitoring, plain Prometheus, Mimir, or kube-prometheus-stack with defaultRules disabled they do not exist and the panels are empty; where the rules are added later, they never backfill.
Query the source metrics instead: irate(container_cpu_usage_seconds_total{..., container!="", image!=""}[5m]), container_memory_working_set_bytes{..., container!="", image!=""} and kube_pod_container_resource_{requests,limits}{..., resource="cpu|memory"}. Every use was inside sum(...) by (pod), so the result labels do not change. Evaluated on the same data, the kube-prometheus-stack rule expression and the new CPU query give identical values.
Signed-off-by: SK Ali Arman <arman@appscode.com>
The CPU and memory panels of 10 Summary dashboards (Cassandra, ClickHouse, ConnectCluster, Druid, Kafka, MSSQLServer, Qdrant, SingleStore, Weaviate) selected cAdvisor series with job="kubelet", metrics_path="/metrics/cadvisor". That label pair is how kube-prometheus-stack names its kubelet scrape. Other setups scrape cAdvisor under another job (Grafana k8s-monitoring uses job="integrations/kubernetes/cadvisor") and may have no metrics_path label, so these panels were empty there. Remove the two matchers. The queries already select the container series with image!="" (and container!="" where needed), and on kube-prometheus-stack they return the same series and values as before. Signed-off-by: SK Ali Arman <arman@appscode.com>
The storage panels of 21 Summary dashboards joined kubelet_volume_stats_* with kube_pod_spec_volumes_persistentvolumeclaims_info using on(persistentvolumeclaim). PVC names are unique only within a namespace, and only the right side was filtered by namespace, so a same-named PVC in another namespace (data-<db>-0 for a database of the same name) was attributed to the selected database. On k3s the API server also re-exports the volume stats with namespace="default", and those matched too. Join on(namespace, persistentvolumeclaim). That also excludes the k3s copies, so drop the job="kubelet" matcher from the kubelet_volume_stats_* selectors: it only hid those copies, and it is kube-prometheus-stack's job name, so the panels were empty where the kubelet is scraped under another job. Signed-off-by: SK Ali Arman <arman@appscode.com>
The Buffers (bgwriter) and Checkpoint Stats panels of the Postgres Database dashboard queried pg_stat_bgwriter_buffers_alloc and the like. postgres_exporter names these counters with a _total suffix since v0.11.0, and KubeDB ships v0.18.1, so both panels were empty on every PostgreSQL version.
Query the _total name first and keep the old name as a fallback for older exporters and existing history. PostgreSQL 17 moved the checkpoint statistics to pg_stat_checkpointer, so the three checkpoint lines also fall back to pg_stat_checkpointer_{buffers_written,write_time,sync_time}_total, which the exporter reports when its stat_checkpointer collector is enabled. The time counters are milliseconds in all three names. buffers_backend and buffers_backend_fsync were removed in PostgreSQL 17 and stay empty there.
Signed-off-by: SK Ali Arman <arman@appscode.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Eight Grafana dashboards had no top-level uid, so Grafana generated a random one on each import: the MongoDB Pod and Database/ReplicaSet dashboards, the three mongodb/legacy dashboards and the three Qdrant dashboards. With file provisioning that gives a different uid per instance, and links to the dashboards are not stable.
Each uid matches the metadata.name of the dashboard's Perses twin from #109, so a dashboard has one identity in both formats. The one exception is mongodb/legacy/mongodb-database-replset-dashboard.json: its Perses name kubedb-mongodb-database-replicaset-legacy is 41 characters, and Grafana rejects a uid longer than 40, so it uses kubedb-mongodb-database-replset-legacy.
Supersedes #115, which named the ReplicaSet dashboard kubedb-mongodb-database instead of kubedb-mongodb-database-replicaset and did not cover Qdrant or mongodb/legacy.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.