capabilities.work

Query a Data Source Through Grafana

A 2-step recipe with Grafana. We can help you get access.

Recipe · 2 steps

Query a Data Source Through Grafana

with Grafana · Observability Management

Run a query against a named Grafana data source over a relative time range.

  1. Resolve the data source by name. The query endpoint addresses sources by UID, and UIDs differ between instances while names usually do not, so resolving here keeps the workflow portable across dev and prod.
  2. Submit the query through Grafana, which proxies it to the data source using the credentials it already holds. The caller never sees or handles the backend's credentials.
What you'll need to have ready
  • datasourceName: Name of the data source as it appears in Grafana (e.g. "Prometheus - Prod").
  • query: The datasource-specific query model, minus the datasource and refId fields which this workflow fills in (e.g. {"expr": "up", "instant": true} for Prometheus, {"
  • from: Start of the query range, as epoch milliseconds or a relative expression like "now-6h".
  • to: End of the query range, as epoch milliseconds or "now".
  • maxDataPoints: Upper bound on points returned per series.
  • intervalMs: Suggested step between points, in milliseconds.
  • debug: Ask Grafana to include debugging detail in the response.
For your developer

Arazzo workflow grafana:query-datasource, 2 operations: getDataSourceByName → queryMetricsWithExpressions. Specs on APIs.io.