chore: Use templating for datasource in grafana dashboard file (#2542)

### Description

This PR uses templating for datasource. i.e. no need to keep
<prometheus> inside the dashboard json file which should be manually
replaced by users.

### Drive-by changes

<!--
Are there any minor or drive-by changes also included?
-->

### Related issues

<!--
- Fixes #[issue number here]
-->

### Backward compatibility

<!--
Are these changes backward compatible? Are there any infrastructure
implications, e.g. changes that would prohibit deploying older commits
using this infra tooling?

Yes/No
-->

### Testing

<!--
What kind of testing have these changes undergone?

None/Manual/Unit Tests
-->

Co-authored-by: josedev-union <josedev-union@users.noreply.github.com>
Co-authored-by: Mattie Conover <git@mconover.dev>
pull/2685/head
josedev-union 1 year ago committed by GitHub
parent ff2a495389
commit 70c1ceebbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 9
      tools/grafana/README.md
  2. 75
      tools/grafana/validator-dashboard.json

@ -5,11 +5,10 @@ updated when we want to update our published templates.
## Importing ## Importing
1. replace all instances of `<prometheus>` with your prometheus deployment name in grafana 1. Create a new dashboard in grafana
2. Create a new dashboard in grafana 2. Select the gear icon "dashboard settings"
3. Select the gear icon "dashboard settings" 3. Select "JSON Model"
4. Select "JSON Model" 4. Copy/paste from the "\*.json" file
5. Copy/paste from the "\*.json" file
## Exporting ## Exporting

@ -42,7 +42,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "Seconds between blocks for each chain", "description": "Seconds between blocks for each chain",
"fieldConfig": { "fieldConfig": {
@ -119,7 +119,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "1 / avg by(chain)(rate(hyperlane_block_height{hyperlane_deployment=~\"$deployment\",chain=~\"$chain\",agent=\"validator\"}[$__rate_interval]))", "expr": "1 / avg by(chain)(rate(hyperlane_block_height{hyperlane_deployment=~\"$deployment\",chain=~\"$chain\",agent=\"validator\"}[$__rate_interval]))",
@ -135,7 +135,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -181,7 +181,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "max(hyperlane_block_height{agent=\"validator\", }) by (chain)", "expr": "max(hyperlane_block_height{agent=\"validator\", }) by (chain)",
@ -196,7 +196,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -242,7 +242,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"exemplar": false, "exemplar": false,
@ -260,7 +260,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "Count of messages signed per time window", "description": "Count of messages signed per time window",
"fieldConfig": { "fieldConfig": {
@ -333,7 +333,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "max by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_processed\"}) - max by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_processed\"} offset $bucket)", "expr": "max by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_processed\"}) - max by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_processed\"} offset $bucket)",
@ -349,7 +349,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "If running multiple validator instances, the difference between the latest and earliest observed checkpoints for each chain.", "description": "If running multiple validator instances, the difference between the latest and earliest observed checkpoints for each chain.",
"fieldConfig": { "fieldConfig": {
@ -424,7 +424,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "max by(chain) (hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_observed\"}) - min by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_observed\"})", "expr": "max by(chain) (hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_observed\"}) - min by (chain)(hyperlane_latest_checkpoint{agent=\"validator\", chain=~\"$chain\", phase=\"validator_observed\"})",
@ -440,7 +440,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -523,7 +523,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"exemplar": false, "exemplar": false,
@ -541,7 +541,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"fieldConfig": { "fieldConfig": {
"defaults": { "defaults": {
@ -612,7 +612,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"exemplar": false, "exemplar": false,
@ -629,7 +629,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "Total number of contract calls made by chain for a period", "description": "Total number of contract calls made by chain for a period",
"fieldConfig": { "fieldConfig": {
@ -706,7 +706,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "sum by (chain)(increase(hyperlane_contract_call_count{ chain=~\"$chain\", agent=\"validator\"}[$bucket]))", "expr": "sum by (chain)(increase(hyperlane_contract_call_count{ chain=~\"$chain\", agent=\"validator\"}[$bucket]))",
@ -722,7 +722,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "The rate at which we are making contract calls.", "description": "The rate at which we are making contract calls.",
"fieldConfig": { "fieldConfig": {
@ -799,7 +799,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "sum by (chain) (rate(hyperlane_contract_call_count{agent=\"validator\"}[$__rate_interval]))", "expr": "sum by (chain) (rate(hyperlane_contract_call_count{agent=\"validator\"}[$__rate_interval]))",
@ -815,7 +815,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "The average contract call duration by chain", "description": "The average contract call duration by chain",
"fieldConfig": { "fieldConfig": {
@ -892,7 +892,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "avg by (chain)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]) - rate(hyperlane_contract_call_duration_seconds{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))", "expr": "avg by (chain)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]) - rate(hyperlane_contract_call_duration_seconds{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))",
@ -918,7 +918,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
@ -994,7 +994,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "sum by (contract_name, function_name)(increase(hyperlane_contract_call_count{ chain=~\"$chain\", agent=\"validator\"}[$bucket]))", "expr": "sum by (contract_name, function_name)(increase(hyperlane_contract_call_count{ chain=~\"$chain\", agent=\"validator\"}[$bucket]))",
@ -1010,7 +1010,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
@ -1086,7 +1086,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "sum by (function_name,contract_name)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))", "expr": "sum by (function_name,contract_name)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))",
@ -1102,7 +1102,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"description": "", "description": "",
"fieldConfig": { "fieldConfig": {
@ -1178,7 +1178,7 @@
{ {
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"editorMode": "code", "editorMode": "code",
"expr": "avg by (function_name,contract_name)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]) - rate(hyperlane_contract_call_duration_seconds{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))", "expr": "avg by (function_name,contract_name)(rate(hyperlane_contract_call_count{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]) - rate(hyperlane_contract_call_duration_seconds{agent=\"validator\",chain=~\"$chain\"}[$__rate_interval]))",
@ -1204,6 +1204,25 @@
"tags": [], "tags": [],
"templating": { "templating": {
"list": [ "list": [
{
"current": {
"selected": true,
"text": "default",
"value": "default"
},
"hide": 0,
"includeAll": false,
"label": "Data Source",
"multi": false,
"name": "datasource",
"options": [],
"query": "prometheus",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{ {
"auto": true, "auto": true,
"auto_count": 30, "auto_count": 30,
@ -1277,7 +1296,7 @@
}, },
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"definition": "label_values(hyperlane_block_height, hyperlane_deployment)", "definition": "label_values(hyperlane_block_height, hyperlane_deployment)",
"hide": 0, "hide": 0,
@ -1308,7 +1327,7 @@
}, },
"datasource": { "datasource": {
"type": "prometheus", "type": "prometheus",
"uid": "<prometheus>" "uid": "$datasource"
}, },
"definition": "label_values(hyperlane_block_height{hyperlane_deployment=~\"$deployment\"}, chain)", "definition": "label_values(hyperlane_block_height{hyperlane_deployment=~\"$deployment\"}, chain)",
"hide": 0, "hide": 0,

Loading…
Cancel
Save