---
name: azion-importe-o-dashboard-real-time-metrics
description: >-
  Acompanhe no Grafana as requisições, o cache, os métodos HTTP e os status codes das suas aplicações, com os principais request URIs, user agents e hosts.
---

# Importe o dashboard Real-Time Metrics

Você pode importar um dashboard do Grafana que mostra em gráficos requisições, cache, métodos HTTP e status codes do [Real-Time Metrics](/pt-br/documentacao/plataforma/real-time-metrics/) e os principais request URIs, user agents e hosts do [Real-Time Events](/pt-br/documentacao/plataforma/real-time-events/). Para o dashboard que o plugin da Azion instala, consulte [Importe o dashboard pré-configurado do Grafana](/pt-br/documentacao/guias/plataforma/observabilidade/azion-plugin-grafana-dash-pre-configurado/).

O dashboard é um modelo JSON de oito painéis distribuídos em duas linhas do dashboard. A linha **Metrics** lê o dataset `httpMetrics` da API GraphQL do Real-Time Metrics. A linha **Events** lê `workloadEvents`, um dataset do Real-Time Events, de um segundo endpoint. O Grafana precisa de um data source para cada endpoint.

---

## Pré-requisitos

- Uma instância do Grafana em que você pode importar um dashboard.
- O plugin GraphQL Data Source (`fifemon-graphql-datasource`) nessa instância. Todos os painéis do dashboard usam esse plugin, não o [plugin da Azion para Grafana](/pt-br/documentacao/guias/plataforma/observabilidade/integrar-grafana/).
- Um personal token. Para criar um, consulte [Como criar um personal token](/pt-br/documentacao/guias/plataforma/conta-e-billing/personal-tokens/).
- Uma [aplicação](/pt-br/documentacao/plataforma/applications/) com requisições nos últimos dois dias, o intervalo em que o dashboard abre.

---

## Adicione um data source para os painéis de métricas

Os cinco painéis da linha **Metrics** enviam suas queries para `https://api.azion.com/v4/metrics/graphql`. Não use `https://api.azionapi.net/metrics/graphql`: esse host responde `403` com uma página de erro em HTML.

Para adicionar o data source de métricas no Grafana:

1. **Abra a lista de plugins**

   No menu do Grafana, em **Administration**, selecione **Plugins**.

2. **Encontre o plugin GraphQL Data Source**

   Em **Search**, insira `GraphQL Data Source` e selecione o card do plugin.

3. **Crie um data source a partir do plugin**

4. **Dê um nome ao data source**

   Em **Name**, insira um nome que indique qual endpoint o data source lê. Por exemplo: `Azion metrics`.

5. **Defina a URL do endpoint**

   Defina a URL como `https://api.azion.com/v4/metrics/graphql`.

6. **Envie seu personal token**

   Adicione um header HTTP chamado `Authorization` com o valor `Token [TOKEN VALUE]`. Substitua `[TOKEN VALUE]` pelo seu personal token.

7. **Salve e teste o data source**

O Grafana salva o data source e executa um teste contra o endpoint. Sem o header `Authorization`, o endpoint responde `401` com `{"detail": "Authentication credentials were not provided."}`.

---

## Adicione um data source para os painéis de eventos

Os três painéis da linha **Events** consultam `workloadEvents`, um dataset do Real-Time Events. O endpoint de métricas não atende esse dataset e responde `400`:

```json
{
  "detail": "Cannot query field \"workloadEvents\" on type \"Query\". Did you mean \"workloadMetrics\" or \"workloadBreakdownMetrics\"?"
}
```

As mesmas queries rodam sem alteração em `https://api.azion.com/v4/events/graphql`, com o mesmo personal token.

Para adicionar o data source de eventos no Grafana:

1. **Abra a lista de plugins**

   No menu do Grafana, em **Administration**, selecione **Plugins**.

2. **Encontre o plugin GraphQL Data Source**

   Em **Search**, insira `GraphQL Data Source` e selecione o card do plugin.

3. **Crie um data source a partir do plugin**

4. **Dê um nome ao data source**

   Em **Name**, insira um nome que indique qual endpoint o data source lê. Por exemplo: `Azion events`.

5. **Defina a URL do endpoint**

   Defina a URL como `https://api.azion.com/v4/events/graphql`.

6. **Envie seu personal token**

   Adicione um header HTTP chamado `Authorization` com o valor `Token [TOKEN VALUE]`. Substitua `[TOKEN VALUE]` pelo seu personal token.

