grafana_query
Query metrics or logs from Grafana datasources using PromQL or LogQL expressions, returning a compact digest or full raw frames.
Instructions
Read-only metric/log query via Grafana's /api/ds/query. Provide the datasource uid (from grafana_list_datasources), a raw expression (PromQL for Prometheus, LogQL for Loki, etc.), and an optional time range. By default returns a compact per-series digest (labels + count/first/last/min/max/avg); pass raw=true for the full (potentially very large) frames.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | No | Range end, e.g. 'now' or epoch ms. | now |
| raw | No | Return the full raw frames instead of the per-series digest. Can be very large. | |
| expr | Yes | Query expression (PromQL/LogQL/etc.). | |
| from | No | Range start, e.g. 'now-1h' or epoch ms. | now-1h |
| datasource_uid | Yes | Datasource uid from grafana_list_datasources. | |
| max_data_points | No |