Section 3 · Use Grafana Assistant

How to use Grafana Assistant to write, explain, and optimize queries across your observability stack

Estimated time: 2 min

Query data with natural language

Assistant can write, explain, and optimize queries across your observability stack. For every supported data source, the workflow is the same: describe what you want, refine the result, and optionally add the visualization to a dashboard.

Use @ to mention a specific data source in your prompt, for example, @prometheus-ds, so Assistant queries the correct one.

Review supported data sources

Assistant supports natural-language query workflows across your observability stack, including:

SignalExample data sourcesQuery language
MetricsPrometheusPromQL
LogsLokiLogQL
TracesTempoTraceQL

It also supports other sources such as profiles, SQL databases, and cloud provider backends. For the full list, refer to Query data.

Try example prompts

Query metrics

Use metrics prompts when you want Assistant to generate PromQL or refine a metrics query.

Create a PromQL query in @prometheus-ds that shows p95 latency for checkout_service over the last hour.

Group by region and sort by highest error rate.

Query logs

Use logs prompts when you want Assistant to filter, parse, or summarize log data.

Find logs from @loki-logs where job=“checkout” and level=“error” in the last 15 minutes.

Parse the JSON payload and show the top five error codes.

Query traces

Use traces prompts when you want Assistant to find slow traces or summarize trace details.

Query @tempo-traces for traces longer than 2 seconds.

Show the slowest spans and include their service names.

Explain and optimize queries

Use explanation prompts when you already have a query and want to understand or improve it.

Explain what this PromQL query does: rate(http_requests_total{job="api"}[5m])

This query is returning too much data. Help me filter it to only the production namespace.

For more information, refer to Query data.