Build a custom Grafana dashboard
Add a Grafana panel that plots Real-Time Metrics data through the Azion data source, map its response fields, and save the dashboard.
You can build a Grafana dashboard of your own, with panels that send GraphQL queries to Real-Time Metrics through the Azion data source plugin. Each panel plots the data you choose in its query. To import the ready-made Data Transferred dashboard instead, refer to Import the pre-built Grafana dashboard.
Prerequisites
- A local Grafana instance with the Azion plugin installed and an Azion data source created. To set up both, refer to Install the Azion plugin for Grafana.
- An application that served requests in the range the panel plots.
Add a panel that queries Real-Time Metrics
A panel holds one GraphQL query, and the Azion data source sends it to the Real-Time Metrics API. The query on this page reads the httpMetrics dataset, which records the requests of your applications. It returns the data transferred per minute over 24 hours:
Replace the begin and end values with the range you want to plot. Without limit, the API returns 10 rows, so limit: 2000 keeps every minute of a 24-hour range.
The query returns one row for each minute that had traffic, in time order:
The values are in bytes, and dataTransferredTotal is the sum of dataTransferredIn and dataTransferredOut. For every field of the dataset, refer to Real-Time Metrics GraphQL fields.
To add the panel in Grafana:
In the Grafana menu, select Dashboards.
Select New > New Dashboard.
In the Add panel card, select Add a new panel.
In the Data source list, select Azion.
In the query code box, paste the DataTransferredOverTime query.
The panel preview reads the rows of the query through the Azion data source.
Map the response fields
Five optional fields tell the panel how to read the rows the query returns. Which ones a panel needs depends on its visualization and on what the graph shows. The five fields take these values:
| Field | What it takes |
|---|---|
| Data path | The value Metrics. |
| Time path | The path to the timestamp of each row, delimited by dots. The DataTransferredOverTime query returns the timestamp in ts. |
| Time format | The format of that timestamp, written in moment.js format. |
| Group by | The field that groups the aggregated data into series. |
| Alias by | The name and value a field shows in the legend. |
Choose a visualization and save
The visualization sets how the panel draws the rows. A query grouped by ts, such as DataTransferredOverTime, returns one row per time bucket.
To finish the panel in Grafana:
In the Visualization list, select a visualization type. For example: Time series.
Select Save to apply the configuration.
The dashboard keeps the panel with its query, its field mapping, and its visualization.