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

Percentage of 5xx responses per service?

BeginnerProductionRapid-Fire PromQL & LogQL
Answer
100 * sum by (service) (rate(http_requests_total{status=~"5.."}[5m]))
    / sum by (service) (rate(http_requests_total[5m]))

Both sides aggregate by the same labels, so the division matches one-to-one.

All Monitoring & Observability questions Roadmap: Monitoring & alerting

More on Rapid-Fire PromQL & LogQL