How to query GraphQL data on Grafana Cloud
With the Azion GraphQL API, you can visualize your data on Grafana Cloud by using the GraphQL Data Source and adding queries with the available datasets and variables.
Requirements
To use GraphQL on Grafana Cloud, you need:
- An Azion Console account.
- A personal token created to authenticate your account.
- One or more edge applications created on your account.
- Access to Grafana.
- Install the GraphQL Data Source.
Installing the GraphQL data source on Grafana Cloud
After you’ve finished setting up the Azion requirements and you have access to Grafana, follow the next steps:
- Log in to your Grafana account.
- Go to the GraphQL Data Source page.
- On the top menu, select the Installation tab.
- On the For field, select the Grafana instance you want to install the plugin on.
- Click the Install plugin button.
For more information, see Grafana’s documentation on plugin installation.
You can also use CLI to install a plugin.
If you access your instance directly through its link, go directly to the steps related to access on the left menu. If you’ve created an account on Grafana’s website, go to the My Account environment and follow the next steps:
- On the Overview page of your Grafana Cloud Portal, on the second section, you’ll see the name of your stack.
- On the Grafana card, click Launch.
Your stack opens on another page.
- On the left-side menu, on the Connections dropdown menu, select Add new connection.
- On the Search box, type
GraphQL Data Source
; it’ll appear under Data sources. - Select the
GraphQL Data Source
card. - Click the Create a GraphQL Data Source data source button. A new page opens to configure your data source.
Configuring the data source
With the GraphQL Data Source page opened on Grafana Cloud, on the Settings tab:
-
On Name, give a descriptive name to your data source.
-
Under HTTP:
- On URL, add either
https://api.azionapi.net/metrics/graphql
orhttps://api.azionapi.net/events/graphql
. - On Custom HTTP Headers, click + Add header two times.
- On the first Header, on the first field, add Authorization, and on the second field add your Azion Console personal token. It looks similar to:
Token azionfkr40c7rp75d7df21e18d5c19el8f01
- On the second Header, on the first field, add Content-Type, and on the second field add
application/json
.
- On URL, add either
-
Click Save & test. Grafana will run a quick test to see if your authentication is correct.
Creating a dashboard
- On the left-side menu, click on Dashboards. The dashboard page opens.
- Next to the search bar, click New > New dashboard or Import.
If you pick New dashboard:
- On the panel, select + Add visualization.
- From the data source list, select GraphQL Data Source.
- On the query box, add the Azion GraphQL API query you want to use.
If you pick Import:
- On the Import dashboard page, choose an option:
- Upload a JSON file on the Upload dashboard JSON file card.
- Upload a JSON through Import via grafana.com.
- Upload a JSON through Import via panel json.
- Click the Import or Load button, depending on your previous choice.
You can customize your dashboard using the right-side panel. You can change the type of chart from time series to bar chart, for example, the legends of the chart, or even the graph style. Grafana also has other features such as annotations.
See the Data Transferred dashboard on Grafana JSON example for a ready-to-use dashboard.
Trademarks
Grafana Cloud is a trademark of Grafana Labs. We are not affiliated with, endorsed or sponsored by Grafana Labs or its affiliates.