diff --git a/aggregation_mode/docker-compose.yaml b/aggregation_mode/docker-compose.yaml index 26d742c85a..41cfe690f4 100644 --- a/aggregation_mode/docker-compose.yaml +++ b/aggregation_mode/docker-compose.yaml @@ -1,6 +1,11 @@ volumes: postgres_data: +networks: + aligned-network: + name: aligned-network + driver: bridge + name: aggregation-mode services: postgres: @@ -14,6 +19,9 @@ services: - postgres_data:/var/lib/postgresql/data ports: - 5435:5432 + networks: + - aligned-network + adminer: image: adminer restart: always @@ -21,3 +29,5 @@ services: - postgres ports: - 8090:8080 + networks: + - aligned-network diff --git a/aggregation_mode/payments_poller/src/db.rs b/aggregation_mode/payments_poller/src/db.rs index aa20b1312c..a1b5725688 100644 --- a/aggregation_mode/payments_poller/src/db.rs +++ b/aggregation_mode/payments_poller/src/db.rs @@ -80,4 +80,23 @@ impl Db { }) .await } + + pub async fn count_total_active_subscriptions( + &self, + epoch: BigDecimal, + ) -> Result { + self.orchestrator + .query(async |pool| { + sqlx::query_scalar::<_, i64>( + " + SELECT COUNT(*) + FROM payment_events + WHERE started_at < $1 AND $1 < valid_until", + ) + .bind(&epoch) + .fetch_one(&pool) + .await + }) + .await + } } diff --git a/aggregation_mode/payments_poller/src/metrics.rs b/aggregation_mode/payments_poller/src/metrics.rs index aabdc5e5ae..f4d7a502ef 100644 --- a/aggregation_mode/payments_poller/src/metrics.rs +++ b/aggregation_mode/payments_poller/src/metrics.rs @@ -6,6 +6,7 @@ use std::sync::Arc; pub struct PaymentsPollerMetrics { pub registry: Registry, pub last_processed_block: Gauge, + pub active_subscriptions: Gauge, } impl PaymentsPollerMetrics { @@ -17,7 +18,13 @@ impl PaymentsPollerMetrics { "Last processed block by poller" ))?; + let active_subscriptions = Gauge::with_opts(opts!( + "active_subscriptions", + "Active payment subscriptions by poller" + ))?; + registry.register(Box::new(last_processed_block.clone()))?; + registry.register(Box::new(active_subscriptions.clone()))?; // Arc is used because metrics are a shared resource accessed by both the background and metrics HTTP // server and the application code, across multiple Actix worker threads. The server outlives start(), @@ -25,6 +32,7 @@ impl PaymentsPollerMetrics { let metrics = Arc::new(Self { registry, last_processed_block, + active_subscriptions, }); let server_metrics = metrics.clone(); @@ -63,4 +71,8 @@ impl PaymentsPollerMetrics { pub fn register_last_processed_block(&self, value: u64) { self.last_processed_block.set(value as f64); } + + pub fn register_active_subscriptions(&self, value: i64) { + self.active_subscriptions.set(value as f64); + } } diff --git a/aggregation_mode/payments_poller/src/payments.rs b/aggregation_mode/payments_poller/src/payments.rs index 005c56e7dd..e7c87ffaef 100644 --- a/aggregation_mode/payments_poller/src/payments.rs +++ b/aggregation_mode/payments_poller/src/payments.rs @@ -1,4 +1,8 @@ -use std::{str::FromStr, sync::Arc}; +use std::{ + str::FromStr, + sync::Arc, + time::{SystemTime, UNIX_EPOCH}, +}; use crate::{ config::Config, @@ -131,7 +135,28 @@ impl PaymentsPoller { continue; }; + let now_epoch = match SystemTime::now().duration_since(UNIX_EPOCH) { + Ok(duration) => duration.as_secs(), + Err(_) => { + continue; + } + }; + + // Note: This implies a call to the database, and may be optimized to reduce the amount of calls + let Ok(active_subscriptions_amount) = self + .db + .count_total_active_subscriptions( + BigDecimal::from_str(&now_epoch.to_string()).unwrap(), + ) + .await + else { + tracing::error!("Failed to get the active subscriptions amount"); + continue; + }; + self.metrics.register_last_processed_block(current_block); + self.metrics + .register_active_subscriptions(active_subscriptions_amount); tokio::time::sleep(std::time::Duration::from_secs( seconds_to_wait_between_polls, diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 1b4aa63672..0428b9a4e1 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,573 +18,2686 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 7, + "id": 8, "links": [], "liveNow": false, "panels": [ { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "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 - }, - "insertNulls": 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": [] - }, + "collapsed": true, "gridPos": { - "h": 8, - "w": 8, + "h": 1, + "w": 24, "x": 0, "y": 0 }, - "id": 3, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "id": 9, + "panels": [], + "title": "Database", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 1 }, - "targets": [ + "id": 11, + "panels": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "editorMode": "code", - "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"4..\"}[10y])\n)", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" - } - ], - "title": "User error response count", - "type": "timeseries" - }, - { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "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 - }, - "insertNulls": 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 - } - ] - } + "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 + }, + "insertNulls": 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": 10 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"4..\"}[10y])\n)", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "User error response count", + "type": "timeseries" }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 0 - }, - "id": 2, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "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 + }, + "insertNulls": 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": 8, + "y": 10 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"5..\"}[10y])\n)", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Server Error response count", + "type": "timeseries" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "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 + }, + "insertNulls": 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": 16, + "y": 10 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"2..\",endpoint!=\"/metrics\"}[$__range])\n)", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Success response count", + "type": "timeseries" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "http" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "200": { + "color": "green", + "index": 0, + "text": "UP" + }, + "null": { + "color": "red", + "index": 1, + "text": "DOWN" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 6, + "x": 0, + "y": 18 + }, + "id": 10, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "http" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "", + "source": "url", + "type": "json", + "url": "http://host.docker.internal:8089", + "url_options": { + "data": "", + "method": "GET" + } + } + ], + "title": "Gateway Status", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "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 + }, + "insertNulls": 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": 9, + "x": 6, + "y": 18 + }, + "id": 4, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_query_bucket{query=\"sp1-post\"}[10y])))", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "DB posts latency (p50)", + "type": "timeseries" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "editorMode": "code", - "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"5..\"}[10y])\n)", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "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 + }, + "insertNulls": 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": 9, + "x": 15, + "y": 18 + }, + "id": 5, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "sum(rate(time_elapsed_db_query_count[10y]))", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "DB posts throughput", + "type": "timeseries" } ], - "title": "Server Error response count", - "type": "timeseries" + "title": "Gateway", + "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "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 - }, - "insertNulls": 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": [] - }, + "collapsed": true, "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 0 + "h": 1, + "w": 24, + "x": 0, + "y": 2 }, - "id": 1, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "id": 8, + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "postgres" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 3 + }, + "id": 7, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "postgres" + }, + "editorMode": "builder", + "format": "table", + "rawSql": "SELECT * FROM payment_events LIMIT 50 ", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [ + { + "name": "*", + "type": "functionParameter" + } + ], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + }, + "table": "payment_events" + } + ], + "title": "Payment events (placeholder)", + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 12, + "y": 3 + }, + "id": 6, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "last_processed_block{}", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Last Processed Block", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 5, + "x": 19, + "y": 3 + }, + "id": 15, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "active_subscriptions{}", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Active Subscriptions", + "type": "stat" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "editorMode": "code", - "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"2..\",endpoint!=\"/metrics\"}[10y])\n)", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "0": { + "color": "red", + "index": 1, + "text": "DOWN" + }, + "1": { + "color": "green", + "index": 0, + "text": "UP" + } + }, + "type": "value" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 7, + "x": 0, + "y": 9 + }, + "id": 39, + "options": { + "colorMode": "value", + "graphMode": "none", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "up{bot=\"poller\"}", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Status", + "type": "stat" } ], - "title": "Success response count", - "type": "timeseries" + "title": "Poller", + "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "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 - }, - "insertNulls": 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": [] + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 3 }, + "id": 12, + "panels": [], + "title": "Proof Aggregator", + "type": "row" + }, + { + "collapsed": true, "gridPos": { - "h": 8, - "w": 12, + "h": 1, + "w": 24, "x": 0, - "y": 8 + "y": 4 }, - "id": 4, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "id": 13, + "panels": [ + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 13 + }, + "id": 21, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "json_options": { + "root_is_not_array": true + }, + "method": "POST", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"\n| project \"block_number\"=\"number\"", + "url": "", + "url_options": { + "body_content_type": "application/json", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_blockNumber\",\n \"params\": [],\n \"id\": 1\n}", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Current Block", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + } + ], + "type": "stat" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { - "type": "prometheus", - "uid": "prometheus" + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] }, - "editorMode": "code", - "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_query_bucket{query=\"sp1-post\"}[10y])))", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 19 + }, + "id": 22, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "json_options": { + "root_is_not_array": true + }, + "method": "POST", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "", + "url": "", + "url_options": { + "body_content_type": "application/json", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_gasPrice\",\n \"params\": [],\n \"id\": 1\n}", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Current Gas Price (wei)", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + } + ], + "type": "stat" } ], - "title": "DB posts latency (p50)", - "type": "timeseries" + "title": "Ethereum", + "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "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 - }, - "insertNulls": 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": [] - }, + "collapsed": true, "gridPos": { - "h": 8, - "w": 12, - "x": 12, - "y": 8 + "h": 1, + "w": 24, + "x": 0, + "y": 5 }, - "id": 6, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "id": 14, + "panels": [ + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "noValue": "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 14, + "x": 5, + "y": 20 + }, + "id": 32, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "json_options": { + "columnar": false, + "root_is_not_array": true + }, + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "url": "", + "url_options": { + "body_content_type": "application/json", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_call\",\n \"params\": [\n {\n \"to\": \"0xd84c0fEfEaEf69A51836DBf607E031a9033a4ed7\",\n \"data\": \"0x18160ddd\"\n },\n \"latest\"\n ],\n \"id\": 1\n }", + "method": "POST" + } + } + ], + "title": "Address", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + } + ], + "type": "stat" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { - "type": "prometheus", - "uid": "prometheus" + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 6, + "x": 0, + "y": 23 + }, + "id": 34, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0x922D6956C99E12DFeB3224DEA977D0939758A1Fe\", \"data\": \"0x07f56ad4\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Cost in Gwei", + "transformations": [ + { + "id": "convertFieldType", + "options": {} + }, + { + "id": "calculateField", + "options": { + "binary": { + "left": "value", + "operator": "/", + "reducer": "sum", + "right": "1000000000" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + }, + "replaceFields": true + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 6, + "x": 6, + "y": 23 + }, + "id": 33, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0x922D6956C99E12DFeB3224DEA977D0939758A1Fe\", \"data\": \"0x86925476\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Expiration time in days", + "transformations": [ + { + "id": "convertFieldType", + "options": {} + }, + { + "id": "calculateField", + "options": { + "binary": { + "left": "value", + "operator": "/", + "reducer": "sum", + "right": "86400" + }, + "mode": "binary", + "reduce": { + "include": [ + "value" + ], + "reducer": "lastNotNull" + }, + "replaceFields": true + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 6, + "x": 12, + "y": 23 + }, + "id": 37, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0x922D6956C99E12DFeB3224DEA977D0939758A1Fe\", \"data\": \"0xa4ece875\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Subscription Limit", + "transformations": [ + { + "id": "convertFieldType", + "options": {} + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 6, + "x": 18, + "y": 23 + }, + "id": 38, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0x922D6956C99E12DFeB3224DEA977D0939758A1Fe\", \"data\": \"0x051c7de3\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Max Subscription Time Ahead (in days)", + "transformations": [ + { + "id": "convertFieldType", + "options": {} + }, + { + "id": "calculateField", + "options": { + "binary": { + "left": "value", + "operator": "/", + "reducer": "sum", + "right": "86400" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + }, + "replaceFields": true + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 6, + "x": 0, + "y": 29 + }, + "id": 35, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0x922D6956C99E12DFeB3224DEA977D0939758A1Fe\", \"data\": \"0x93588bee\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Active Subscriptions", + "transformations": [ + { + "id": "convertFieldType", + "options": {} + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 9, + "x": 6, + "y": 29 }, - "editorMode": "code", - "expr": "last_processed_block{}", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "id": 36, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0x922D6956C99E12DFeB3224DEA977D0939758A1Fe\", \"data\": \"0x2c42a9dd\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Funds recipient", + "transformations": [], + "type": "stat" } ], - "title": "Payments Poller Last Processed Block", - "type": "timeseries" + "title": "Payments contract", + "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "prometheus" - }, - "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 - }, - "insertNulls": 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": [] - }, + "collapsed": true, "gridPos": { - "h": 8, - "w": 12, + "h": 1, + "w": 24, "x": 0, - "y": 16 + "y": 6 }, - "id": 5, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "id": 16, + "panels": [ + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 15 + }, + "id": 24, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "json_options": { + "columnar": false, + "root_is_not_array": true + }, + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "url": "", + "url_options": { + "body_content_type": "application/json", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_call\",\n \"params\": [\n {\n \"to\": \"0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc\",\n \"data\": \"0x972e58ba\"\n },\n \"latest\"\n ],\n \"id\": 1\n }", + "method": "POST" + } + } + ], + "title": "RISC0 ID", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + } + ], + "type": "stat" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { - "type": "prometheus", - "uid": "prometheus" + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 9, + "x": 7, + "y": 15 + }, + "id": 27, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc\", \"data\": \"0x616af4f7\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "RISC0 Verifier", + "transformations": [], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "noValue": "0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 8, + "x": 16, + "y": 15 + }, + "id": 31, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" }, - "editorMode": "code", - "expr": "sum(rate(time_elapsed_db_query_count[10y]))", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "json_options": { + "columnar": false, + "root_is_not_array": true + }, + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "url": "", + "url_options": { + "body_content_type": "application/json", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_call\",\n \"params\": [\n {\n \"to\": \"0xd84c0fEfEaEf69A51836DBf607E031a9033a4ed7\",\n \"data\": \"0x18160ddd\"\n },\n \"latest\"\n ],\n \"id\": 1\n }", + "method": "POST" + } + } + ], + "title": "Address", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 21 + }, + "id": 25, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "json_options": { + "columnar": false, + "root_is_not_array": true + }, + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "url": "", + "url_options": { + "body_content_type": "application/json", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_call\",\n \"params\": [\n {\n \"to\": \"0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc\",\n \"data\": \"0x6eecb4c9\"\n },\n \"latest\"\n ],\n \"id\": 1\n }", + "method": "POST" + } + } + ], + "title": "SP1 ID", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + } + ], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 9, + "x": 7, + "y": 21 + }, + "id": 28, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc\", \"data\": \"0x294e3ccb\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "SP1 Verifier", + "transformations": [], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 27 + }, + "id": 26, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc\", \"data\": \"0x8da5cb5b\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Owner", + "transformations": [], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 7, + "y": 27 + }, + "id": 29, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{ \"jsonrpc\": \"2.0\", \"method\": \"eth_call\", \"params\": [ { \"to\": \"0xcbEAF3BDe82155F56486Fb5a1072cb8baAf547cc\", \"data\": \"0x4c46688c\" }, \"latest\" ], \"id\": 1 }", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Proof Aggregator", + "transformations": [], + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [ + { + "options": { + "pattern": "^(.{2})0+(.{40})$", + "result": { + "index": 0, + "text": "$1$2" + } + }, + "type": "regex" + } + ], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green" + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 15, + "y": 27 + }, + "id": 30, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "filters": [], + "format": "table", + "global_query_id": "", + "refId": "A", + "root_selector": "$.result", + "source": "url", + "type": "json", + "uql": "parse-json\n| scope \"result\"", + "url": "", + "url_options": { + "body_content_type": "text/plain", + "body_type": "raw", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_getBalance\",\n \"params\": [\n \"0xa0ee7a142d267c1f36714e4a8f75612f20a79720\",\n \"latest\"\n ],\n \"id\": 1\n}", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Proof Aggregator Balance in ETH", + "transformations": [ + { + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "value" + } + ], + "fields": {} + } + }, + { + "id": "calculateField", + "options": { + "binary": { + "left": "value", + "operator": "/", + "reducer": "sum", + "right": "1000000000000000000" + }, + "mode": "binary", + "reduce": { + "include": [ + "value" + ], + "reducer": "sum" + }, + "replaceFields": true + } + } + ], + "type": "stat" } ], - "title": "DB posts throughput", - "type": "timeseries" + "title": "Proof Aggregator contract", + "type": "row" } ], "refresh": "", @@ -595,7 +2708,7 @@ "list": [] }, "time": { - "from": "now-5m", + "from": "now-15m", "to": "now" }, "timepicker": {}, diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index add11b7150..dcdbb413eb 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -6,9 +6,50 @@ datasources: uid: prometheus access: proxy orgId: 1 - url: http://prometheus:9090 + url: "${PROMETHEUS_URL}" basicAuth: false isDefault: true editable: true jsonData: timeInterval: 1s + + - name: PostgreSQL + type: postgres + uid: postgres + access: proxy + orgId: 1 + url: "${POSTGRES_HOST}:${POSTGRES_PORT}" + database: ${POSTGRES_DB} + user: ${POSTGRES_USER} + secureJsonData: + password: ${POSTGRES_PASSWORD} + basicAuth: false + isDefault: false + editable: true + jsonData: + sslmode: disable + postgresVersion: 1600 + + - name: "Ethereum RPC" + type: "yesoreyeram-infinity-datasource" + typeName: "Infinity" + uid: "ethereum_rpc" + access: "proxy" + url: "${RPC_URL}" + isDefault: false + jsonData: + global_queries: [] + readOnly: false + editable: true + basicAuth: false + + # Note: We use this data source for health check calls. The one above is not useful for non-Ethereum calls + # because the RPC URL is prepended to the one indicated in the panel. + - name: "HTTP" + type: "yesoreyeram-infinity-datasource" + uid: "http" + access: "proxy" + url: "" + isDefault: false + jsonData: + global_queries: [] diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index ab40cee015..c5d0ec3ddf 100644 --- a/metrics-docker-compose.yaml +++ b/metrics-docker-compose.yaml @@ -2,8 +2,8 @@ version: "3" networks: aligned-network: + external: true name: aligned-network - driver: bridge services: grafana: @@ -16,9 +16,20 @@ services: # See https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/#override-configuration-with-environment-variables # and https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/ # They recommend using env vars instead of overwriting config.ini + - GF_INSTALL_PLUGINS=yesoreyeram-infinity-datasource - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} - GF_USERS_ALLOW_SIGN_UP=false + - RPC_URL=http://host.docker.internal:8545 + # Postgres datasource + - POSTGRES_HOST=postgres + - POSTGRES_PORT=5432 + - POSTGRES_DB=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + - PROMETHEUS_URL=http://prometheus:9090 + extra_hosts: + - "host.docker.internal:host-gateway" restart: unless-stopped ports: - "3000:3000"