PromQL is Prometheus’s query language for retrieving, filtering, aggregating, and transforming time-series metrics. Grafana uses PromQL queries to turn scraped application metrics into operational charts. section 3.5
A production monitoring workflow uses PromQL between scraped metrics and operational decisions:
- Expose application metrics through an endpoint such as /metrics, allowing Prometheus to scrape and store them. section 3.5
- Query counters with label filters and time ranges, then aggregate results by a label such as response_code. section 3.5
- Use PromQL expressions as alert conditions that Prometheus evaluates before Alertmanager routes triggered alerts. section 11.1.4
Aggregate requests over ten minutes
sum by (response_code) (increase(starlette_requests_total{app_name="starlette", method="GET", path="/"}[10m])) groups the increase in a request counter by HTTP response code, producing a time-series view suitable for Grafana.
Detect unavailable services
up{job="yatai/bento-deployment", yatai_ai_bento_deployment_component_type=~"api-server|runner"} == 0 detects targets whose scrape status is down. absent(up{...}) == 1 detects when the metric itself disappears, covering a deployment that was deleted or terminated. Alert rules can hold either condition for five minutes and assign critical severity. section 11.1.4



