gcp metric explorer using promql

GCP metric explorer supports PromQL. Ideally we should use the UI to help us build our PromQL. 

All we need to do is to click on the "Add query" and then we can select the metric that is relevant to us. In this case it is "dns_request_count".



Here is the sample PromQL that is generated. 

{"__name__"="kubernetes_io:pod_volume_utilization"}

Memory request utilization over time 

avg_over_time({"__name__"="kubernetes.io/container/memory/request_utilization",

"monitored_resource"="k8s_container",
"pod_name"="autoscaling-metrics-adapter-857f68dbcd-kmvw8"}[${__interval}])

Dns request count over time 

sum(rate({"__name__"="kubernetes.io/networking/dns/kubedns/dns_request_count",
"monitored_resource"="k8s_container"}[${__interval}]))

Add additional criteria 

sum(rate({"__name__"="kubernetes.io/networking/dns/kubedns/dns_request_count",
"monitored_resource"="k8s_container"}[${__interval}])) > 0.4

Some common function

rate() turns a counter that only ever grows into a number that tells you how fast it’s growing.

sum(rate(http_requests_total[5m])) - total across everything

sum by (status) (rate(http_requests_total[5m])) - one line per status code

sum without (instance) (rate(...)) - drop one label, keep the rest



Comments

Popular posts from this blog

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

llama cpp running it in google colab