diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index a3c0799..d74a8ea 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -21,6 +21,8 @@ services: grafana: image: grafana/grafana:8.1.5 volumes: + - ./grafana/provisioning:/etc/grafana/provisioning + - ./grafana/dashboards:/etc/grafana/dashboards - grafana-storage:/var/lib/grafana ports: - "3000:3000" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 6e20fa3..5fdc931 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -37,6 +37,8 @@ services: container_name: grafana image: grafana/grafana:8.1.5 volumes: + - ./grafana/provisioning:/etc/grafana/provisioning + - ./grafana/dashboards:/etc/grafana/dashboards - grafana-storage:/var/lib/grafana labels: - "traefik.enable=true" diff --git a/grafana/dashboards/amb.json b/grafana/dashboards/amb.json new file mode 100644 index 0000000..423a0d2 --- /dev/null +++ b/grafana/dashboards/amb.json @@ -0,0 +1,1575 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- 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, + "gnetId": null, + "graphTooltip": 0, + "id": 2, + "iteration": 1648451955057, + "links": [], + "panels": [ + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 2, + "panels": [], + "title": "Foreign->Home", + "type": "row" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 1 + }, + "id": 4, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "vertical", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Since launch\"\nFROM messages m\nWHERE m.direction::direction_enum = 'foreign_to_home' AND m.bridge_id = '$bridge';\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Last 7 days\"\nFROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.direction::direction_enum = 'foreign_to_home' AND m.bridge_id = '$bridge' AND now() - bt.timestamp < interval '7 days';\n", + "refId": "B", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Last 24 hours\"\nFROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.direction::direction_enum = 'foreign_to_home' AND m.bridge_id = '$bridge' AND now() - bt.timestamp < interval '24 hours';\n", + "refId": "C", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Total messages", + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 1 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.5", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n $__timeGroupAlias(ts.timestamp, '24h'), count(*)\nFROM\n sent_messages sm\n JOIN logs l ON l.id = sm.log_id\n JOIN block_timestamps ts ON ts.chain_id = l.chain_id AND ts.block_number = l.block_number\n JOIN messages m ON m.msg_hash = sm.msg_hash AND m.bridge_id = sm.bridge_id\nWHERE m.bridge_id = '$bridge' AND m.direction::text = 'foreign_to_home'\nGROUP BY time\nORDER BY time\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Messages over time", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 8, + "panels": [], + "title": "Home->Foreign", + "type": "row" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 8 + }, + "id": 9, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Since launch\"\nFROM messages m\nWHERE m.direction::direction_enum = 'home_to_foreign' AND m.bridge_id = '$bridge';\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Last 7 days\"\nFROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.direction::direction_enum = 'home_to_foreign' AND m.bridge_id = '$bridge' AND now() - bt.timestamp < interval '7 days';\n", + "refId": "B", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Last 24 hours\"\nFROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.direction::direction_enum = 'home_to_foreign' AND m.bridge_id = '$bridge' AND now() - bt.timestamp < interval '24 hours';\n", + "refId": "C", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Total messages", + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 8 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.5", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n $__timeGroupAlias(ts.timestamp, '24h'), count(*)\nFROM\n sent_messages sm\n JOIN logs l ON l.id = sm.log_id\n JOIN block_timestamps ts ON ts.chain_id = l.chain_id AND ts.block_number = l.block_number\n JOIN messages m ON m.msg_hash = sm.msg_hash AND m.bridge_id = sm.bridge_id\nWHERE m.bridge_id = '$bridge' AND m.direction::text = 'home_to_foreign'\nGROUP BY time\nORDER BY time\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Messages over time", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 14 + }, + "id": 16, + "panels": [], + "title": "Async calls", + "type": "row" + }, + { + "datasource": null, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 15 + }, + "id": 17, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "center", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "text": {}, + "textMode": "auto" + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Since launch\"\nFROM information_requests m\nWHERE m.direction::direction_enum = 'home_to_foreign' AND m.bridge_id = '$bridge';\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Last 7 days\"\nFROM information_requests m JOIN sent_information_requests sm ON sm.bridge_id = m.bridge_id AND sm.message_id = m.message_id\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.direction::direction_enum = 'home_to_foreign' AND m.bridge_id = '$bridge' AND now() - bt.timestamp < interval '7 days';\n", + "refId": "B", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + }, + { + "format": "table", + "group": [], + "hide": false, + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT count(*) as \"Last 24 hours\"\nFROM information_requests m JOIN sent_information_requests sm ON sm.bridge_id = m.bridge_id AND sm.message_id = m.message_id\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.direction::direction_enum = 'home_to_foreign' AND m.bridge_id = '$bridge' AND now() - bt.timestamp < interval '24 hours';\n", + "refId": "C", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Total messages", + "type": "stat" + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 6, + "w": 12, + "x": 12, + "y": 15 + }, + "hiddenSeries": false, + "id": 18, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": true, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "alertThreshold": true + }, + "percentage": false, + "pluginVersion": "8.1.5", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT\n $__timeGroupAlias(ts.timestamp, '24h'), count(*)\nFROM\n sent_information_requests sm\n JOIN logs l ON l.id = sm.log_id\n JOIN block_timestamps ts ON ts.chain_id = l.chain_id AND ts.block_number = l.block_number\n JOIN information_requests m ON m.message_id = sm.message_id AND m.bridge_id = sm.bridge_id\nWHERE m.bridge_id = '$bridge' AND m.direction::text = 'home_to_foreign'\nGROUP BY time\nORDER BY time\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Messages over time", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": true, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 21 + }, + "id": 12, + "panels": [], + "title": "Popular message directions", + "type": "row" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "sender" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 351 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "executor" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 355 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "direction" + }, + "properties": [ + { + "id": "custom.width", + "value": 149 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "count" + }, + "properties": [ + { + "id": "custom.width", + "value": 727 + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 14, + "options": { + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT m.direction, concat('0x', encode(m.sender, 'hex')) as sender, concat('0x', encode(m.executor, 'hex')) as executor, count(*) FROM messages m WHERE m.bridge_id = '$bridge' GROUP BY m.direction, m.sender, m.executor ORDER BY count(*) DESC\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Message stats", + "type": "table" + }, + { + "collapsed": false, + "datasource": null, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 31 + }, + "id": 24, + "panels": [], + "title": "Stats", + "type": "row" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "tx_hash" + }, + "properties": [ + { + "id": "unit", + "value": "string" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "sender" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 346 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "executor" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 347 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "data_type" + }, + "properties": [ + { + "id": "custom.width", + "value": 95 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "timestamp" + }, + "properties": [ + { + "id": "custom.width", + "value": 201 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 24, + "x": 0, + "y": 32 + }, + "id": 20, + "options": { + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT bt.\"timestamp\", m.data_type, concat('0x', encode(m.sender, 'hex')) as sender, concat('0x', encode(m.executor, 'hex')) as executor, concat('0x', encode(l.transaction_hash, 'hex')) as tx_hash FROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nLEFT JOIN executed_messages em ON em.bridge_id = m.bridge_id AND em.message_id = m.message_id\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.bridge_id = '$bridge' AND m.direction::direction_enum = 'home_to_foreign' AND em.log_id IS NULL\nORDER BY 1\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Messages waiting for execution", + "type": "table" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "tx_hash" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 645 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "sender" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 346 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "executor" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 347 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "data_type" + }, + "properties": [ + { + "id": "custom.width", + "value": 95 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "timestamp" + }, + "properties": [ + { + "id": "custom.width", + "value": 201 + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 24, + "x": 0, + "y": 43 + }, + "id": 22, + "options": { + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT bt.\"timestamp\", m.data_type, concat('0x', encode(m.sender, 'hex')) as sender, concat('0x', encode(m.executor, 'hex')) as executor, concat('0x', encode(cml.transaction_hash, 'hex')) as tx_hash FROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nLEFT JOIN executed_messages em ON em.bridge_id = m.bridge_id AND em.message_id = m.message_id\nLEFT JOIN collected_messages cm ON cm.bridge_id = m.bridge_id AND cm.msg_hash = m.msg_hash\nLEFT JOIN logs cml ON cml.id = cm.log_id\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.bridge_id = '$bridge' AND m.direction::direction_enum = 'home_to_foreign' AND em.log_id IS NULL\nAND data_type = 0\nAND concat('0x', encode(m.executor, 'hex')) = '0x88ad09518695c6c3712ac10a214be5109a655671'\nORDER BY 1\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "OB messages waiting for oracle execution", + "type": "table" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "validator" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 377 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "enabled" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-background-solid" + }, + { + "id": "custom.width", + "value": 73 + }, + { + "id": "unit", + "value": "bool" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "since_last_active" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "thresholds" + } + }, + { + "id": "custom.displayMode", + "value": "color-text" + }, + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "#EAB839", + "value": 3600 + }, + { + "color": "red", + "value": 36000 + } + ] + } + }, + { + "id": "unit", + "value": "dtdhms" + }, + { + "id": "custom.width", + "value": 133 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "total_confirmations" + }, + "properties": [ + { + "id": "custom.width", + "value": 230 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 0, + "y": 49 + }, + "id": 26, + "options": { + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT concat('0x', encode(v.address, 'hex')) as validator, count(v.removed_log_id) < count(*) as enabled,\n(\nSELECT extract(epoch from now() - max(bt.timestamp)) FROM signed_messages s\nJOIN logs l ON s.log_id = l.id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE s.bridge_id = '$bridge' AND s.signer = v.address\n) as since_last_active,\n(\nSELECT count(*) FROM signed_messages s WHERE s.bridge_id = '$bridge' AND s.signer = v.address\n) as total_confirmations\nFROM bridge_validators v\nWHERE v.bridge_id = '$bridge'\nGROUP BY v.address\nORDER BY 2 DESC, 1\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Validators", + "type": "table" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "displayMode": "auto" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "tx_hash" + }, + "properties": [ + { + "id": "unit", + "value": "string" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "signer" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 346 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "executor" + }, + "properties": [ + { + "id": "unit", + "value": "string" + }, + { + "id": "custom.width", + "value": 347 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "data_type" + }, + "properties": [ + { + "id": "custom.width", + "value": 95 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "timestamp" + }, + "properties": [ + { + "id": "custom.width", + "value": 201 + } + ] + } + ] + }, + "gridPos": { + "h": 11, + "w": 12, + "x": 12, + "y": 49 + }, + "id": 21, + "options": { + "showHeader": true, + "sortBy": [] + }, + "pluginVersion": "8.1.5", + "targets": [ + { + "format": "table", + "group": [], + "metricColumn": "none", + "rawQuery": true, + "rawSql": "SELECT concat('0x', encode(sm2.signer, 'hex')) as signer, count(*) FROM messages m JOIN sent_messages sm ON sm.bridge_id = m.bridge_id AND sm.msg_hash = m.msg_hash\nJOIN signed_messages sm2 ON sm2.bridge_id = m.bridge_id AND sm2.msg_hash = m.msg_hash\nLEFT JOIN executed_messages em ON em.bridge_id = m.bridge_id AND em.message_id = m.message_id\nJOIN logs l ON l.id = sm.log_id\nJOIN block_timestamps bt ON bt.chain_id = l.chain_id AND bt.block_number = l.block_number\nWHERE m.bridge_id = '$bridge' AND m.direction::direction_enum = 'home_to_foreign' AND em.log_id IS NULL\nGROUP BY sm2.signer\n", + "refId": "A", + "select": [ + [ + { + "params": [ + "value" + ], + "type": "column" + } + ] + ], + "timeColumn": "time", + "where": [ + { + "name": "$__timeFilter", + "params": [], + "type": "macro" + } + ] + } + ], + "title": "Pending validator signatures", + "type": "table" + } + ], + "refresh": "", + "schemaVersion": 30, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "selected": false, + "text": "xdai-amb", + "value": "xdai-amb" + }, + "datasource": "PostgreSQL", + "definition": "SELECT DISTINCT bridge_id FROM messages", + "description": null, + "error": null, + "hide": 0, + "includeAll": false, + "label": null, + "multi": false, + "name": "bridge", + "options": [], + "query": "SELECT DISTINCT bridge_id FROM messages", + "refresh": 1, + "regex": "", + "skipUrlSync": false, + "sort": 0, + "type": "query" + } + ] + }, + "time": { + "from": "now-1y", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "AMB", + "uid": "rxl6GONnk", + "version": 4 +} diff --git a/grafana/dashboards/amb_system.json b/grafana/dashboards/amb_system.json new file mode 100644 index 0000000..86d6379 --- /dev/null +++ b/grafana/dashboards/amb_system.json @@ -0,0 +1,405 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- 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, + "gnetId": null, + "graphTooltip": 0, + "id": 1, + "iteration": 1648451982586, + "links": [], + "panels": [ + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 7, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "exemplar": true, + "expr": "increase(monitor_rpc_request_results_total{status!=\"ok\"}[20m])", + "interval": "", + "legendFormat": "{{status}} - {{chain_id}} - {{query}}", + "refId": "A" + } + ], + "title": "RPC request results", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 7 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "exemplar": true, + "expr": "histogram_quantile(0.9, increase(monitor_rpc_request_duration_seconds_bucket[5m]))", + "interval": "", + "legendFormat": "{{query}} - {{chain_id}}", + "refId": "A" + } + ], + "title": "Average RPC query durations", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 24, + "x": 0, + "y": 15 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "targets": [ + { + "exemplar": false, + "expr": "histogram_quantile(0.9, increase(monitor_db_query_duration_seconds_bucket[6m]))", + "instant": false, + "interval": "", + "legendFormat": "{{query}}", + "refId": "A" + } + ], + "title": "Average DB query duration", + "type": "timeseries" + }, + { + "datasource": "Prometheus", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 23 + }, + "id": 8, + "maxPerRow": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi" + } + }, + "repeat": "chain", + "repeatDirection": "h", + "targets": [ + { + "exemplar": true, + "expr": "{__name__=~\"monitor_contract_latest_head_block|monitor_contract_latest_fetched_block|monitor_contract_latest_processed_block\",chain_id=\"$chain\"} > 0", + "interval": "", + "legendFormat": "{{bridge_id}} - {{__name__}}", + "refId": "A" + } + ], + "title": "Syncronization in $chain", + "type": "timeseries" + } + ], + "refresh": false, + "schemaVersion": 30, + "style": "dark", + "tags": [], + "templating": { + "list": [ + { + "allValue": null, + "current": { + "selected": true, + "text": [ + "All" + ], + "value": [ + "$__all" + ] + }, + "datasource": "Prometheus", + "definition": "label_values(monitor_contract_latest_head_block{},chain_id)", + "description": null, + "error": null, + "hide": 0, + "includeAll": true, + "label": null, + "multi": true, + "name": "chain", + "options": [], + "query": { + "query": "label_values(monitor_contract_latest_head_block{},chain_id)", + "refId": "StandardVariableQuery" + }, + "refresh": 2, + "regex": "", + "skipUrlSync": false, + "sort": 3, + "type": "query" + } + ] + }, + "time": { + "from": "now-3h", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "AMB monitor dashboard", + "uid": "7fnHj1Hnz", + "version": 1 +} diff --git a/grafana/provisioning/dashboards/config.yml b/grafana/provisioning/dashboards/config.yml new file mode 100644 index 0000000..1995149 --- /dev/null +++ b/grafana/provisioning/dashboards/config.yml @@ -0,0 +1,13 @@ +apiVersion: 1 +providers: + - name: 'local fs' + orgId: 1 + folder: '' + folderUid: '' + type: file + disableDeletion: false + updateIntervalSeconds: 10 + allowUiUpdates: false + options: + path: /etc/grafana/dashboards + foldersFromFilesStructure: true \ No newline at end of file diff --git a/grafana/provisioning/datasources/config.yml b/grafana/provisioning/datasources/config.yml new file mode 100644 index 0000000..9abbe7b --- /dev/null +++ b/grafana/provisioning/datasources/config.yml @@ -0,0 +1,41 @@ +apiVersion: 1 +datasources: +- id: 1 + uid: VrxXe4xnk + orgId: 1 + name: PostgreSQL + type: postgres + typeName: PostgreSQL + typeLogoUrl: public/app/plugins/datasource/postgres/img/postgresql_logo.svg + access: proxy + url: 'postgres:5432' + password: 'pass' + user: postgres + database: db + basicAuth: false + isDefault: true + jsonData: + postgresVersion: 1200 + sslmode: disable + tlsAuth: false + tlsAuthWithCACert: false + tlsConfigurationMethod: file-path + tlsSkipVerify: true + readOnly: false +- id: 2 + uid: Fa9964bnk + orgId: 1 + name: Prometheus + type: prometheus + typeName: Prometheus + typeLogoUrl: public/app/plugins/datasource/prometheus/img/prometheus_logo.svg + access: proxy + url: 'http://prometheus:9090' + password: '' + user: '' + database: '' + basicAuth: true + isDefault: false + jsonData: + httpMethod: POST + readOnly: false