---
name: azion-build-a-grafana-query-against-azion-data
description: >-
  Set the dataset, fields, time path, group by, and filters in the Azion plugin's query editor so a Grafana panel renders the series you want.
---

# Build a Grafana query against Azion data

You can control what a Grafana panel renders by setting the fields the Azion data source plugin adds to the panel's query editor. Every rule on this page applies to that editor, which holds the query itself and the fields that tell Grafana how to read the response.

A panel set to *Time series* requires two of those fields: **Time path** and **Group by**.

---

## Prerequisites

- Grafana with the Azion data source plugin. To install and authorize it, refer to [Install the Azion plugin for Grafana](/en/documentation/guides/platform/observability/integrate-grafana/).
- A dashboard panel that reads the Azion data source. To build one, refer to [Customize a Grafana log table](/en/documentation/guides/platform/observability/azion-plugin-grafana-customize-log-table/).

---

## Write the query

The query field holds the query the panel sends. It names the dataset the panel reads and the filters that narrow it, and [Data sources](/en/documentation/platform/real-time-events/data-sources/) lists every dataset the plugin can query. When the query uses a Grafana variable, replace the variable directly in the query's field.

---

## Reference a nested field by its flattened name

Nested objects are flattened with underscores. Write the flattened name wherever the editor asks for a field name, including **Time path**, **Group by**, and **Alias by**.

---

## Set the time path

**Time path** takes a timestamp. The timestamp is in `ISO8601` format or in a configurable custom format.

---

## Group the data into data points

**Group by** is what turns one result into multiple data points. Set it to the field the aggregation runs on.

---

## Rename a field in the legend

**Alias by** sets the name a field carries in the panel legend. Substitute `$field_<field.name>` with the values for the field. Substitute `$fieldName` with a name for the field.

---

## Annotate the graph

Grafana carries annotations as a dashboard feature, so no field in the query editor sets one. Use [annotations](https://grafana.com/docs/grafana/latest/dashboards/build-dashboards/annotate-visualizations/) to mark points on a graph.

---

## Set the dashboard time range

The dashboard carries its own [time range](https://grafana.com/docs/grafana/latest/dashboards/use-dashboards/#time-units-and-relative-ranges). Use it to explore and analyze your data.

---

## Next steps

- [Customize a Grafana log table](/en/documentation/guides/platform/observability/azion-plugin-grafana-customize-log-table.md): Build the panel these fields belong to, from the dashboard to the visualization type.
- [Query HTTP request events](/en/documentation/guides/platform/observability/query-workload-events.md): Write the query before you paste it into the panel, starting from the fields you want.
- [Real-Time Events fields](/en/documentation/devtools/graphql/gql-real-time-events-fields.md): Every field a query can select, group by, or name in the legend.
- [Data sources](/en/documentation/platform/real-time-events/data-sources.md): The datasets a panel can read, and what each one records.
