Interview Prep/Monitoring & Observability/Rapid-Fire PromQL & LogQL

Add the `node` label to an application metric that does not have it?

AdvancedProductionRapid-Fire PromQL & LogQL
Answer
sum by (namespace, pod) (rate(http_requests_total[5m]))
* on (namespace, pod) group_left (node)
  max by (namespace, pod, node) (kube_pod_info)

kube_pod_info has value 1, so multiplying keeps the original value. The max by dedupes it when kube-state-metrics runs with two replicas, which otherwise causes many-to-many matching not allowed.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Rapid-Fire PromQL & LogQL