7. **Salve e teste o data source**

O Grafana salva o segundo data source. Cada linha do dashboard passa a ter um endpoint que atende o seu dataset.

---

## Importe o modelo do dashboard

O modelo do dashboard abre nos últimos dois dias (`now-2d` a `now`), no fuso horário do navegador, sem atualização automática. Ele não declara entradas de data source. Cada painel indica o seu data source por um UID fixo: `loKOM5K4k` na linha **Events** e `d863aedd-0f4f-48e4-ae94-bf0bc73120a6` na linha **Metrics**. O modelo também define uma variável `host` oculta que nenhuma query de painel usa.

O modelo do dashboard:

```json
{
	"annotations": {
		"list": [{
			"builtIn": 1,
			"datasource": {
				"type": "grafana",
				"uid": "-- Grafana --"
			},
			"enable": true,
			"hide": true,
			"iconColor": "rgba(0, 211, 255, 1)",
			"name": "Annotations & Alerts",
			"target": {
				"limit": 100,
				"matchAny": false,
				"tags": [],
				"type": "dashboard"
			},
			"type": "dashboard"
		}]
	},
	"editable": true,
	"fiscalYearStartMonth": 0,
	"graphTooltip": 0,
	"id": 2,
	"links": [],
	"liveNow": false,
	"panels": [{
			"collapsed": true,
			"gridPos": {
				"h": 1,
				"w": 24,
				"x": 0,
				"y": 0
			},
			"id": 17,
			"panels": [],
			"title": "Row title",
			"type": "row"
		},
		{
			"collapsed": true,
			"gridPos": {
				"h": 1,
				"w": 24,
				"x": 0,
				"y": 1
			},
			"id": 9,
			"panels": [{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "loKOM5K4k"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								}
							},
							"mappings": []
						},
						"overrides": []
					},
					"gridPos": {
						"h": 8,
						"w": 6,
						"x": 0,
						"y": 10
					},
					"id": 12,
					"options": {
						"displayLabels": [],
						"legend": {
							"displayMode": "list",
							"placement": "right",
							"showLegend": true,
							"values": []
						},
						"pieType": "pie",
						"reduceOptions": {
							"calcs": [
								"lastNotNull"
							],
							"fields": "",
							"values": false
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"pluginVersion": "9.3.6",
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "workloadEvents",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "loKOM5K4k"
						},
						"endTimePath": "endTime",
						"groupBy": "requestUri",
						"queryText": "query {\n workloadEvents(\n limit: 10,\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n aggregate: {count: host} \n groupBy: [requestUri]\n #orderBy: [count_DESC]\n )\n {\n requestUri\n #status\n count\n \n }\n}",
						"refId": "A",
						"timeFormat": "",
						"timePath": "tsRange"
					}],
					"title": "Top 10 requestUri",
					"transparent": true,
					"type": "piechart"
				},
				{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "loKOM5K4k"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								}
							},
							"mappings": []
						},
						"overrides": []
					},
					"gridPos": {
						"h": 8,
						"w": 6,
						"x": 7,
						"y": 10
					},
					"id": 11,
					"options": {
						"displayLabels": [],
						"legend": {
							"displayMode": "list",
							"placement": "right",
							"showLegend": true,
							"values": []
						},
						"pieType": "pie",
						"reduceOptions": {
							"calcs": [
								"lastNotNull"
							],
							"fields": "",
							"values": false
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"pluginVersion": "9.3.6",
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "workloadEvents",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "loKOM5K4k"
						},
						"endTimePath": "endTime",
						"groupBy": "httpUserAgent",
						"queryText": "query {\n workloadEvents(\n limit: 10,\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n aggregate: {count: host} \n groupBy: [httpUserAgent]\n #orderBy: [count_DESC]\n )\n {\n httpUserAgent\n #status\n count\n \n }\n}",
						"refId": "A",
						"timeFormat": "",
						"timePath": "tsRange"
					}],
					"title": "TOp 10 User Agents",
					"transparent": true,
					"type": "piechart"
				},
				{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "loKOM5K4k"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								}
							},
							"mappings": []
						},
						"overrides": []
					},
					"gridPos": {
						"h": 8,
						"w": 6,
						"x": 14,
						"y": 10
					},
					"id": 2,
					"options": {
						"displayLabels": [],
						"legend": {
							"displayMode": "list",
							"placement": "right",
							"showLegend": true,
							"values": []
						},
						"pieType": "pie",
						"reduceOptions": {
							"calcs": [
								"lastNotNull"
							],
							"fields": "",
							"values": false
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"pluginVersion": "9.3.6",
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "workloadEvents",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "loKOM5K4k"
						},
						"endTimePath": "endTime",
						"groupBy": "host",
						"queryText": "query {\n workloadEvents(\n limit: 10,\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n aggregate: {count: host} \n groupBy: [host,status]\n #orderBy: [count_DESC]\n )\n {\n host\n #status\n count\n \n }\n}",
						"refId": "A",
						"timeFormat": "",
						"timePath": "tsRange"
					}],
					"title": "TOp 10 hosts",
					"transparent": true,
					"type": "piechart"
				}
			],
			"title": "Events",
			"type": "row"
		},
		{
			"collapsed": true,
			"gridPos": {
				"h": 1,
				"w": 24,
				"x": 0,
				"y": 2
			},
			"id": 4,
			"panels": [{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"axisCenteredZero": false,
								"axisColorMode": "text",
								"axisLabel": "",
								"axisPlacement": "auto",
								"barAlignment": 0,
								"drawStyle": "line",
								"fillOpacity": 0,
								"gradientMode": "none",
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								},
								"lineInterpolation": "linear",
								"lineWidth": 1,
								"pointSize": 5,
								"scaleDistribution": {
									"type": "linear"
								},
								"showPoints": "auto",
								"spanNulls": false,
								"stacking": {
									"group": "A",
									"mode": "none"
								},
								"thresholdsStyle": {
									"mode": "off"
								}
							},
							"mappings": [],
							"thresholds": {
								"mode": "absolute",
								"steps": [{
										"color": "green"
									},
									{
										"color": "red",
										"value": 80
									}
								]
							}
						},
						"overrides": []
					},
					"gridPos": {
						"h": 9,
						"w": 11,
						"x": 0,
						"y": 18
					},
					"id": 13,
					"options": {
						"legend": {
							"calcs": [],
							"displayMode": "list",
							"placement": "right",
							"showLegend": true
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "httpMetrics",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
						},
						"endTimePath": "endTime",
						"groupBy": "",
						"queryText": "query HttpCalculatedTotalRequestsPerSecond {\n httpMetrics(\n limit: 1000\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n groupBy: [ts]\n orderBy: [ts_DESC]\n ) \n { \n ts\n missedRequests\n requestsOffloaded\n requestsPerSecondOffloaded\n edgeRequestsTotalPerSecond\n missedRequestsPerSecond\n savedRequestsPerSecond\n httpRequestsTotal\n httpsRequestsTotal\n edgeRequestsTotal\n \n \n \n \n }\n}",
						"refId": "A",
						"timeFormat": "ts",
						"timePath": ""
					}],
					"title": "Total Req - Requests",
					"transparent": true,
					"type": "timeseries"
				},
				{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"axisCenteredZero": false,
								"axisColorMode": "text",
								"axisLabel": "",
								"axisPlacement": "auto",
								"barAlignment": 0,
								"drawStyle": "line",
								"fillOpacity": 0,
								"gradientMode": "none",
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								},
								"lineInterpolation": "linear",
								"lineWidth": 1,
								"pointSize": 5,
								"scaleDistribution": {
									"type": "linear"
								},
								"showPoints": "auto",
								"spanNulls": false,
								"stacking": {
									"group": "A",
									"mode": "none"
								},
								"thresholdsStyle": {
									"mode": "off"
								}
							},
							"mappings": [],
							"thresholds": {
								"mode": "absolute",
								"steps": [{
										"color": "green"
									},
									{
										"color": "red",
										"value": 80
									}
								]
							}
						},
						"overrides": []
					},
					"gridPos": {
						"h": 8,
						"w": 11,
						"x": 12,
						"y": 18
					},
					"id": 15,
					"options": {
						"legend": {
							"calcs": [],
							"displayMode": "list",
							"placement": "right",
							"showLegend": true
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "httpMetrics",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
						},
						"endTimePath": "endTime",
						"groupBy": "",
						"queryText": "query HttpCalculatedTotalRequestsPerSecond {\n httpMetrics(\n limit: 1000\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n groupBy: [ts]\n orderBy: [ts_DESC]\n ) \n { \n ts\n missedData\n savedData\n dataTransferredIn\n dataTransferredOut\n dataTransferredTotal\n }\n}",
						"refId": "A",
						"timeFormat": "",
						"timePath": ""
					}],
					"title": "Total Req - Cache",
					"transparent": true,
					"type": "timeseries"
				},
				{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"axisCenteredZero": false,
								"axisColorMode": "text",
								"axisLabel": "",
								"axisPlacement": "auto",
								"barAlignment": 0,
								"drawStyle": "line",
								"fillOpacity": 0,
								"gradientMode": "none",
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								},
								"lineInterpolation": "linear",
								"lineStyle": {
									"fill": "solid"
								},
								"lineWidth": 1,
								"pointSize": 5,
								"scaleDistribution": {
									"type": "linear"
								},
								"showPoints": "auto",
								"spanNulls": false,
								"stacking": {
									"group": "A",
									"mode": "none"
								},
								"thresholdsStyle": {
									"mode": "line"
								}
							},
							"mappings": [],
							"thresholds": {
								"mode": "percentage",
								"steps": [{
									"color": "green"
								}]
							}
						},
						"overrides": []
					},
					"gridPos": {
						"h": 9,
						"w": 9,
						"x": 15,
						"y": 26
					},
					"id": 16,
					"options": {
						"legend": {
							"calcs": [],
							"displayMode": "list",
							"placement": "right",
							"showLegend": true
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "httpMetrics",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
						},
						"endTimePath": "endTime",
						"groupBy": "",
						"queryText": "query HttpCalculatedTotalRequestsPerSecond {\n httpMetrics(\n limit: 1000\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n groupBy: [ts]\n orderBy: [ts_DESC]\n ) \n { \n ts\n requestsHttpMethodGet\n requestsHttpMethodPost\n requestsHttpMethodHead\n requestsHttpMethodOthers\n }\n}",
						"refId": "A",
						"timeFormat": "",
						"timePath": ""
					}],
					"title": "Http Methods ",
					"transparent": true,
					"type": "timeseries"
				},
				{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "thresholds"
							},
							"custom": {
								"align": "auto",
								"cellOptions": {
									"type": "auto"
								},
								"inspect": false
							},
							"mappings": [],
							"thresholds": {
								"mode": "absolute",
								"steps": [{
										"color": "green"
									},
									{
										"color": "red",
										"value": 80
									}
								]
							}
						},
						"overrides": []
					},
					"gridPos": {
						"h": 8,
						"w": 6,
						"x": 0,
						"y": 27
					},
					"id": 10,
					"options": {
						"cellHeight": "sm",
						"footer": {
							"countRows": false,
							"fields": "",
							"reducer": [
								"sum"
							],
							"show": false
						},
						"showHeader": true
					},
					"pluginVersion": "10.0.0-cloud.3.b04cc88b",
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "httpMetrics",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
						},
						"endTimePath": "endTime",
						"groupBy": "",
						"hide": false,
						"queryText": "query CountRowsByHost {\n httpMetrics(\n limit: 1000\n filter: {\n tsRange: {begin:\"2023-03-22T17:03:00\", end:\"2023-03-22T18:05:00\"}\n }\n aggregate: {count:rows} # {count:host}\n groupBy: [host]\n orderBy: [count_DESC]\n ) \n { \n host\n count\n }\n}",
						"refId": "A",
						"timePath": "Time"
					}],
					"title": "Logs",
					"type": "table"
				},
				{
					"datasource": {
						"type": "fifemon-graphql-datasource",
						"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
					},
					"fieldConfig": {
						"defaults": {
							"color": {
								"mode": "palette-classic"
							},
							"custom": {
								"axisCenteredZero": false,
								"axisColorMode": "text",
								"axisLabel": "",
								"axisPlacement": "auto",
								"barAlignment": 0,
								"drawStyle": "line",
								"fillOpacity": 0,
								"gradientMode": "none",
								"hideFrom": {
									"legend": false,
									"tooltip": false,
									"viz": false
								},
								"lineInterpolation": "linear",
								"lineWidth": 1,
								"pointSize": 5,
								"scaleDistribution": {
									"type": "linear"
								},
								"showPoints": "auto",
								"spanNulls": false,
								"stacking": {
									"group": "A",
									"mode": "none"
								},
								"thresholdsStyle": {
									"mode": "off"
								}
							},
							"mappings": [],
							"thresholds": {
								"mode": "absolute",
								"steps": [{
										"color": "green"
									},
									{
										"color": "red",
										"value": 80
									}
								]
							}
						},
						"overrides": []
					},
					"gridPos": {
						"h": 8,
						"w": 9,
						"x": 6,
						"y": 27
					},
					"id": 14,
					"options": {
						"legend": {
							"calcs": [],
							"displayMode": "list",
							"placement": "right",
							"showLegend": true
						},
						"tooltip": {
							"mode": "single",
							"sort": "none"
						}
					},
					"targets": [{
						"aliasBy": "",
						"annotationTags": "",
						"annotationText": "",
						"annotationTitle": "",
						"constant": 6.5,
						"dataPath": "httpMetrics",
						"datasource": {
							"type": "fifemon-graphql-datasource",
							"uid": "d863aedd-0f4f-48e4-ae94-bf0bc73120a6"
						},
						"endTimePath": "endTime",
						"groupBy": "",
						"queryText": "query HttpCalculatedTotalRequestsPerSecond {\n httpMetrics(\n limit: 1000\n filter: {\n\ttsRange: { begin: \"${__from:date:iso}\", end: \"${__to:date:iso}\" }\n\t \n\t\t},\n groupBy: [ts]\n orderBy: [ts_DESC]\n ) \n { \n ts\n requestsStatusCode2xx\n requestsStatusCode3xx\n requestsStatusCode4xx\n requestsStatusCode5xx\n }\n}",
						"refId": "A",
						"timeFormat": "",
						"timePath": ""
					}],
					"title": "Status Codes ",
					"transparent": true,
					"type": "timeseries"
				}
			],
			"title": "Metrics",
			"type": "row"
		}
	],
	"refresh": "",
	"schemaVersion": 38,
	"style": "dark",
	"tags": [],
	"templating": {
		"list": [{
			"current": {
				"selected": false,
				"text": "host",
				"value": "host"
			},
			"description": "",
			"hide": 1,
			"includeAll": false,
			"label": "host",
			"multi": false,
			"name": "host",
			"options": [],
			"query": "",
			"queryValue": "host",
			"skipUrlSync": false,
			"type": "custom"
		}]
	},
	"time": {
		"from": "now-2d",
		"to": "now"
	},
	"timepicker": {},
	"timezone": "browser",
	"title": "Dashboard Exemple - Azion",
	"uid": "DdzS8OK4z",
	"version": 31,
	"weekStart": ""
}
```

