Aggregate all labels except instance
without() keeps every label except instance, cleaner than a long by() list
sum without(instance) (rate(http_requests_total{code=~"5.."}[5m]))
- tool
- prometheus30 commands
More prometheus commands
-
groups: - name: slo rules: - record: job:request_errors:ratio5m expr: sum by(job)(rate(http_requests_total{code=~"5.."}[5m])) / sum by(job)(rate(http_requests_total[5m]))Precompute the SLO error ratio so dashboards and alerts stay fast
-
promtool check rules rules.yml && promtool check config prometheus.ymlRun before a reload or in CI to catch broken expressions or YAML before deploy
-
promtool query instant http://localhost:9090 'topk(5, sum by(pod)(rate(container_cpu_usage_seconds_total[5m])))'Run PromQL without a browser, handy for top-N checks in scripts
-
promtool tsdb analyze /prometheus --limit 20List metrics and label pairs with the highest cardinality, the first thing to check when memory grows
-
curl -sG 'http://prometheus:9090/api/v1/query' --data-urlencode 'query=up' | jq .Run a quick PromQL query from the command line