Para importar o dashboard no Grafana:

1. **Copie o modelo do dashboard**

   Copie o objeto JSON inteiro do modelo do dashboard.

2. **Abra a importação de dashboards**

   Para saber onde fica a importação na sua versão do Grafana, consulte [Import dashboards](https://grafana.com/docs/grafana/latest/visualizations/dashboards/build-dashboards/import-dashboards/).

3. **Cole o modelo e importe o dashboard**

O Grafana lista o dashboard como `Dashboard Exemple - Azion`, o título que o modelo define. Ele tem três linhas recolhidas: uma **Row title** vazia, **Events** e **Metrics**.

---

## Conecte cada painel ao seu data source

Os painéis do dashboard importado mantêm os UIDs de data source do modelo, e esses UIDs não correspondem aos data sources que você adicionou. Conecte cada painel ao data source que atende a linha dele.

Para conectar um painel no Grafana:

1. **Expanda a linha**

   Selecione **Events** ou **Metrics** para expandir a linha que contém o painel.

2. **Edite o painel**

3. **Selecione o data source**

   Para um painel da linha **Events**, selecione o seu data source de eventos. Para um painel da linha **Metrics**, selecione o seu data source de métricas.

4. **Salve o dashboard**

Repita os passos para cada um dos oito painéis. Cada painel passa então a enviar a sua query ao próprio endpoint, para o intervalo do dashboard.

---

## Ajuste o painel Logs ao intervalo do dashboard

O painel **Logs**, na linha **Metrics**, executa a query `CountRowsByHost`, que conta as linhas de `httpMetrics` de cada host. A query fixa o intervalo de `2023-03-22T17:03:00` a `2023-03-22T18:05:00`. Esse intervalo retorna um array `httpMetrics` vazio, então o painel não mostra nenhuma linha, qualquer que seja o intervalo que você escolha no dashboard.

A query editada substitui o intervalo fixo pelas variáveis do dashboard `${__from:date:iso}` e `${__to:date:iso}`, como fazem os outros painéis:

```graphql
query CountRowsByHost {
 httpMetrics(
 limit: 1000
 filter: {
 tsRange: {begin:"${__from:date:iso}", end:"${__to:date:iso}"}
 }
 aggregate: {count:rows} # {count:host}
 groupBy: [host]
 orderBy: [count_DESC]
 )
 {
 host
 count
 }
}
```

Para editar a query no Grafana:

1. **Edite o painel Logs**

2. **Substitua o texto da query**

   Substitua o texto da query do painel pela query editada.

3. **Salve o dashboard**

O Grafana preenche as duas variáveis com o intervalo do dashboard. Para os últimos dois dias, o endpoint de métricas responde com uma linha por host, com a maior contagem primeiro:

```json
{
  "data": {
    "httpMetrics": [
      {
        "host": "www.example.com",
        "count": 492
      },
      …
    ]
  }
}
```

Cada `count` é o número de linhas de `httpMetrics` registradas para aquele host no intervalo.

---

## Verifique os painéis

Cada painel consulta um dataset e mostra nos gráficos os campos desta tabela. Quando um painel mostra os seus campos para o intervalo do dashboard, o data source dele funciona.

| Linha   | Painel                   | Visualização | Dataset          | Campos                                                                                                                                                                                                                 |
| ------- | ------------------------ | ------------ | ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Events  | **Top 10 requestUri**    | Pie chart    | `workloadEvents` | `requestUri`, `count`                                                                                                                                                                                                  |
| Events  | **TOp 10 User Agents**   | Pie chart    | `workloadEvents` | `httpUserAgent`, `count`                                                                                                                                                                                               |
| Events  | **TOp 10 hosts**         | Pie chart    | `workloadEvents` | `host`, `count`, agrupados por `host` e `status`                                                                                                                                                                       |
| Metrics | **Total Req - Requests** | Time series  | `httpMetrics`    | `missedRequests`, `requestsOffloaded`, `requestsPerSecondOffloaded`, `edgeRequestsTotalPerSecond`, `missedRequestsPerSecond`, `savedRequestsPerSecond`, `httpRequestsTotal`, `httpsRequestsTotal`, `edgeRequestsTotal` |
| Metrics | **Total Req - Cache**    | Time series  | `httpMetrics`    | `missedData`, `savedData`, `dataTransferredIn`, `dataTransferredOut`, `dataTransferredTotal`                                                                                                                           |
| Metrics | **Http Methods**         | Time series  | `httpMetrics`    | `requestsHttpMethodGet`, `requestsHttpMethodPost`, `requestsHttpMethodHead`, `requestsHttpMethodOthers`                                                                                                                |
| Metrics | **Logs**                 | Table        | `httpMetrics`    | `host`, `count`                                                                                                                                                                                                        |
| Metrics | **Status Codes**         | Time series  | `httpMetrics`    | `requestsStatusCode2xx`, `requestsStatusCode3xx`, `requestsStatusCode4xx`, `requestsStatusCode5xx`                                                                                                                     |

Os três painéis da linha **Events** contam os valores de `host` de cada grupo e mantêm 10 grupos com `limit: 10`. A linha `orderBy: [count_DESC]` dessas queries está comentada, então a query não pede os maiores grupos primeiro.

Em **Status Codes**, um campo de classe conta somente os status codes daquela classe que não têm campo próprio. Por exemplo, `requestsStatusCode2xx` retorna `0` quando todas as respostas 2xx são `200`, que `requestsStatusCode200` conta. Para os campos por código, consulte [Detalhe as requisições por status code](/pt-br/documentacao/guias/plataforma/observabilidade/detalhar-requisicoes-por-status-code/).

Para o tipo e o significado de cada campo de `httpMetrics`, consulte [Campos da API GraphQL do Real-Time Metrics](/pt-br/documentacao/devtools/graphql/campos-gql-real-time-metrics/#workloadmetrics).

---

## Próximos passos

- [Importe o dashboard Data Transferred](/pt-br/documentacao/guias/plataforma/observabilidade/data-transferred-dash.md): Acompanhe em um segundo dashboard do Grafana os dados transferidos, o offload e a largura de banda das suas aplicações.
- [Real-Time Events](/pt-br/documentacao/plataforma/real-time-events.md): Leia sobre o produto cujo dataset os três painéis Events consultam.
- [Instale o plugin da Azion para Grafana](/pt-br/documentacao/guias/plataforma/observabilidade/integrar-grafana.md): Leia dados do Real-Time Metrics e do Real-Time Events no Grafana pelo plugin de data source da Azion.
- [Campos do Real-Time Metrics](/pt-br/documentacao/devtools/graphql/campos-gql-real-time-metrics.md): Consulte cada campo que os painéis Metrics mostram, com o seu tipo.
