From a51d8f73fa5bf85742ce454761980b123e347f7e Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 19 Dec 2025 18:04:32 -0300 Subject: [PATCH 01/45] feat(aggregation-mode): add grafana dashboard --- aggregation_mode/Cargo.lock | 265 +++++++++++++- aggregation_mode/Cargo.toml | 3 + aggregation_mode/gateway/Cargo.toml | 4 + aggregation_mode/gateway/src/config.rs | 1 + aggregation_mode/gateway/src/http.rs | 19 + aggregation_mode/gateway/src/lib.rs | 1 + aggregation_mode/gateway/src/metrics.rs | 72 ++++ ...fig-agg-mode-gateway-ethereum-package.yaml | 4 + config-files/config-agg-mode-gateway.yaml | 3 + .../aligned/aggregation_mode_gateway.json | 325 ++++++++++++++++++ prometheus/prometheus.yaml | 7 + 11 files changed, 693 insertions(+), 11 deletions(-) create mode 100644 aggregation_mode/gateway/src/metrics.rs create mode 100644 grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json diff --git a/aggregation_mode/Cargo.lock b/aggregation_mode/Cargo.lock index 6e424297a6..845d0fbb30 100644 --- a/aggregation_mode/Cargo.lock +++ b/aggregation_mode/Cargo.lock @@ -233,6 +233,21 @@ dependencies = [ "syn 2.0.111", ] +[[package]] +name = "actix-web-prometheus" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad5228fd1a6b5d0f60d636776c2a70acc9fc667034bb4ac02ec4259f0eeeab6c" +dependencies = [ + "actix-service", + "actix-web", + "futures-lite", + "pin-project", + "prometheus", + "quanta", + "thiserror 1.0.69", +] + [[package]] name = "addchain" version = "0.2.0" @@ -1588,7 +1603,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand", + "fastrand 2.3.0", "hex", "http 1.4.0", "ring 0.17.14", @@ -1648,7 +1663,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand", + "fastrand 2.3.0", "http 0.2.12", "http-body 0.4.6", "percent-encoding", @@ -1673,7 +1688,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand", + "fastrand 2.3.0", "http 0.2.12", "regex-lite", "tracing", @@ -1695,7 +1710,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand", + "fastrand 2.3.0", "http 0.2.12", "regex-lite", "tracing", @@ -1717,7 +1732,7 @@ dependencies = [ "aws-smithy-types", "aws-types", "bytes", - "fastrand", + "fastrand 2.3.0", "http 0.2.12", "regex-lite", "tracing", @@ -1740,7 +1755,7 @@ dependencies = [ "aws-smithy-types", "aws-smithy-xml", "aws-types", - "fastrand", + "fastrand 2.3.0", "http 0.2.12", "regex-lite", "tracing", @@ -1871,7 +1886,7 @@ dependencies = [ "aws-smithy-runtime-api", "aws-smithy-types", "bytes", - "fastrand", + "fastrand 2.3.0", "http 0.2.12", "http 1.4.0", "http-body 0.4.6", @@ -2023,7 +2038,7 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cffb0e931875b666fc4fcb20fee52e9bbd1ef836fd9e9e04ec21555f9f85f7ef" dependencies = [ - "fastrand", + "fastrand 2.3.0", "gloo-timers 0.3.0", "tokio", ] @@ -4132,6 +4147,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649" +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + [[package]] name = "fastrand" version = "2.3.0" @@ -4409,6 +4433,21 @@ version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-locks" version = "0.7.1" @@ -4491,11 +4530,14 @@ version = "0.1.0" dependencies = [ "actix-multipart", "actix-web", + "actix-web-prometheus", "agg_mode_sdk", "aligned-sdk", "alloy", + "anyhow", "bincode", "hex", + "prometheus", "serde", "serde_json", "serde_yaml", @@ -4504,6 +4546,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber 0.3.22", + "warp", ] [[package]] @@ -4572,7 +4615,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -4807,6 +4850,30 @@ dependencies = [ "hashbrown 0.15.5", ] +[[package]] +name = "headers" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" +dependencies = [ + "base64 0.21.7", + "bytes", + "headers-core", + "http 0.2.12", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" +dependencies = [ + "http 0.2.12", +] + [[package]] name = "heapless" version = "0.7.17" @@ -5725,6 +5792,15 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" +[[package]] +name = "mach" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" +dependencies = [ + "libc", +] + [[package]] name = "macro-string" version = "0.1.4" @@ -5949,10 +6025,28 @@ checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873" dependencies = [ "libc", "log", - "wasi", + "wasi 0.11.1+wasi-snapshot-preview1", "windows-sys 0.61.2", ] +[[package]] +name = "multer" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" +dependencies = [ + "bytes", + "encoding_rs", + "futures-util", + "http 0.2.12", + "httparse", + "log", + "memchr", + "mime", + "spin 0.9.8", + "version_check", +] + [[package]] name = "multimap" version = "0.10.1" @@ -7150,6 +7244,46 @@ dependencies = [ "version_check", ] +[[package]] +name = "procfs" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "731e0d9356b0c25f16f33b5be79b1c57b562f141ebfcdb0ad8ac2c13a24293b4" +dependencies = [ + "bitflags 2.10.0", + "hex", + "lazy_static", + "procfs-core", + "rustix 0.38.44", +] + +[[package]] +name = "procfs-core" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3554923a69f4ce04c4a754260c338f505ce22642d3830e049a399fc2059a29" +dependencies = [ + "bitflags 2.10.0", + "hex", +] + +[[package]] +name = "prometheus" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d33c28a30771f7f96db69893f78b857f7450d7e0237e9c8fc6427a81bae7ed1" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "libc", + "memchr", + "parking_lot", + "procfs", + "protobuf", + "thiserror 1.0.69", +] + [[package]] name = "proof_aggregator" version = "0.1.0" @@ -7252,6 +7386,12 @@ dependencies = [ "prost", ] +[[package]] +name = "protobuf" +version = "2.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "106dd99e98437432fed6519dedecfade6a06a73bb7b2a1e019fdd2bee5778d94" + [[package]] name = "puffin" version = "0.19.1" @@ -7266,6 +7406,22 @@ dependencies = [ "parking_lot", ] +[[package]] +name = "quanta" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e31331286705f455e56cca62e0e717158474ff02b7936c1fa596d983f4ae27" +dependencies = [ + "crossbeam-utils", + "libc", + "mach", + "once_cell", + "raw-cpuid", + "wasi 0.10.2+wasi-snapshot-preview1", + "web-sys", + "winapi", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -7431,6 +7587,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "raw-cpuid" +version = "10.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" +dependencies = [ + "bitflags 1.3.2", +] + [[package]] name = "rawpointer" version = "0.2.1" @@ -8684,6 +8849,12 @@ dependencies = [ "serde_json", ] +[[package]] +name = "scoped-tls" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" + [[package]] name = "scopeguard" version = "1.2.0" @@ -10218,7 +10389,7 @@ version = "3.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d31c77bdf42a745371d260a26ca7163f1e0924b64afa0b688e61b5a9fa02f16" dependencies = [ - "fastrand", + "fastrand 2.3.0", "getrandom 0.3.4", "once_cell", "rustix 1.1.2", @@ -10444,6 +10615,18 @@ dependencies = [ "webpki-roots 0.25.4", ] +[[package]] +name = "tokio-tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" +dependencies = [ + "futures-util", + "log", + "tokio", + "tungstenite 0.21.0", +] + [[package]] name = "tokio-tungstenite" version = "0.23.1" @@ -10784,6 +10967,25 @@ dependencies = [ "utf-8", ] +[[package]] +name = "tungstenite" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" +dependencies = [ + "byteorder", + "bytes", + "data-encoding", + "http 1.4.0", + "httparse", + "log", + "rand 0.8.5", + "sha1", + "thiserror 1.0.69", + "url", + "utf-8", +] + [[package]] name = "tungstenite" version = "0.23.0" @@ -11074,6 +11276,12 @@ dependencies = [ "libc", ] +[[package]] +name = "waker-fn" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" + [[package]] name = "walkdir" version = "2.5.0" @@ -11093,6 +11301,41 @@ dependencies = [ "try-lock", ] +[[package]] +name = "warp" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378d202ff965b011c64817db11d5829506d3404edeadb61f190d111da3f231c" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "headers", + "http 0.2.12", + "hyper 0.14.32", + "log", + "mime", + "mime_guess", + "multer", + "percent-encoding", + "pin-project", + "scoped-tls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-tungstenite 0.21.0", + "tokio-util", + "tower-service", + "tracing", +] + +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + [[package]] name = "wasi" version = "0.11.1+wasi-snapshot-preview1" diff --git a/aggregation_mode/Cargo.toml b/aggregation_mode/Cargo.toml index 2ab51157c9..b61eb7cde1 100644 --- a/aggregation_mode/Cargo.toml +++ b/aggregation_mode/Cargo.toml @@ -16,6 +16,9 @@ aligned-sdk = { path = "../crates/sdk/" } db = { path = "./db" } sp1-sdk = "5.0.0" risc0-zkvm = { version = "3.0.3" } +prometheus = { version = "0.13.4", features = ["process"] } +anyhow = { version = "1.0" } +warp = "0.3.7" [profile.release] opt-level = 3 diff --git a/aggregation_mode/gateway/Cargo.toml b/aggregation_mode/gateway/Cargo.toml index 79ef53351c..e4347c50b2 100644 --- a/aggregation_mode/gateway/Cargo.toml +++ b/aggregation_mode/gateway/Cargo.toml @@ -7,6 +7,9 @@ edition = "2021" serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } +prometheus = { workspace = true } +anyhow = { workspace = true } +warp = { workspace = true } agg_mode_sdk = { path = "../sdk"} aligned-sdk = { workspace = true } sp1-sdk = { workspace = true } @@ -15,6 +18,7 @@ tracing-subscriber = { version = "0.3.0", features = ["env-filter"] } bincode = "1.3.3" actix-web = "4" actix-multipart = "0.7.2" +actix-web-prometheus = "0.1.0-beta.8" alloy = { workspace = true } tokio = { version = "1", features = ["time"]} # TODO: enable tls diff --git a/aggregation_mode/gateway/src/config.rs b/aggregation_mode/gateway/src/config.rs index 444882ab56..e6b7947679 100644 --- a/aggregation_mode/gateway/src/config.rs +++ b/aggregation_mode/gateway/src/config.rs @@ -8,6 +8,7 @@ pub struct Config { pub db_connection_url: String, pub network: String, pub max_daily_proofs_per_user: i64, + pub metrics_port: u16, } impl Config { diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index dabd367344..285fe5e17f 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -1,4 +1,5 @@ use std::{ + collections::HashMap, str::FromStr, time::{SystemTime, UNIX_EPOCH}, }; @@ -8,6 +9,7 @@ use actix_web::{ web::{self, Data}, App, HttpRequest, HttpResponse, HttpServer, Responder, }; +use actix_web_prometheus::PrometheusMetricsBuilder; use agg_mode_sdk::types::Network; use aligned_sdk::aggregation_layer::AggregationModeProvingSystem; use alloy::signers::Signature; @@ -23,6 +25,7 @@ use crate::{ config::Config, db::Db, helpers::get_time_left_day_formatted, + metrics::GatewayMetrics, types::{GetReceiptsResponse, SubmitProofRequestRisc0, SubmitProofRequestSP1}, verifiers::{verify_sp1_proof, VerificationError}, }; @@ -32,15 +35,22 @@ pub struct GatewayServer { db: Db, config: Config, network: Network, + metrics: GatewayMetrics, } impl GatewayServer { pub fn new(db: Db, config: Config) -> Self { let network = Network::from_str(&config.network).expect("A valid network in config file"); + + tracing::info!("Starting metrics server on port {}", config.metrics_port); + let metrics = + GatewayMetrics::start(config.metrics_port).expect("Failed to start metrics server"); + Self { db, config, network, + metrics, } } @@ -49,10 +59,19 @@ impl GatewayServer { let port = self.config.port; let state = self.clone(); + let mut labels = HashMap::new(); + labels.insert("label1".to_string(), "value1".to_string()); + let prometheus = PrometheusMetricsBuilder::new("api") + .endpoint("/metrics") + .const_labels(labels) + .build() + .unwrap(); + tracing::info!("Starting server at port {}", self.config.port); HttpServer::new(move || { App::new() .app_data(Data::new(state.clone())) + .wrap(prometheus.clone()) .route("/nonce/{address}", web::get().to(Self::get_nonce)) .route("/receipts", web::get().to(Self::get_receipts)) .route("/proof/sp1", web::post().to(Self::post_proof_sp1)) diff --git a/aggregation_mode/gateway/src/lib.rs b/aggregation_mode/gateway/src/lib.rs index 84693d8cd6..0df12ac02d 100644 --- a/aggregation_mode/gateway/src/lib.rs +++ b/aggregation_mode/gateway/src/lib.rs @@ -2,5 +2,6 @@ pub mod config; pub mod db; mod helpers; pub mod http; +mod metrics; mod types; mod verifiers; diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs new file mode 100644 index 0000000000..6bff5a767c --- /dev/null +++ b/aggregation_mode/gateway/src/metrics.rs @@ -0,0 +1,72 @@ +use prometheus::{self, opts, register_int_counter, IntCounter}; +use warp::{reject::Rejection, reply::Reply, Filter}; + +#[derive(Clone, Debug)] +pub struct GatewayMetrics { + pub success_response: IntCounter, + pub server_error_response: IntCounter, + pub user_error_response: IntCounter, +} + +impl GatewayMetrics { + pub fn start(metrics_port: u16) -> anyhow::Result { + let registry = prometheus::Registry::new(); + + let success_response = + register_int_counter!(opts!("success_response_count", "Success Responses"))?; + + let server_error_response = + register_int_counter!(opts!("server_error_response_count", "Success Responses"))?; + + let user_error_response = + register_int_counter!(opts!("user_error_response_count", "Success Responses"))?; + + registry.register(Box::new(success_response.clone()))?; + registry.register(Box::new(server_error_response.clone()))?; + registry.register(Box::new(user_error_response.clone()))?; + + let metrics_route = warp::path!("metrics") + .and(warp::any().map(move || registry.clone())) + .and_then(GatewayMetrics::metrics_handler); + + tokio::task::spawn(async move { + warp::serve(metrics_route) + .run(([0, 0, 0, 0], metrics_port)) + .await; + }); + + Ok(Self { + success_response, + server_error_response, + user_error_response, + }) + } + + pub async fn metrics_handler(registry: prometheus::Registry) -> Result { + use prometheus::Encoder; + let encoder = prometheus::TextEncoder::new(); + + let mut buffer = Vec::new(); + if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { + eprintln!("could not encode prometheus metrics: {}", e); + }; + let res = String::from_utf8(buffer.clone()) + .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) + .unwrap_or_default(); + buffer.clear(); + + Ok(res) + } + + pub fn inc_success_response(&self) { + self.success_response.inc(); + } + + pub fn inc_server_error_response(&self) { + self.server_error_response.inc(); + } + + pub fn inc_user_error_response(&self) { + self.user_error_response.inc(); + } +} diff --git a/config-files/config-agg-mode-gateway-ethereum-package.yaml b/config-files/config-agg-mode-gateway-ethereum-package.yaml index 21a8438268..63b37a412a 100644 --- a/config-files/config-agg-mode-gateway-ethereum-package.yaml +++ b/config-files/config-agg-mode-gateway-ethereum-package.yaml @@ -4,3 +4,7 @@ eth_rpc_url: "http://localhost:8545" payment_service_address: "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe" network: "devnet" max_daily_proofs_per_user: 32 +last_block_fetched_filepath: "config-files/proof-aggregator.last_block_fetched.json" + +# Metrics +metrics_port: 9093 diff --git a/config-files/config-agg-mode-gateway.yaml b/config-files/config-agg-mode-gateway.yaml index a2112f4cf4..379418889d 100644 --- a/config-files/config-agg-mode-gateway.yaml +++ b/config-files/config-agg-mode-gateway.yaml @@ -5,3 +5,6 @@ payment_service_address: "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe" network: "devnet" max_daily_proofs_per_user: 4 last_block_fetched_filepath: "config-files/proof-aggregator.last_block_fetched.json" + +# Metrics +metrics_port: 9093 diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json new file mode 100644 index 0000000000..cf7da161ab --- /dev/null +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -0,0 +1,325 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "grafana", + "uid": "-- Grafana --" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "id": 2, + "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": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 0 + }, + "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": "sum(\n rate(api_response_code{statuscode=~\"400\"}[100m])\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 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 0 + }, + "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": "api_response_code{statuscode=\"500\"}", + "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": 0 + }, + "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": "success_response_count{}", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Success response count", + "type": "timeseries" + } + ], + "refresh": false, + "schemaVersion": 38, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "now-30m", + "to": "now" + }, + "timepicker": {}, + "timezone": "", + "title": "New dashboard", + "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", + "version": 1, + "weekStart": "" +} diff --git a/prometheus/prometheus.yaml b/prometheus/prometheus.yaml index 7b84e52e39..d7ce023aa9 100644 --- a/prometheus/prometheus.yaml +++ b/prometheus/prometheus.yaml @@ -37,3 +37,10 @@ scrape_configs: - targets: ["host.docker.internal:9100"] labels: bot: "node-exporter" + + - job_name: "gateway-api" + scrape_interval: 60s + static_configs: + - targets: ["host.docker.internal:8089"] + labels: + bot: "gateway-exporter" From 94c04046083f60df9fa5e20f025a7e226b84b2ee Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 19 Dec 2025 18:36:06 -0300 Subject: [PATCH 02/45] fix: return BadRequest for the request denied exams --- aggregation_mode/gateway/src/http.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index 285fe5e17f..a715e061d1 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -170,7 +170,7 @@ impl GatewayServer { if daily_tasks_by_address >= state.config.max_daily_proofs_per_user { let formatted_time_left = get_time_left_day_formatted(); - return HttpResponse::InternalServerError().json(AppResponse::new_unsucessfull( + return HttpResponse::BadRequest().json(AppResponse::new_unsucessfull( format!( "Request denied: Query limit exceeded. Quotas renew in {formatted_time_left}" ) From 9ce4dde39dd7243fa012c3376ecaf379ed9a3c28 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 10:36:12 -0300 Subject: [PATCH 03/45] Update the dashboard to include code ranges (2xx, 4xx, 5xx) --- .../aligned/aggregation_mode_gateway.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index cf7da161ab..e516e099fe 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -106,7 +106,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"400\"}[100m])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[100m])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -200,7 +200,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "api_response_code{statuscode=\"500\"}", + "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[100m])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -294,7 +294,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "success_response_count{}", + "expr": "sum(\n rate(api_response_code{statuscode=~\"2..\"}[100m])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -305,7 +305,7 @@ "type": "timeseries" } ], - "refresh": false, + "refresh": "", "schemaVersion": 38, "style": "dark", "tags": [], @@ -313,13 +313,13 @@ "list": [] }, "time": { - "from": "now-30m", + "from": "now-5m", "to": "now" }, "timepicker": {}, "timezone": "", - "title": "New dashboard", + "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 1, + "version": 3, "weekStart": "" } From 531e9291f1fba8682512f625d06d269f06ee4f8c Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 11:03:10 -0300 Subject: [PATCH 04/45] Filter by range in dashboards and remove the /metrics reqs in 2xx one --- .../dashboards/aligned/aggregation_mode_gateway.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index e516e099fe..2057298a9c 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -106,7 +106,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[100m])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[$__range])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -200,7 +200,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[100m])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[$__range])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -294,7 +294,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"2..\"}[100m])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"2..\",endpoint!=\"/metrics\"}[$__range])\n)", "instant": false, "legendFormat": "__auto", "range": true, From 61f889ab5e2c4b8ece536b34530b1f75d7248786 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 12:01:11 -0300 Subject: [PATCH 05/45] Add time_elapsed_db_post metric to have a metric in use --- aggregation_mode/gateway/src/http.rs | 17 +- aggregation_mode/gateway/src/metrics.rs | 38 +--- .../aligned/aggregation_mode_gateway.json | 196 +++++++++++++++++- 3 files changed, 215 insertions(+), 36 deletions(-) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index a715e061d1..ddd1aa97e7 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -1,7 +1,7 @@ use std::{ collections::HashMap, str::FromStr, - time::{SystemTime, UNIX_EPOCH}, + time::{Instant, SystemTime, UNIX_EPOCH}, }; use actix_multipart::form::MultipartForm; @@ -240,6 +240,8 @@ impl GatewayServer { return HttpResponse::BadRequest().json(AppResponse::new_unsucessfull(message, 400)); }; + let start = Instant::now(); + match state .db .insert_task( @@ -252,9 +254,16 @@ impl GatewayServer { ) .await { - Ok(task_id) => HttpResponse::Ok().json(AppResponse::new_sucessfull( - serde_json::json!({ "task_id": task_id.to_string() }), - )), + Ok(task_id) => { + let duration = start.elapsed(); + state + .metrics + .register_db_response_time_post(duration.as_secs_f64()); + + HttpResponse::Ok().json(AppResponse::new_sucessfull( + serde_json::json!({ "task_id": task_id.to_string() }), + )) + } Err(_) => HttpResponse::InternalServerError() .json(AppResponse::new_unsucessfull("Internal server error", 500)), } diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index 6bff5a767c..e31f70a0ec 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -1,29 +1,21 @@ -use prometheus::{self, opts, register_int_counter, IntCounter}; +use prometheus::{self, histogram_opts, register_histogram}; use warp::{reject::Rejection, reply::Reply, Filter}; #[derive(Clone, Debug)] pub struct GatewayMetrics { - pub success_response: IntCounter, - pub server_error_response: IntCounter, - pub user_error_response: IntCounter, + pub time_elapsed_db_post: prometheus::Histogram, } impl GatewayMetrics { pub fn start(metrics_port: u16) -> anyhow::Result { let registry = prometheus::Registry::new(); - let success_response = - register_int_counter!(opts!("success_response_count", "Success Responses"))?; + let time_elapsed_db_post = register_histogram!(histogram_opts!( + "time_elapsed_db_post", + "Time elapsed in DB posts" + ))?; - let server_error_response = - register_int_counter!(opts!("server_error_response_count", "Success Responses"))?; - - let user_error_response = - register_int_counter!(opts!("user_error_response_count", "Success Responses"))?; - - registry.register(Box::new(success_response.clone()))?; - registry.register(Box::new(server_error_response.clone()))?; - registry.register(Box::new(user_error_response.clone()))?; + registry.register(Box::new(time_elapsed_db_post.clone()))?; let metrics_route = warp::path!("metrics") .and(warp::any().map(move || registry.clone())) @@ -36,9 +28,7 @@ impl GatewayMetrics { }); Ok(Self { - success_response, - server_error_response, - user_error_response, + time_elapsed_db_post, }) } @@ -58,15 +48,7 @@ impl GatewayMetrics { Ok(res) } - pub fn inc_success_response(&self) { - self.success_response.inc(); - } - - pub fn inc_server_error_response(&self) { - self.server_error_response.inc(); - } - - pub fn inc_user_error_response(&self) { - self.user_error_response.inc(); + pub fn register_db_response_time_post(&self, value: f64) { + self.time_elapsed_db_post.observe(value); } } diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 2057298a9c..2b88ffb74b 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -106,7 +106,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[$__range])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[5m])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -200,7 +200,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[$__range])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[100m])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -303,6 +303,194 @@ ], "title": "Success 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": 12, + "x": 0, + "y": 8 + }, + "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_post_bucket[$__rate_interval])))", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "DB posts latency (p50)", + "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": 12, + "x": 12, + "y": 8 + }, + "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_post_count[$__rate_interval]))", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "DB posts throughput", + "type": "timeseries" } ], "refresh": "", @@ -313,8 +501,8 @@ "list": [] }, "time": { - "from": "now-5m", - "to": "now" + "from": "now-19m", + "to": "now-15m" }, "timepicker": {}, "timezone": "", From 00d533835953859ce0473337eaf491717eba898e Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 12:41:39 -0300 Subject: [PATCH 06/45] Add the payments poller metrics integration --- aggregation_mode/Cargo.lock | 3 + aggregation_mode/gateway/src/config.rs | 2 +- aggregation_mode/gateway/src/http.rs | 9 +- aggregation_mode/payments_poller/Cargo.toml | 3 + .../payments_poller/src/config.rs | 1 + aggregation_mode/payments_poller/src/lib.rs | 1 + .../payments_poller/src/metrics.rs | 54 ++++++++++ .../payments_poller/src/payments.rs | 12 +++ ...fig-agg-mode-gateway-ethereum-package.yaml | 5 +- config-files/config-agg-mode-gateway.yaml | 5 +- .../aligned/aggregation_mode_gateway.json | 100 +++++++++++++++++- prometheus/prometheus.yaml | 14 +++ 12 files changed, 198 insertions(+), 11 deletions(-) create mode 100644 aggregation_mode/payments_poller/src/metrics.rs diff --git a/aggregation_mode/Cargo.lock b/aggregation_mode/Cargo.lock index 845d0fbb30..33a8937f92 100644 --- a/aggregation_mode/Cargo.lock +++ b/aggregation_mode/Cargo.lock @@ -6894,7 +6894,9 @@ dependencies = [ "actix-web", "aligned-sdk", "alloy", + "anyhow", "hex", + "prometheus", "serde", "serde_json", "serde_yaml", @@ -6902,6 +6904,7 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber 0.3.22", + "warp", ] [[package]] diff --git a/aggregation_mode/gateway/src/config.rs b/aggregation_mode/gateway/src/config.rs index e6b7947679..dfce0b0b29 100644 --- a/aggregation_mode/gateway/src/config.rs +++ b/aggregation_mode/gateway/src/config.rs @@ -8,7 +8,7 @@ pub struct Config { pub db_connection_url: String, pub network: String, pub max_daily_proofs_per_user: i64, - pub metrics_port: u16, + pub gateway_metrics_port: u16, } impl Config { diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index ddd1aa97e7..7eca4a49ae 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -42,9 +42,12 @@ impl GatewayServer { pub fn new(db: Db, config: Config) -> Self { let network = Network::from_str(&config.network).expect("A valid network in config file"); - tracing::info!("Starting metrics server on port {}", config.metrics_port); - let metrics = - GatewayMetrics::start(config.metrics_port).expect("Failed to start metrics server"); + tracing::info!( + "Starting metrics server on port {}", + config.gateway_metrics_port + ); + let metrics = GatewayMetrics::start(config.gateway_metrics_port) + .expect("Failed to start metrics server"); Self { db, diff --git a/aggregation_mode/payments_poller/Cargo.toml b/aggregation_mode/payments_poller/Cargo.toml index c145fd02e5..108b428ba8 100644 --- a/aggregation_mode/payments_poller/Cargo.toml +++ b/aggregation_mode/payments_poller/Cargo.toml @@ -8,6 +8,9 @@ serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } aligned-sdk = { workspace = true } +prometheus = { workspace = true } +anyhow = { workspace = true } +warp = { workspace = true } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3.0", features = ["env-filter"] } actix-web = "4" diff --git a/aggregation_mode/payments_poller/src/config.rs b/aggregation_mode/payments_poller/src/config.rs index 8b51181470..c84362ae8f 100644 --- a/aggregation_mode/payments_poller/src/config.rs +++ b/aggregation_mode/payments_poller/src/config.rs @@ -8,6 +8,7 @@ pub struct Config { pub eth_rpc_url: String, pub payment_service_address: String, pub last_block_fetched_filepath: String, + pub poller_metrics_port: u16, } #[derive(Debug, Deserialize, Serialize)] diff --git a/aggregation_mode/payments_poller/src/lib.rs b/aggregation_mode/payments_poller/src/lib.rs index 84bee5b7ba..654c3e2378 100644 --- a/aggregation_mode/payments_poller/src/lib.rs +++ b/aggregation_mode/payments_poller/src/lib.rs @@ -1,4 +1,5 @@ pub mod config; pub mod db; +pub mod metrics; pub mod payments; pub mod types; diff --git a/aggregation_mode/payments_poller/src/metrics.rs b/aggregation_mode/payments_poller/src/metrics.rs new file mode 100644 index 0000000000..ed7b7c8eb3 --- /dev/null +++ b/aggregation_mode/payments_poller/src/metrics.rs @@ -0,0 +1,54 @@ +use prometheus::{self, opts, register_gauge}; +use warp::{reject::Rejection, reply::Reply, Filter}; + +#[derive(Clone, Debug)] +pub struct PaymentsPollerMetrics { + pub last_processed_block: prometheus::Gauge, +} + +impl PaymentsPollerMetrics { + pub fn start(metrics_port: u16) -> anyhow::Result { + let registry = prometheus::Registry::new(); + + let last_processed_block = register_gauge!(opts!( + "last_processed_block", + "Last processed block by poller" + ))?; + + registry.register(Box::new(last_processed_block.clone()))?; + + let metrics_route = warp::path!("metrics") + .and(warp::any().map(move || registry.clone())) + .and_then(PaymentsPollerMetrics::metrics_handler); + + tokio::task::spawn(async move { + warp::serve(metrics_route) + .run(([0, 0, 0, 0], metrics_port)) + .await; + }); + + Ok(Self { + last_processed_block, + }) + } + + pub async fn metrics_handler(registry: prometheus::Registry) -> Result { + use prometheus::Encoder; + let encoder = prometheus::TextEncoder::new(); + + let mut buffer = Vec::new(); + if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { + eprintln!("could not encode prometheus metrics: {}", e); + }; + let res = String::from_utf8(buffer.clone()) + .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) + .unwrap_or_default(); + buffer.clear(); + + Ok(res) + } + + pub fn register_last_processed_block(&self, value: u64) { + self.last_processed_block.set(value as f64); + } +} diff --git a/aggregation_mode/payments_poller/src/payments.rs b/aggregation_mode/payments_poller/src/payments.rs index 78639e6176..ac72dd54a4 100644 --- a/aggregation_mode/payments_poller/src/payments.rs +++ b/aggregation_mode/payments_poller/src/payments.rs @@ -3,6 +3,7 @@ use std::str::FromStr; use crate::{ config::Config, db::Db, + metrics::PaymentsPollerMetrics, types::{AggregationModePaymentService, AggregationModePaymentServiceContract, RpcProvider}, }; use alloy::{ @@ -21,6 +22,7 @@ pub struct PaymentsPoller { proof_aggregation_service: AggregationModePaymentServiceContract, rpc_provider: RpcProvider, config: Config, + metrics: PaymentsPollerMetrics, } impl PaymentsPoller { @@ -38,11 +40,19 @@ impl PaymentsPoller { .get_last_block_fetched() .map_err(|err| PaymentsPollerError::ReadLastBlockError(err.to_string())); + tracing::info!( + "Starting metrics server on port {}", + config.poller_metrics_port + ); + let metrics = PaymentsPollerMetrics::start(config.poller_metrics_port) + .expect("Failed to start metrics server"); + Ok(Self { db, proof_aggregation_service, rpc_provider, config, + metrics, }) } @@ -121,6 +131,8 @@ impl PaymentsPoller { continue; }; + self.metrics.register_last_processed_block(current_block); + tokio::time::sleep(std::time::Duration::from_secs( seconds_to_wait_between_polls, )) diff --git a/config-files/config-agg-mode-gateway-ethereum-package.yaml b/config-files/config-agg-mode-gateway-ethereum-package.yaml index 63b37a412a..e4f4ce7b41 100644 --- a/config-files/config-agg-mode-gateway-ethereum-package.yaml +++ b/config-files/config-agg-mode-gateway-ethereum-package.yaml @@ -3,8 +3,9 @@ db_connection_url: "postgres://postgres:postgres@localhost:5435/" eth_rpc_url: "http://localhost:8545" payment_service_address: "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe" network: "devnet" -max_daily_proofs_per_user: 32 +max_daily_proofs_per_user: 100 last_block_fetched_filepath: "config-files/proof-aggregator.last_block_fetched.json" # Metrics -metrics_port: 9093 +gateway_metrics_port: 9094 +poller_metrics_port: 9095 diff --git a/config-files/config-agg-mode-gateway.yaml b/config-files/config-agg-mode-gateway.yaml index 379418889d..e4f4ce7b41 100644 --- a/config-files/config-agg-mode-gateway.yaml +++ b/config-files/config-agg-mode-gateway.yaml @@ -3,8 +3,9 @@ db_connection_url: "postgres://postgres:postgres@localhost:5435/" eth_rpc_url: "http://localhost:8545" payment_service_address: "0x922D6956C99E12DFeB3224DEA977D0939758A1Fe" network: "devnet" -max_daily_proofs_per_user: 4 +max_daily_proofs_per_user: 100 last_block_fetched_filepath: "config-files/proof-aggregator.last_block_fetched.json" # Metrics -metrics_port: 9093 +gateway_metrics_port: 9094 +poller_metrics_port: 9095 diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 2b88ffb74b..7e34382519 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -462,6 +462,100 @@ "x": 12, "y": 8 }, + "id": 6, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "last_processed_block{}", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Payments Poller Last Processed Block", + "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": 12, + "x": 0, + "y": 16 + }, "id": 5, "options": { "legend": { @@ -501,13 +595,13 @@ "list": [] }, "time": { - "from": "now-19m", - "to": "now-15m" + "from": "now-5m", + "to": "now" }, "timepicker": {}, "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 3, + "version": 12, "weekStart": "" } diff --git a/prometheus/prometheus.yaml b/prometheus/prometheus.yaml index d7ce023aa9..3de7b120f9 100644 --- a/prometheus/prometheus.yaml +++ b/prometheus/prometheus.yaml @@ -44,3 +44,17 @@ scrape_configs: - targets: ["host.docker.internal:8089"] labels: bot: "gateway-exporter" + + - job_name: "aggregation-mode-gateway" + scrape_interval: 1s + static_configs: + - targets: ["host.docker.internal:9094"] + labels: + bot: "aggregation-gateway" + + - job_name: "aggregation-mode-payments-poller" + scrape_interval: 1s + static_configs: + - targets: ["host.docker.internal:9095"] + labels: + bot: "aggregation-poller" From 77fc789118e6d9d338192b2c946aea6e9f0c4137 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 12:43:02 -0300 Subject: [PATCH 07/45] fix clippy lints on agg mode --- aggregation_mode/gateway/src/metrics.rs | 2 +- aggregation_mode/payments_poller/src/metrics.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index e31f70a0ec..d9d4ddb0d9 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -38,7 +38,7 @@ impl GatewayMetrics { let mut buffer = Vec::new(); if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { - eprintln!("could not encode prometheus metrics: {}", e); + eprintln!("could not encode prometheus metrics: {e}"); }; let res = String::from_utf8(buffer.clone()) .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) diff --git a/aggregation_mode/payments_poller/src/metrics.rs b/aggregation_mode/payments_poller/src/metrics.rs index ed7b7c8eb3..4b0c921abe 100644 --- a/aggregation_mode/payments_poller/src/metrics.rs +++ b/aggregation_mode/payments_poller/src/metrics.rs @@ -38,7 +38,7 @@ impl PaymentsPollerMetrics { let mut buffer = Vec::new(); if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { - eprintln!("could not encode prometheus metrics: {}", e); + eprintln!("could not encode prometheus metrics: {e}"); }; let res = String::from_utf8(buffer.clone()) .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) From 710ff46831f13e6070167f773dab4dfe71d057da Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 15:22:11 -0300 Subject: [PATCH 08/45] Remove unnecessary labeling on actix prometheus metrics builder --- aggregation_mode/gateway/src/http.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index 7eca4a49ae..a55d930bed 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -1,5 +1,4 @@ use std::{ - collections::HashMap, str::FromStr, time::{Instant, SystemTime, UNIX_EPOCH}, }; @@ -62,11 +61,8 @@ impl GatewayServer { let port = self.config.port; let state = self.clone(); - let mut labels = HashMap::new(); - labels.insert("label1".to_string(), "value1".to_string()); let prometheus = PrometheusMetricsBuilder::new("api") .endpoint("/metrics") - .const_labels(labels) .build() .unwrap(); From 3aeb64a76c6ffc70ba361070db1accf6bc6cc059 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 15:29:01 -0300 Subject: [PATCH 09/45] use tracing::error instead of eprintln --- aggregation_mode/gateway/src/metrics.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index d9d4ddb0d9..28d5cbb5a5 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -38,7 +38,7 @@ impl GatewayMetrics { let mut buffer = Vec::new(); if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { - eprintln!("could not encode prometheus metrics: {e}"); + tracing::error!("could not encode prometheus metrics: {e}"); }; let res = String::from_utf8(buffer.clone()) .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) From 07eb91b9449b570739975792b2b9cae032b893fd Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 15:38:46 -0300 Subject: [PATCH 10/45] Remove anyhow dependency --- aggregation_mode/Cargo.lock | 2 -- aggregation_mode/Cargo.toml | 1 - aggregation_mode/gateway/Cargo.toml | 1 - aggregation_mode/gateway/src/metrics.rs | 2 +- aggregation_mode/payments_poller/Cargo.toml | 1 - aggregation_mode/payments_poller/src/metrics.rs | 2 +- 6 files changed, 2 insertions(+), 7 deletions(-) diff --git a/aggregation_mode/Cargo.lock b/aggregation_mode/Cargo.lock index 33a8937f92..d17757dfb2 100644 --- a/aggregation_mode/Cargo.lock +++ b/aggregation_mode/Cargo.lock @@ -4534,7 +4534,6 @@ dependencies = [ "agg_mode_sdk", "aligned-sdk", "alloy", - "anyhow", "bincode", "hex", "prometheus", @@ -6894,7 +6893,6 @@ dependencies = [ "actix-web", "aligned-sdk", "alloy", - "anyhow", "hex", "prometheus", "serde", diff --git a/aggregation_mode/Cargo.toml b/aggregation_mode/Cargo.toml index b61eb7cde1..6187dc3099 100644 --- a/aggregation_mode/Cargo.toml +++ b/aggregation_mode/Cargo.toml @@ -17,7 +17,6 @@ db = { path = "./db" } sp1-sdk = "5.0.0" risc0-zkvm = { version = "3.0.3" } prometheus = { version = "0.13.4", features = ["process"] } -anyhow = { version = "1.0" } warp = "0.3.7" [profile.release] diff --git a/aggregation_mode/gateway/Cargo.toml b/aggregation_mode/gateway/Cargo.toml index e4347c50b2..253800676e 100644 --- a/aggregation_mode/gateway/Cargo.toml +++ b/aggregation_mode/gateway/Cargo.toml @@ -8,7 +8,6 @@ serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } prometheus = { workspace = true } -anyhow = { workspace = true } warp = { workspace = true } agg_mode_sdk = { path = "../sdk"} aligned-sdk = { workspace = true } diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index 28d5cbb5a5..6ae72db7d9 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -7,7 +7,7 @@ pub struct GatewayMetrics { } impl GatewayMetrics { - pub fn start(metrics_port: u16) -> anyhow::Result { + pub fn start(metrics_port: u16) -> Result { let registry = prometheus::Registry::new(); let time_elapsed_db_post = register_histogram!(histogram_opts!( diff --git a/aggregation_mode/payments_poller/Cargo.toml b/aggregation_mode/payments_poller/Cargo.toml index 108b428ba8..93fbe9b6ed 100644 --- a/aggregation_mode/payments_poller/Cargo.toml +++ b/aggregation_mode/payments_poller/Cargo.toml @@ -9,7 +9,6 @@ serde_json = { workspace = true } serde_yaml = { workspace = true } aligned-sdk = { workspace = true } prometheus = { workspace = true } -anyhow = { workspace = true } warp = { workspace = true } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3.0", features = ["env-filter"] } diff --git a/aggregation_mode/payments_poller/src/metrics.rs b/aggregation_mode/payments_poller/src/metrics.rs index 4b0c921abe..0283b32752 100644 --- a/aggregation_mode/payments_poller/src/metrics.rs +++ b/aggregation_mode/payments_poller/src/metrics.rs @@ -7,7 +7,7 @@ pub struct PaymentsPollerMetrics { } impl PaymentsPollerMetrics { - pub fn start(metrics_port: u16) -> anyhow::Result { + pub fn start(metrics_port: u16) -> Result { let registry = prometheus::Registry::new(); let last_processed_block = register_gauge!(opts!( From dad51de8c303e27e5be188b9db50cd011911ae8e Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 22 Dec 2025 18:02:08 -0300 Subject: [PATCH 11/45] Convert the warp servers into --- aggregation_mode/Cargo.lock | 110 ------------------ aggregation_mode/Cargo.toml | 1 - aggregation_mode/gateway/Cargo.toml | 1 - aggregation_mode/gateway/src/metrics.rs | 59 ++++++---- aggregation_mode/payments_poller/Cargo.toml | 1 - .../payments_poller/src/metrics.rs | 66 ++++++----- 6 files changed, 73 insertions(+), 165 deletions(-) diff --git a/aggregation_mode/Cargo.lock b/aggregation_mode/Cargo.lock index d17757dfb2..b291acd46b 100644 --- a/aggregation_mode/Cargo.lock +++ b/aggregation_mode/Cargo.lock @@ -4545,7 +4545,6 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber 0.3.22", - "warp", ] [[package]] @@ -4849,30 +4848,6 @@ dependencies = [ "hashbrown 0.15.5", ] -[[package]] -name = "headers" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" -dependencies = [ - "base64 0.21.7", - "bytes", - "headers-core", - "http 0.2.12", - "httpdate", - "mime", - "sha1", -] - -[[package]] -name = "headers-core" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7f66481bfee273957b1f20485a4ff3362987f85b2c236580d81b4eb7a326429" -dependencies = [ - "http 0.2.12", -] - [[package]] name = "heapless" version = "0.7.17" @@ -6028,24 +6003,6 @@ dependencies = [ "windows-sys 0.61.2", ] -[[package]] -name = "multer" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01acbdc23469fd8fe07ab135923371d5f5a422fbf9c522158677c8eb15bc51c2" -dependencies = [ - "bytes", - "encoding_rs", - "futures-util", - "http 0.2.12", - "httparse", - "log", - "memchr", - "mime", - "spin 0.9.8", - "version_check", -] - [[package]] name = "multimap" version = "0.10.1" @@ -6902,7 +6859,6 @@ dependencies = [ "tokio", "tracing", "tracing-subscriber 0.3.22", - "warp", ] [[package]] @@ -8850,12 +8806,6 @@ dependencies = [ "serde_json", ] -[[package]] -name = "scoped-tls" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" - [[package]] name = "scopeguard" version = "1.2.0" @@ -10616,18 +10566,6 @@ dependencies = [ "webpki-roots 0.25.4", ] -[[package]] -name = "tokio-tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c83b561d025642014097b66e6c1bb422783339e0909e4429cde4749d1990bc38" -dependencies = [ - "futures-util", - "log", - "tokio", - "tungstenite 0.21.0", -] - [[package]] name = "tokio-tungstenite" version = "0.23.1" @@ -10968,25 +10906,6 @@ dependencies = [ "utf-8", ] -[[package]] -name = "tungstenite" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ef1a641ea34f399a848dea702823bbecfb4c486f911735368f1f137cb8257e1" -dependencies = [ - "byteorder", - "bytes", - "data-encoding", - "http 1.4.0", - "httparse", - "log", - "rand 0.8.5", - "sha1", - "thiserror 1.0.69", - "url", - "utf-8", -] - [[package]] name = "tungstenite" version = "0.23.0" @@ -11302,35 +11221,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "warp" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4378d202ff965b011c64817db11d5829506d3404edeadb61f190d111da3f231c" -dependencies = [ - "bytes", - "futures-channel", - "futures-util", - "headers", - "http 0.2.12", - "hyper 0.14.32", - "log", - "mime", - "mime_guess", - "multer", - "percent-encoding", - "pin-project", - "scoped-tls", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-tungstenite 0.21.0", - "tokio-util", - "tower-service", - "tracing", -] - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/aggregation_mode/Cargo.toml b/aggregation_mode/Cargo.toml index 6187dc3099..67bd14f395 100644 --- a/aggregation_mode/Cargo.toml +++ b/aggregation_mode/Cargo.toml @@ -17,7 +17,6 @@ db = { path = "./db" } sp1-sdk = "5.0.0" risc0-zkvm = { version = "3.0.3" } prometheus = { version = "0.13.4", features = ["process"] } -warp = "0.3.7" [profile.release] opt-level = 3 diff --git a/aggregation_mode/gateway/Cargo.toml b/aggregation_mode/gateway/Cargo.toml index 253800676e..9ff8ddb023 100644 --- a/aggregation_mode/gateway/Cargo.toml +++ b/aggregation_mode/gateway/Cargo.toml @@ -8,7 +8,6 @@ serde = { workspace = true } serde_json = { workspace = true } serde_yaml = { workspace = true } prometheus = { workspace = true } -warp = { workspace = true } agg_mode_sdk = { path = "../sdk"} aligned-sdk = { workspace = true } sp1-sdk = { workspace = true } diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index 6ae72db7d9..451541c755 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -1,51 +1,60 @@ -use prometheus::{self, histogram_opts, register_histogram}; -use warp::{reject::Rejection, reply::Reply, Filter}; +use actix_web::{web, App, HttpResponse, HttpServer, Responder}; +use prometheus::{self, histogram_opts, Encoder, Histogram, Registry, TextEncoder}; +use std::sync::Arc; #[derive(Clone, Debug)] pub struct GatewayMetrics { - pub time_elapsed_db_post: prometheus::Histogram, + pub registry: Registry, + pub time_elapsed_db_post: Histogram, } impl GatewayMetrics { pub fn start(metrics_port: u16) -> Result { - let registry = prometheus::Registry::new(); + let registry = Registry::new(); - let time_elapsed_db_post = register_histogram!(histogram_opts!( + let time_elapsed_db_post = Histogram::with_opts(histogram_opts!( "time_elapsed_db_post", "Time elapsed in DB posts" ))?; registry.register(Box::new(time_elapsed_db_post.clone()))?; - let metrics_route = warp::path!("metrics") - .and(warp::any().map(move || registry.clone())) - .and_then(GatewayMetrics::metrics_handler); + // 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(), + // so the data must be static and safely shared between threads. + let metrics = Arc::new(Self { + registry, + time_elapsed_db_post, + }); - tokio::task::spawn(async move { - warp::serve(metrics_route) - .run(([0, 0, 0, 0], metrics_port)) - .await; + let server_metrics = metrics.clone(); + tokio::spawn(async move { + let _ = HttpServer::new(move || { + App::new() + .app_data(web::Data::new(server_metrics.clone())) + .route("/metrics", web::get().to(GatewayMetrics::metrics_handler)) + }) + .bind(("0.0.0.0", metrics_port)) + .expect("failed to bind metrics server") + .run() + .await; }); - Ok(Self { - time_elapsed_db_post, - }) + Ok(Arc::try_unwrap(metrics).unwrap_or_else(|arc| (*arc).clone())) } - pub async fn metrics_handler(registry: prometheus::Registry) -> Result { - use prometheus::Encoder; - let encoder = prometheus::TextEncoder::new(); + async fn metrics_handler(metrics: web::Data>) -> impl Responder { + let encoder = TextEncoder::new(); + let metric_families = metrics.registry.gather(); let mut buffer = Vec::new(); - if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { + if let Err(e) = encoder.encode(&metric_families, &mut buffer) { tracing::error!("could not encode prometheus metrics: {e}"); - }; - let res = String::from_utf8(buffer.clone()) - .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) - .unwrap_or_default(); - buffer.clear(); + } - Ok(res) + HttpResponse::Ok() + .insert_header(("Content-Type", encoder.format_type())) + .body(buffer) } pub fn register_db_response_time_post(&self, value: f64) { diff --git a/aggregation_mode/payments_poller/Cargo.toml b/aggregation_mode/payments_poller/Cargo.toml index 93fbe9b6ed..d6273c3247 100644 --- a/aggregation_mode/payments_poller/Cargo.toml +++ b/aggregation_mode/payments_poller/Cargo.toml @@ -9,7 +9,6 @@ serde_json = { workspace = true } serde_yaml = { workspace = true } aligned-sdk = { workspace = true } prometheus = { workspace = true } -warp = { workspace = true } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3.0", features = ["env-filter"] } actix-web = "4" diff --git a/aggregation_mode/payments_poller/src/metrics.rs b/aggregation_mode/payments_poller/src/metrics.rs index 0283b32752..2f41701d45 100644 --- a/aggregation_mode/payments_poller/src/metrics.rs +++ b/aggregation_mode/payments_poller/src/metrics.rs @@ -1,51 +1,63 @@ -use prometheus::{self, opts, register_gauge}; -use warp::{reject::Rejection, reply::Reply, Filter}; +use actix_web::{web, App, HttpResponse, HttpServer, Responder}; +use prometheus::{self, opts, Encoder, Gauge, Registry, TextEncoder}; +use std::sync::Arc; #[derive(Clone, Debug)] pub struct PaymentsPollerMetrics { - pub last_processed_block: prometheus::Gauge, + pub registry: Registry, + pub last_processed_block: Gauge, } impl PaymentsPollerMetrics { pub fn start(metrics_port: u16) -> Result { - let registry = prometheus::Registry::new(); + let registry = Registry::new(); - let last_processed_block = register_gauge!(opts!( + let last_processed_block = Gauge::with_opts(opts!( "last_processed_block", "Last processed block by poller" ))?; registry.register(Box::new(last_processed_block.clone()))?; - let metrics_route = warp::path!("metrics") - .and(warp::any().map(move || registry.clone())) - .and_then(PaymentsPollerMetrics::metrics_handler); + // 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(), + // so the data must be static and safely shared between threads. + let metrics = Arc::new(Self { + registry, + last_processed_block, + }); - tokio::task::spawn(async move { - warp::serve(metrics_route) - .run(([0, 0, 0, 0], metrics_port)) - .await; + let server_metrics = metrics.clone(); + tokio::spawn(async move { + let _ = HttpServer::new(move || { + App::new() + .app_data(web::Data::new(server_metrics.clone())) + .route( + "/metrics", + web::get().to(PaymentsPollerMetrics::metrics_handler), + ) + }) + .bind(("0.0.0.0", metrics_port)) + .expect("failed to bind metrics server") + .run() + .await; }); - Ok(Self { - last_processed_block, - }) + Ok(Arc::try_unwrap(metrics).unwrap_or_else(|arc| (*arc).clone())) } - pub async fn metrics_handler(registry: prometheus::Registry) -> Result { - use prometheus::Encoder; - let encoder = prometheus::TextEncoder::new(); + async fn metrics_handler(metrics: web::Data>) -> impl Responder { + let encoder = TextEncoder::new(); + let metric_families = metrics.registry.gather(); let mut buffer = Vec::new(); - if let Err(e) = encoder.encode(®istry.gather(), &mut buffer) { - eprintln!("could not encode prometheus metrics: {e}"); - }; - let res = String::from_utf8(buffer.clone()) - .inspect_err(|e| eprintln!("prometheus metrics could not be parsed correctly: {e}")) - .unwrap_or_default(); - buffer.clear(); - - Ok(res) + if let Err(e) = encoder.encode(&metric_families, &mut buffer) { + tracing::error!("could not encode prometheus metrics: {e}"); + } + + HttpResponse::Ok() + .insert_header(("Content-Type", encoder.format_type())) + .body(buffer) } pub fn register_last_processed_block(&self, value: u64) { From deaa77a90dc0bb0c4a48ea89a79cebb87e658779 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 23 Dec 2025 15:03:26 -0300 Subject: [PATCH 12/45] Add comment about the actix http prometheus server --- aggregation_mode/gateway/src/http.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index d051b402f9..d6dfe6e797 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -61,6 +61,8 @@ impl GatewayServer { let port = self.config.port; let state = self.clone(); + // Note: This creates a new Prometheus server different from the one created in GatewayServer::new. The created + // server exposes metrics related to the actix HTTP server, like response codes and response times let prometheus = PrometheusMetricsBuilder::new("api") .endpoint("/metrics") .build() From 09eb0154f991c9cc4c5359507fc9778aa6b738dd Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 23 Dec 2025 15:27:18 -0300 Subject: [PATCH 13/45] Return an Arc in the Metrics structs start method --- aggregation_mode/gateway/src/http.rs | 3 ++- aggregation_mode/gateway/src/metrics.rs | 4 ++-- aggregation_mode/payments_poller/src/metrics.rs | 4 ++-- aggregation_mode/payments_poller/src/payments.rs | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index d6dfe6e797..500f06fab4 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -1,5 +1,6 @@ use std::{ str::FromStr, + sync::Arc, time::{Instant, SystemTime, UNIX_EPOCH}, }; @@ -34,7 +35,7 @@ pub struct GatewayServer { db: Db, config: Config, network: Network, - metrics: GatewayMetrics, + metrics: Arc, } impl GatewayServer { diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index 451541c755..1e3a06286a 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -9,7 +9,7 @@ pub struct GatewayMetrics { } impl GatewayMetrics { - pub fn start(metrics_port: u16) -> Result { + pub fn start(metrics_port: u16) -> Result, prometheus::Error> { let registry = Registry::new(); let time_elapsed_db_post = Histogram::with_opts(histogram_opts!( @@ -40,7 +40,7 @@ impl GatewayMetrics { .await; }); - Ok(Arc::try_unwrap(metrics).unwrap_or_else(|arc| (*arc).clone())) + Ok(metrics) } async fn metrics_handler(metrics: web::Data>) -> impl Responder { diff --git a/aggregation_mode/payments_poller/src/metrics.rs b/aggregation_mode/payments_poller/src/metrics.rs index 2f41701d45..aabdc5e5ae 100644 --- a/aggregation_mode/payments_poller/src/metrics.rs +++ b/aggregation_mode/payments_poller/src/metrics.rs @@ -9,7 +9,7 @@ pub struct PaymentsPollerMetrics { } impl PaymentsPollerMetrics { - pub fn start(metrics_port: u16) -> Result { + pub fn start(metrics_port: u16) -> Result, prometheus::Error> { let registry = Registry::new(); let last_processed_block = Gauge::with_opts(opts!( @@ -43,7 +43,7 @@ impl PaymentsPollerMetrics { .await; }); - Ok(Arc::try_unwrap(metrics).unwrap_or_else(|arc| (*arc).clone())) + Ok(metrics) } async fn metrics_handler(metrics: web::Data>) -> impl Responder { diff --git a/aggregation_mode/payments_poller/src/payments.rs b/aggregation_mode/payments_poller/src/payments.rs index ac72dd54a4..005c56e7dd 100644 --- a/aggregation_mode/payments_poller/src/payments.rs +++ b/aggregation_mode/payments_poller/src/payments.rs @@ -1,4 +1,4 @@ -use std::str::FromStr; +use std::{str::FromStr, sync::Arc}; use crate::{ config::Config, @@ -22,7 +22,7 @@ pub struct PaymentsPoller { proof_aggregation_service: AggregationModePaymentServiceContract, rpc_provider: RpcProvider, config: Config, - metrics: PaymentsPollerMetrics, + metrics: Arc, } impl PaymentsPoller { From 7ee82013a76a6dd7c4d845bc2f02ddfcce88605d Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 23 Dec 2025 16:16:17 -0300 Subject: [PATCH 14/45] Make the time_elapsed_db_query to be a histogram vec --- aggregation_mode/gateway/src/http.rs | 2 +- aggregation_mode/gateway/src/metrics.rs | 22 ++++++++++--------- .../aligned/aggregation_mode_gateway.json | 8 +++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index 500f06fab4..ee4fdff5b0 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -260,7 +260,7 @@ impl GatewayServer { let duration = start.elapsed(); state .metrics - .register_db_response_time_post(duration.as_secs_f64()); + .register_db_response_time_post("sp1-post", duration.as_secs_f64()); HttpResponse::Ok().json(AppResponse::new_sucessfull( serde_json::json!({ "task_id": task_id.to_string() }), diff --git a/aggregation_mode/gateway/src/metrics.rs b/aggregation_mode/gateway/src/metrics.rs index 1e3a06286a..f2621ffc2c 100644 --- a/aggregation_mode/gateway/src/metrics.rs +++ b/aggregation_mode/gateway/src/metrics.rs @@ -1,30 +1,30 @@ use actix_web::{web, App, HttpResponse, HttpServer, Responder}; -use prometheus::{self, histogram_opts, Encoder, Histogram, Registry, TextEncoder}; +use prometheus::{self, histogram_opts, Encoder, HistogramVec, Registry, TextEncoder}; use std::sync::Arc; #[derive(Clone, Debug)] pub struct GatewayMetrics { pub registry: Registry, - pub time_elapsed_db_post: Histogram, + pub time_elapsed_db_query: HistogramVec, } impl GatewayMetrics { pub fn start(metrics_port: u16) -> Result, prometheus::Error> { let registry = Registry::new(); - let time_elapsed_db_post = Histogram::with_opts(histogram_opts!( - "time_elapsed_db_post", - "Time elapsed in DB posts" - ))?; + let time_elapsed_db_query = HistogramVec::new( + histogram_opts!("time_elapsed_db_query", "Time elapsed in DB posts"), + &["query"], + )?; - registry.register(Box::new(time_elapsed_db_post.clone()))?; + registry.register(Box::new(time_elapsed_db_query.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(), // so the data must be static and safely shared between threads. let metrics = Arc::new(Self { registry, - time_elapsed_db_post, + time_elapsed_db_query, }); let server_metrics = metrics.clone(); @@ -57,7 +57,9 @@ impl GatewayMetrics { .body(buffer) } - pub fn register_db_response_time_post(&self, value: f64) { - self.time_elapsed_db_post.observe(value); + pub fn register_db_response_time_post(&self, query: &str, value: f64) { + self.time_elapsed_db_query + .with_label_values(&[query]) + .observe(value); } } diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 7e34382519..951d2179b9 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 2, + "id": 8, "links": [], "liveNow": false, "panels": [ @@ -388,7 +388,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_post_bucket[$__rate_interval])))", + "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_query_bucket{query=\"sp1-post\"}[$__rate_interval])))", "instant": false, "legendFormat": "__auto", "range": true, @@ -576,7 +576,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(rate(time_elapsed_db_post_count[$__rate_interval]))", + "expr": "sum(rate(time_elapsed_db_query_count[$__rate_interval]))", "instant": false, "legendFormat": "__auto", "range": true, @@ -602,6 +602,6 @@ "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 12, + "version": 1, "weekStart": "" } From b50ebb44ecbc34a3ad54f28111a9de9e0a5abc63 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 11:27:21 -0300 Subject: [PATCH 15/45] Change the actix prometheus version to the latest stable --- aggregation_mode/gateway/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aggregation_mode/gateway/Cargo.toml b/aggregation_mode/gateway/Cargo.toml index 9ff8ddb023..aca1cd2e65 100644 --- a/aggregation_mode/gateway/Cargo.toml +++ b/aggregation_mode/gateway/Cargo.toml @@ -16,7 +16,7 @@ tracing-subscriber = { version = "0.3.0", features = ["env-filter"] } bincode = "1.3.3" actix-web = "4" actix-multipart = "0.7.2" -actix-web-prometheus = "0.1.0-beta.8" +actix-web-prometheus = "0.1.2" alloy = { workspace = true } tokio = { version = "1", features = ["time"]} # TODO: enable tls From 2aa155048f975a0192fb45a60ff40984e4fc9843 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 11:34:59 -0300 Subject: [PATCH 16/45] Fix expression in grafana dashboard to match the rate interval instead of having a fixed 100m value --- .../dashboards/aligned/aggregation_mode_gateway.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 951d2179b9..7873bd4d7d 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -200,7 +200,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[100m])\n)", + "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[$__rate_interval])\n)", "instant": false, "legendFormat": "__auto", "range": true, From 63d136d4084a2234e0dc1541d09e3d582b063335 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 14:36:18 -0300 Subject: [PATCH 17/45] Move the aligned-network to the root docker compose and use it on metrics and agg mode ones --- aggregation_mode/docker-compose.yaml | 10 ++++++++++ docker-compose.yaml | 4 ++++ metrics-docker-compose.yaml | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/aggregation_mode/docker-compose.yaml b/aggregation_mode/docker-compose.yaml index 26d742c85a..289184681c 100644 --- a/aggregation_mode/docker-compose.yaml +++ b/aggregation_mode/docker-compose.yaml @@ -1,6 +1,11 @@ volumes: postgres_data: +networks: + aligned-network: + external: true + name: aligned-network + 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/docker-compose.yaml b/docker-compose.yaml index 597677a115..857d1c55ea 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,3 +1,7 @@ +networks: + aligned-network: + name: aligned-network + services: localstack: diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index ab40cee015..b8ac1ac7d6 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: From e077c6e9b40b1a9e3f2f794b10794bd3d6065287 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 14:36:48 -0300 Subject: [PATCH 18/45] Add postgres datasource --- .../provisioning/datasources/datasource.yaml | 17 +++++++++++++++++ metrics-docker-compose.yaml | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index add11b7150..a959993d68 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -12,3 +12,20 @@ datasources: editable: true jsonData: timeInterval: 1s + + - name: PostgreSQL + type: postgres + uid: postgres + access: proxy + orgId: 1 + url: postgres:5432 + database: ${POSTGRES_DB} + user: ${POSTGRES_USER} + secureJsonData: + password: ${POSTGRES_PASSWORD} + basicAuth: false + isDefault: false + editable: true + jsonData: + sslmode: disable + postgresVersion: 1600 diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index b8ac1ac7d6..c5165b72c6 100644 --- a/metrics-docker-compose.yaml +++ b/metrics-docker-compose.yaml @@ -19,6 +19,12 @@ services: - GF_SECURITY_ADMIN_USER=${ADMIN_USER:-admin} - GF_SECURITY_ADMIN_PASSWORD=${ADMIN_PASSWORD:-admin} - GF_USERS_ALLOW_SIGN_UP=false + # Postgres datasource + - POSTGRES_HOST=postgres + - POSTGRES_PORT=5432 + - POSTGRES_DB=postgres + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres restart: unless-stopped ports: - "3000:3000" From 37d8c7b073ed0fa1b23b7ce6e11353848f7bffa1 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 14:42:19 -0300 Subject: [PATCH 19/45] add infinity datasource to make queries to RPC --- grafana/provisioning/datasources/datasource.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index a959993d68..27db04e784 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -29,3 +29,16 @@ datasources: 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 From 924f1402c16ca1eed533a433c0770a3313ec0433 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 17:20:56 -0300 Subject: [PATCH 20/45] Add a counter for active subscriptions to the payments poller metrics --- aggregation_mode/payments_poller/src/db.rs | 17 ++++++++++++ .../payments_poller/src/metrics.rs | 12 +++++++++ .../payments_poller/src/payments.rs | 27 ++++++++++++++++++- 3 files changed, 55 insertions(+), 1 deletion(-) diff --git a/aggregation_mode/payments_poller/src/db.rs b/aggregation_mode/payments_poller/src/db.rs index 5403b1b237..8c7d6f9ba6 100644 --- a/aggregation_mode/payments_poller/src/db.rs +++ b/aggregation_mode/payments_poller/src/db.rs @@ -43,4 +43,21 @@ impl Db { .await .map(|_| ()) } + + pub async fn count_total_active_subscriptions( + &self, + epoch: BigDecimal, + ) -> Result { + let (count,) = sqlx::query_as::<_, (i64,)>( + " + SELECT COUNT(*) + FROM payment_events + WHERE started_at < $1 AND $1 < valid_until", + ) + .bind(epoch) + .fetch_one(&self.pool) + .await?; + + Ok(count) + } } 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, From 6e08596bc8fc81af0d8acc5c878d2290ba61ebc1 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 17:24:59 -0300 Subject: [PATCH 21/45] Update the dashboard json with some poller metrics --- .../aligned/aggregation_mode_gateway.json | 953 ++++++++++++------ 1 file changed, 653 insertions(+), 300 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 7873bd4d7d..f22631f0de 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,291 +18,594 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 8, + "id": 6, "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" - } - }, - "targets": [ + "id": 9, + "panels": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[5m])\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" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 10, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "title": "Monitor Status", + "type": "timeseries" } ], - "title": "User error response count", - "type": "timeseries" + "title": "Database", + "type": "row" }, { - "datasource": { - "type": "prometheus", - "uid": "prometheus" + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 1 }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" + "id": 11, + "panels": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" }, - "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" + "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" + }, + { + "color": "red", + "value": 80 + } + ] + } }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 0, + "y": 10 + }, + "id": 3, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "thresholdsStyle": { - "mode": "off" + "tooltip": { + "mode": "single", + "sort": "none" } }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 8, - "y": 0 - }, - "id": 2, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "editorMode": "code", + "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[5m])\n)", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "User error response count", + "type": "timeseries" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[$__rate_interval])\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" + "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" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] }, - "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false + "gridPos": { + "h": 8, + "w": 8, + "x": 8, + "y": 10 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "editorMode": "code", + "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[$__rate_interval])\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" + }, + { + "color": "red", + "value": 80 + } + ] + } }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 8, + "x": 16, + "y": 10 + }, + "id": 1, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true }, - "thresholdsStyle": { - "mode": "off" + "tooltip": { + "mode": "single", + "sort": "none" } }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" }, - { - "color": "red", - "value": 80 - } - ] - } + "editorMode": "code", + "expr": "sum(\n rate(api_response_code{statuscode=~\"2..\",endpoint!=\"/metrics\"}[$__range])\n)", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "Success response count", + "type": "timeseries" }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 8, - "x": 16, - "y": 0 - }, - "id": 1, - "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" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "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\"}[$__rate_interval])))", + "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": "sum(\n rate(api_response_code{statuscode=~\"2..\",endpoint!=\"/metrics\"}[$__range])\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" + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "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[$__rate_interval]))", + "instant": false, + "legendFormat": "__auto", + "range": true, + "refId": "A" + } + ], + "title": "DB posts throughput", + "type": "timeseries" } ], - "title": "Success response count", - "type": "timeseries" + "title": "Gateway", + "type": "row" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 2 + }, + "id": 8, + "panels": [], + "title": "Poller", + "type": "row" }, { "datasource": { @@ -366,9 +669,9 @@ "h": 8, "w": 12, "x": 0, - "y": 8 + "y": 3 }, - "id": 4, + "id": 6, "options": { "legend": { "calcs": [], @@ -388,56 +691,32 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_query_bucket{query=\"sp1-post\"}[$__rate_interval])))", + "expr": "last_processed_block{}", "instant": false, "legendFormat": "__auto", "range": true, "refId": "A" } ], - "title": "DB posts latency (p50)", + "title": "Last Processed Block", "type": "timeseries" }, { "datasource": { - "type": "prometheus", - "uid": "prometheus" + "type": "postgres", + "uid": "postgres" }, "fieldConfig": { "defaults": { "color": { - "mode": "palette-classic" + "mode": "thresholds" }, "custom": { - "axisCenteredZero": false, - "axisColorMode": "text", - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false + "align": "auto", + "cellOptions": { + "type": "auto" }, - "insertNulls": false, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "stacking": { - "group": "A", - "mode": "none" - }, - "thresholdsStyle": { - "mode": "off" - } + "inspect": false }, "mappings": [], "thresholds": { @@ -460,37 +739,59 @@ "h": 8, "w": 12, "x": 12, - "y": 8 + "y": 3 }, - "id": 6, + "id": 7, "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false }, - "tooltip": { - "mode": "single", - "sort": "none" - } + "showHeader": true }, + "pluginVersion": "10.1.10", "targets": [ { "datasource": { - "type": "prometheus", - "uid": "prometheus" + "type": "postgres", + "uid": "postgres" }, - "editorMode": "code", - "expr": "last_processed_block{}", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "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": "Payments Poller Last Processed Block", - "type": "timeseries" + "title": "Panel Title", + "type": "table" }, { "datasource": { @@ -554,9 +855,9 @@ "h": 8, "w": 12, "x": 0, - "y": 16 + "y": 11 }, - "id": 5, + "id": 15, "options": { "legend": { "calcs": [], @@ -576,15 +877,67 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(rate(time_elapsed_db_query_count[$__rate_interval]))", + "expr": "active_subscriptions{}", "instant": false, "legendFormat": "__auto", "range": true, "refId": "A" } ], - "title": "DB posts throughput", + "title": "Active Subscriptions", "type": "timeseries" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 19 + }, + "id": 12, + "panels": [], + "title": "Proof Aggregator", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 13, + "panels": [], + "title": "Ethereum", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 21 + }, + "id": 14, + "panels": [], + "title": "Payments contract", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 22 + }, + "id": 16, + "panels": [], + "title": "Proof Aggregator contract", + "type": "row" } ], "refresh": "", @@ -602,6 +955,6 @@ "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 1, + "version": 2, "weekStart": "" } From d922ad0cf84eea5e8667df2ef742a26db0908dc4 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 19:09:58 -0300 Subject: [PATCH 22/45] Fix the infinity rpc integration --- metrics-docker-compose.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index c5165b72c6..787f8ef31f 100644 --- a/metrics-docker-compose.yaml +++ b/metrics-docker-compose.yaml @@ -16,15 +16,19 @@ 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 + extra_hosts: + - "host.docker.internal:host-gateway" restart: unless-stopped ports: - "3000:3000" From d48b39de5d968ef3c58c8011df1903aa0327e20d Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 5 Jan 2026 19:11:16 -0300 Subject: [PATCH 23/45] Add the Current Block field using UQL --- .../aligned/aggregation_mode_gateway.json | 272 +++++++++++++++++- 1 file changed, 261 insertions(+), 11 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index f22631f0de..3ce4e2b332 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -121,7 +121,7 @@ "h": 1, "w": 24, "x": 0, - "y": 1 + "y": 7 }, "id": 11, "panels": [ @@ -600,7 +600,7 @@ "h": 1, "w": 24, "x": 0, - "y": 2 + "y": 8 }, "id": 8, "panels": [], @@ -669,7 +669,7 @@ "h": 8, "w": 12, "x": 0, - "y": 3 + "y": 9 }, "id": 6, "options": { @@ -739,7 +739,7 @@ "h": 8, "w": 12, "x": 12, - "y": 3 + "y": 9 }, "id": 7, "options": { @@ -855,7 +855,7 @@ "h": 8, "w": 12, "x": 0, - "y": 11 + "y": 17 }, "id": 15, "options": { @@ -888,12 +888,12 @@ "type": "timeseries" }, { - "collapsed": true, + "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 19 + "y": 25 }, "id": 12, "panels": [], @@ -901,25 +901,275 @@ "type": "row" }, { - "collapsed": true, + "collapsed": false, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 20 + "y": 26 }, "id": 13, "panels": [], "title": "Ethereum", "type": "row" }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 27 + }, + "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": [ + { + "selector": "$.number", + "text": "block_number", + "type": "string" + } + ], + "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": "uql", + "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_getBlockByNumber\",\n \"params\": [\"latest\", false],\n \"id\": 1\n}", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Current Block (hex)", + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 8, + "y": 27 + }, + "id": 22, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [ + { + "selector": "$.result", + "text": "gas_price_wei_hex" + } + ], + "filters": [], + "format": "table", + "method": "POST", + "refId": "A", + "root_selector": "$", + "source": "url", + "type": "json", + "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": "Gas Price (hex Wei)", + "type": "stat" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 16, + "y": 27 + }, + "id": 23, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [ + { + "selector": "$.baseFeePerGas", + "text": "base_fee_wei_hex" + } + ], + "filters": [], + "format": "table", + "method": "POST", + "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_getBlockByNumber\",\n \"params\": [\"latest\", false],\n \"id\": 1\n}", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } + ], + "title": "Base Fee (hex Wei)", + "type": "stat" + }, { "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 21 + "y": 33 }, "id": 14, "panels": [], @@ -932,7 +1182,7 @@ "h": 1, "w": 24, "x": 0, - "y": 22 + "y": 34 }, "id": 16, "panels": [], From a5984a15f307b65d3862b4214e4e1108324eba56 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 10:44:05 -0300 Subject: [PATCH 24/45] Transform the values to decimal ones --- .../aligned/aggregation_mode_gateway.json | 441 ++++++++---------- 1 file changed, 205 insertions(+), 236 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 3ce4e2b332..c009d3c0ae 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -901,7 +901,7 @@ "type": "row" }, { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, @@ -909,259 +909,228 @@ "y": 26 }, "id": 13, - "panels": [], - "title": "Ethereum", - "type": "row" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "ethereum_rpc" - }, - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" + "panels": [ + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" }, - { - "color": "red", - "value": 80 + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 0, - "y": 27 - }, - "id": 21, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 27 + }, + "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": [ + { + "selector": "$.number", + "text": "block_number", + "type": "string" + } + ], + "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": "uql", + "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_getBlockByNumber\",\n \"params\": [\"latest\", false],\n \"id\": 1\n}", + "headers": [ + { + "key": "Content-Type", + "value": "application/json" + } + ], + "method": "POST" + } + } ], - "fields": "/.*/", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.10", - "targets": [ - { - "columns": [ + "title": "Current Block", + "transformations": [ { - "selector": "$.number", - "text": "block_number", - "type": "string" + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "result" + } + ], + "fields": {} + } } ], + "type": "stat" + }, + { "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": "uql", - "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_getBlockByNumber\",\n \"params\": [\"latest\", false],\n \"id\": 1\n}", - "headers": [ - { - "key": "Content-Type", - "value": "application/json" + "fieldConfig": { + "defaults": { + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] } - ], - "method": "POST" - } - } - ], - "title": "Current Block (hex)", - "type": "stat" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "ethereum_rpc" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 0, + "y": 33 + }, + "id": 22, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "last" + ], + "fields": "/.*/", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "columns": [ + { + "selector": "$.result", + "text": "gas_price_wei_hex" + } + ], + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" }, - { - "color": "red", - "value": 80 + "filters": [], + "format": "table", + "global_query_id": "", + "method": "POST", + "refId": "A", + "root_selector": "$", + "source": "url", + "type": "uql", + "uql": "parse-json\n| project \"gas_price_wei_hex\"=\"result\"", + "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" } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 8, - "y": 27 - }, - "id": 22, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.10", - "targets": [ - { - "columns": [ - { - "selector": "$.result", - "text": "gas_price_wei_hex" } ], - "filters": [], - "format": "table", - "method": "POST", - "refId": "A", - "root_selector": "$", - "source": "url", - "type": "json", - "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": "Gas Price (hex Wei)", - "type": "stat" - }, - { - "datasource": { - "type": "yesoreyeram-infinity-datasource", - "uid": "ethereum_rpc" - }, - "fieldConfig": { - "defaults": { - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 + "title": "Current Gas Price (wei)", + "transformations": [ + { + "id": "calculateField", + "options": { + "mode": "reduceRow", + "reduce": { + "include": [ + "result" + ], + "reducer": "lastNotNull" + }, + "replaceFields": true } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 6, - "w": 8, - "x": 16, - "y": 27 - }, - "id": 23, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "last" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "10.1.10", - "targets": [ - { - "columns": [ + }, { - "selector": "$.baseFeePerGas", - "text": "base_fee_wei_hex" + "id": "convertFieldType", + "options": { + "conversions": [ + { + "destinationType": "number", + "targetField": "result" + } + ], + "fields": {} + } } ], - "filters": [], - "format": "table", - "method": "POST", - "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_getBlockByNumber\",\n \"params\": [\"latest\", false],\n \"id\": 1\n}", - "headers": [ - { - "key": "Content-Type", - "value": "application/json" - } - ], - "method": "POST" - } + "type": "stat" } ], - "title": "Base Fee (hex Wei)", - "type": "stat" + "title": "Ethereum", + "type": "row" }, { "collapsed": true, @@ -1169,7 +1138,7 @@ "h": 1, "w": 24, "x": 0, - "y": 33 + "y": 27 }, "id": 14, "panels": [], @@ -1182,7 +1151,7 @@ "h": 1, "w": 24, "x": 0, - "y": 34 + "y": 28 }, "id": 16, "panels": [], @@ -1198,13 +1167,13 @@ "list": [] }, "time": { - "from": "now-5m", + "from": "now-15m", "to": "now" }, "timepicker": {}, "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 2, + "version": 7, "weekStart": "" } From 3dc04d048a48976a991c232976ca167a6048d721 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 14:05:36 -0300 Subject: [PATCH 25/45] Add some contract calls to the dashboard --- .../aligned/aggregation_mode_gateway.json | 2073 ++++++++++++++--- 1 file changed, 1777 insertions(+), 296 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index c009d3c0ae..4f828cb2d4 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -78,7 +78,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -121,7 +122,7 @@ "h": 1, "w": 24, "x": 0, - "y": 7 + "y": 1 }, "id": 11, "panels": [ @@ -171,7 +172,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -186,7 +188,7 @@ "h": 8, "w": 8, "x": 0, - "y": 10 + "y": 2 }, "id": 3, "options": { @@ -264,7 +266,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -279,7 +282,7 @@ "h": 8, "w": 8, "x": 8, - "y": 10 + "y": 2 }, "id": 2, "options": { @@ -357,7 +360,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -372,7 +376,7 @@ "h": 8, "w": 8, "x": 16, - "y": 10 + "y": 2 }, "id": 1, "options": { @@ -450,7 +454,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -465,7 +470,7 @@ "h": 8, "w": 12, "x": 0, - "y": 18 + "y": 10 }, "id": 4, "options": { @@ -543,7 +548,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -558,7 +564,7 @@ "h": 8, "w": 12, "x": 12, - "y": 18 + "y": 10 }, "id": 5, "options": { @@ -595,305 +601,250 @@ "type": "row" }, { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 8 + "y": 2 }, "id": 8, - "panels": [], - "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": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 9 - }, - "id": 6, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ + "panels": [ { "datasource": { - "type": "prometheus", - "uid": "prometheus" + "type": "postgres", + "uid": "postgres" }, - "editorMode": "code", - "expr": "last_processed_block{}", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" - } - ], - "title": "Last Processed Block", - "type": "timeseries" - }, - { - "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 + "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": 8, - "w": 12, - "x": 12, - "y": 9 - }, - "id": 7, - "options": { - "cellHeight": "sm", - "footer": { - "countRows": false, - "fields": "", - "reducer": [ - "sum" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 12, + "x": 0, + "y": 11 + }, + "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" + } ], - "show": false + "title": "Payment events (placeholder)", + "type": "table" }, - "showHeader": true - }, - "pluginVersion": "10.1.10", - "targets": [ { "datasource": { - "type": "postgres", - "uid": "postgres" + "type": "prometheus", + "uid": "prometheus" }, - "editorMode": "builder", - "format": "table", - "rawSql": "SELECT * FROM payment_events LIMIT 50 ", - "refId": "A", - "sql": { - "columns": [ - { - "parameters": [ - { - "name": "*", - "type": "functionParameter" + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 } - ], - "type": "function" - } - ], - "groupBy": [ - { - "property": { - "type": "string" - }, - "type": "groupBy" + ] } - ], - "limit": 50 - }, - "table": "payment_events" - } - ], - "title": "Panel Title", - "type": "table" - }, - { - "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" + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 12, + "y": 11 + }, + "id": 6, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false }, - "thresholdsStyle": { - "mode": "off" - } + "textMode": "auto" }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 17 - }, - "id": 15, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true + "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" }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ { "datasource": { "type": "prometheus", "uid": "prometheus" }, - "editorMode": "code", - "expr": "active_subscriptions{}", - "instant": false, - "legendFormat": "__auto", - "range": true, - "refId": "A" + "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": 11 + }, + "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" } ], - "title": "Active Subscriptions", - "type": "timeseries" + "title": "Poller", + "type": "row" }, { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, - "y": 25 + "y": 3 }, "id": 12, "panels": [], @@ -906,7 +857,7 @@ "h": 1, "w": 24, "x": 0, - "y": 26 + "y": 4 }, "id": 13, "panels": [ @@ -941,7 +892,7 @@ "h": 6, "w": 8, "x": 0, - "y": 27 + "y": 5 }, "id": 21, "options": { @@ -1044,7 +995,7 @@ "h": 6, "w": 8, "x": 0, - "y": 33 + "y": 11 }, "id": 22, "options": { @@ -1138,23 +1089,1553 @@ "h": 1, "w": 24, "x": 0, - "y": 27 + "y": 5 }, "id": 14, - "panels": [], - "title": "Payments contract", - "type": "row" - }, - { - "collapsed": true, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 28 - }, - "id": 16, - "panels": [], + "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": 6 + }, + "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" + }, + { + "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": 9 + }, + "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": 9 + }, + "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": 9 + }, + "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": 9 + }, + "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": 15 + }, + "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": 15 + }, + "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 contract", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 6 + }, + "id": 16, + "panels": [ + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "noValue": "2", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 7 + }, + "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\": \"0xd84c0fEfEaEf69A51836DBf607E031a9033a4ed7\",\n \"data\": \"0x18160ddd\"\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" + }, + { + "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": 9, + "x": 7, + "y": 7 + }, + "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", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 8, + "x": 16, + "y": 7 + }, + "id": 31, + "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" + }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "ethereum_rpc" + }, + "description": "", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "noValue": "1", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 13 + }, + "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\": \"0xd84c0fEfEaEf69A51836DBf607E031a9033a4ed7\",\n \"data\": \"0x18160ddd\"\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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 9, + "x": 7, + "y": 13 + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 7, + "x": 0, + "y": 19 + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 7, + "y": 19 + }, + "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", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "string" + }, + "overrides": [] + }, + "gridPos": { + "h": 6, + "w": 8, + "x": 15, + "y": 19 + }, + "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": "Proof Aggregator contract", "type": "row" } @@ -1174,6 +2655,6 @@ "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 7, + "version": 10, "weekStart": "" } From f4696d8df774a2bc67b60bd21f634a7b86b584c6 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 16:00:27 -0300 Subject: [PATCH 26/45] update the grafana dashboard timeline queries --- .../dashboards/aligned/aggregation_mode_gateway.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 7873bd4d7d..01cfd5350f 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 8, + "id": 7, "links": [], "liveNow": false, "panels": [ @@ -106,7 +106,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"4..\"}[5m])\n)", + "expr": "floor(\n increase(api_response_code{job=\"gateway-api\",statuscode=~\"4..\"}[10y])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -200,7 +200,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"5..\"}[$__rate_interval])\n)", + "expr": "floor(\n increase(api_response_code{job=\"gateway-api\",statuscode=~\"5..\"}[10y])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -294,7 +294,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(\n rate(api_response_code{statuscode=~\"2..\",endpoint!=\"/metrics\"}[$__range])\n)", + "expr": "floor(\n increase(api_response_code{job=\"gateway-api\",statuscode=~\"2..\",endpoint!=\"/metrics\"}[10y])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -388,7 +388,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_query_bucket{query=\"sp1-post\"}[$__rate_interval])))", + "expr": "histogram_quantile(0.50, sum by (le) (rate(time_elapsed_db_query_bucket{query=\"sp1-post\"}[10y])))", "instant": false, "legendFormat": "__auto", "range": true, @@ -576,7 +576,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "sum(rate(time_elapsed_db_query_count[$__rate_interval]))", + "expr": "sum(rate(time_elapsed_db_query_count[10y]))", "instant": false, "legendFormat": "__auto", "range": true, From 816e710729e13551bf0e919019402920a587d588 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 16:03:32 -0300 Subject: [PATCH 27/45] Improve naming on time elapsed vars of http server --- aggregation_mode/gateway/src/http.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index 55774a7ee4..13ca009b4d 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -248,7 +248,7 @@ impl GatewayServer { return HttpResponse::BadRequest().json(AppResponse::new_unsucessfull(message, 400)); }; - let start = Instant::now(); + let query_started_at = Instant::now(); match state .db @@ -263,10 +263,10 @@ impl GatewayServer { .await { Ok(task_id) => { - let duration = start.elapsed(); + let time_elapsed_db_call = query_started_at.elapsed(); state .metrics - .register_db_response_time_post("sp1-post", duration.as_secs_f64()); + .register_db_response_time_post("sp1-post", time_elapsed_db_call.as_secs_f64()); HttpResponse::Ok().json(AppResponse::new_sucessfull( serde_json::json!({ "task_id": task_id.to_string() }), From c00abcdd4d88fda20b5ea5f2e09fa0f4d0588b48 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 16:08:23 -0300 Subject: [PATCH 28/45] simplify the name for the prometheus jobs and bots for agg mode --- prometheus/prometheus.yaml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/prometheus/prometheus.yaml b/prometheus/prometheus.yaml index 3de7b120f9..0dc6e6696c 100644 --- a/prometheus/prometheus.yaml +++ b/prometheus/prometheus.yaml @@ -38,23 +38,23 @@ scrape_configs: labels: bot: "node-exporter" - - job_name: "gateway-api" + - job_name: "gateway-http" scrape_interval: 60s static_configs: - targets: ["host.docker.internal:8089"] labels: - bot: "gateway-exporter" + bot: "gateway-http" - - job_name: "aggregation-mode-gateway" + - job_name: "gateway" scrape_interval: 1s static_configs: - targets: ["host.docker.internal:9094"] labels: - bot: "aggregation-gateway" + bot: "gateway" - - job_name: "aggregation-mode-payments-poller" + - job_name: "poller" scrape_interval: 1s static_configs: - targets: ["host.docker.internal:9095"] labels: - bot: "aggregation-poller" + bot: "poller" From c608dc28a49896cc0ec494e134b9aabda473d9ad Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 16:18:37 -0300 Subject: [PATCH 29/45] update the agg mode dash with the new names --- .../dashboards/aligned/aggregation_mode_gateway.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 01cfd5350f..1b4aa63672 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -106,7 +106,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "floor(\n increase(api_response_code{job=\"gateway-api\",statuscode=~\"4..\"}[10y])\n)", + "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"4..\"}[10y])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -200,7 +200,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "floor(\n increase(api_response_code{job=\"gateway-api\",statuscode=~\"5..\"}[10y])\n)", + "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"5..\"}[10y])\n)", "instant": false, "legendFormat": "__auto", "range": true, @@ -294,7 +294,7 @@ "uid": "prometheus" }, "editorMode": "code", - "expr": "floor(\n increase(api_response_code{job=\"gateway-api\",statuscode=~\"2..\",endpoint!=\"/metrics\"}[10y])\n)", + "expr": "floor(\n increase(api_response_code{job=\"gateway-http\",statuscode=~\"2..\",endpoint!=\"/metrics\"}[10y])\n)", "instant": false, "legendFormat": "__auto", "range": true, From 66a55fff4ce71adc4a23c61ffeee9ddc7fd7299a Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 17:37:26 -0300 Subject: [PATCH 30/45] fetch the risc0 and sp1 ids from proof aggregator contract --- .../dashboards/aligned/aggregation_mode_gateway.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index d3fc86bc42..932ca9d24a 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -1862,7 +1862,6 @@ "mode": "thresholds" }, "mappings": [], - "noValue": "2", "thresholds": { "mode": "absolute", "steps": [ @@ -1919,7 +1918,7 @@ "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 }", + "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" } } @@ -2140,7 +2139,6 @@ "mode": "thresholds" }, "mappings": [], - "noValue": "1", "thresholds": { "mode": "absolute", "steps": [ @@ -2197,7 +2195,7 @@ "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 }", + "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" } } From dc5db7b9900b71dee15db6afc0b8393d4c88b488 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 17:37:56 -0300 Subject: [PATCH 31/45] remove UQL from the ethereum panels --- .../aligned/aggregation_mode_gateway.json | 81 +++++++------------ 1 file changed, 27 insertions(+), 54 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 932ca9d24a..906ec048b2 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 6, + "id": 2, "links": [], "liveNow": false, "panels": [ @@ -78,8 +78,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -172,8 +171,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -266,8 +264,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -360,8 +357,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -454,8 +450,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -548,8 +543,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -632,8 +626,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -717,8 +710,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -783,8 +775,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -912,13 +903,7 @@ "pluginVersion": "10.1.10", "targets": [ { - "columns": [ - { - "selector": "$.number", - "text": "block_number", - "type": "string" - } - ], + "columns": [], "datasource": { "type": "yesoreyeram-infinity-datasource", "uid": "ethereum_rpc" @@ -933,13 +918,13 @@ "refId": "A", "root_selector": "$.result", "source": "url", - "type": "uql", + "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_getBlockByNumber\",\n \"params\": [\"latest\", false],\n \"id\": 1\n}", + "data": "{\n \"jsonrpc\": \"2.0\",\n \"method\": \"eth_blockNumber\",\n \"params\": [],\n \"id\": 1\n}", "headers": [ { "key": "Content-Type", @@ -958,7 +943,7 @@ "conversions": [ { "destinationType": "number", - "targetField": "result" + "targetField": "value" } ], "fields": {} @@ -974,6 +959,9 @@ }, "fieldConfig": { "defaults": { + "color": { + "mode": "thresholds" + }, "mappings": [], "thresholds": { "mode": "absolute", @@ -1005,7 +993,7 @@ "orientation": "auto", "reduceOptions": { "calcs": [ - "last" + "lastNotNull" ], "fields": "/.*/", "values": false @@ -1015,12 +1003,7 @@ "pluginVersion": "10.1.10", "targets": [ { - "columns": [ - { - "selector": "$.result", - "text": "gas_price_wei_hex" - } - ], + "columns": [], "datasource": { "type": "yesoreyeram-infinity-datasource", "uid": "ethereum_rpc" @@ -1028,12 +1011,15 @@ "filters": [], "format": "table", "global_query_id": "", + "json_options": { + "root_is_not_array": true + }, "method": "POST", "refId": "A", - "root_selector": "$", + "root_selector": "$.result", "source": "url", - "type": "uql", - "uql": "parse-json\n| project \"gas_price_wei_hex\"=\"result\"", + "type": "json", + "uql": "", "url": "", "url_options": { "body_content_type": "application/json", @@ -1051,26 +1037,13 @@ ], "title": "Current Gas Price (wei)", "transformations": [ - { - "id": "calculateField", - "options": { - "mode": "reduceRow", - "reduce": { - "include": [ - "result" - ], - "reducer": "lastNotNull" - }, - "replaceFields": true - } - }, { "id": "convertFieldType", "options": { "conversions": [ { "destinationType": "number", - "targetField": "result" + "targetField": "value" } ], "fields": {} @@ -2653,6 +2626,6 @@ "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 10, + "version": 1, "weekStart": "" } From f7fdb366dfc58f774e8160d5712b7deb2d37803c Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Tue, 6 Jan 2026 18:06:19 -0300 Subject: [PATCH 32/45] update the active subscriptions query --- aggregation_mode/payments_poller/src/db.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/aggregation_mode/payments_poller/src/db.rs b/aggregation_mode/payments_poller/src/db.rs index a805f570a1..a1b5725688 100644 --- a/aggregation_mode/payments_poller/src/db.rs +++ b/aggregation_mode/payments_poller/src/db.rs @@ -85,16 +85,18 @@ impl Db { &self, epoch: BigDecimal, ) -> Result { - let (count,) = sqlx::query_as::<_, (i64,)>( - " + 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(&self.pool) - .await?; - - Ok(count) + ) + .bind(&epoch) + .fetch_one(&pool) + .await + }) + .await } } From 37e1cc87d682604318dca84c7ba69640561014c1 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Wed, 7 Jan 2026 10:40:58 -0300 Subject: [PATCH 33/45] Add gateway status to the Gateway row panels --- .../aligned/aggregation_mode_gateway.json | 251 +++++++++--------- .../provisioning/datasources/datasource.yaml | 11 + 2 files changed, 135 insertions(+), 127 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 906ec048b2..0e4f5ee5aa 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,12 +18,12 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 2, + "id": 7, "links": [], "liveNow": false, "panels": [ { - "collapsed": true, + "collapsed": false, "gridPos": { "h": 1, "w": 24, @@ -31,87 +31,7 @@ "y": 0 }, "id": 9, - "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" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 8, - "w": 12, - "x": 0, - "y": 9 - }, - "id": 10, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom", - "showLegend": true - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "title": "Monitor Status", - "type": "timeseries" - } - ], + "panels": [], "title": "Database", "type": "row" }, @@ -171,7 +91,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -264,7 +185,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -357,7 +279,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -404,6 +327,95 @@ "title": "Success response count", "type": "timeseries" }, + { + "datasource": { + "type": "yesoreyeram-infinity-datasource", + "uid": "rpc" + }, + "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": 10 + }, + "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": "rpc" + }, + "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", @@ -450,7 +462,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -463,8 +476,8 @@ }, "gridPos": { "h": 8, - "w": 12, - "x": 0, + "w": 9, + "x": 6, "y": 10 }, "id": 4, @@ -543,7 +556,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -556,8 +570,8 @@ }, "gridPos": { "h": 8, - "w": 12, - "x": 12, + "w": 9, + "x": 15, "y": 10 }, "id": 5, @@ -867,8 +881,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -967,8 +980,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1083,8 +1095,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1184,8 +1195,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1301,8 +1311,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1421,8 +1430,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1522,8 +1530,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1639,8 +1646,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1740,8 +1746,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1839,8 +1844,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1940,8 +1944,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2026,8 +2029,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -2116,8 +2118,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -2217,8 +2218,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2313,8 +2313,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2409,8 +2408,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2505,8 +2503,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -2626,6 +2623,6 @@ "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 1, + "version": 2, "weekStart": "" } diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 27db04e784..8b8fa31a25 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -42,3 +42,14 @@ datasources: 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: "RPC" + type: "yesoreyeram-infinity-datasource" + uid: "rpc" + access: "proxy" + url: "" + isDefault: false + jsonData: + global_queries: [] From efd929409bcc6a50d54f09809abd944499fcfcee Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Wed, 7 Jan 2026 14:30:22 -0300 Subject: [PATCH 34/45] fix errors in cargo toml and imports --- aggregation_mode/Cargo.lock | 21 --------------------- aggregation_mode/gateway/Cargo.toml | 1 - aggregation_mode/gateway/src/http.rs | 3 +-- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/aggregation_mode/Cargo.lock b/aggregation_mode/Cargo.lock index 8b0ee4b1bf..063a34c84c 100644 --- a/aggregation_mode/Cargo.lock +++ b/aggregation_mode/Cargo.lock @@ -3895,21 +3895,6 @@ dependencies = [ "waker-fn", ] -[[package]] -name = "futures-locks" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - [[package]] name = "futures-macro" version = "0.3.31" @@ -10078,12 +10063,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" -[[package]] -name = "walkdir" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317211a0dc0ceedd78fb2ca9a44aed3d7b9b26f81870d485c07122b4350673b7" - [[package]] name = "want" version = "0.3.1" diff --git a/aggregation_mode/gateway/Cargo.toml b/aggregation_mode/gateway/Cargo.toml index 979a08784b..d6d9ebc43e 100644 --- a/aggregation_mode/gateway/Cargo.toml +++ b/aggregation_mode/gateway/Cargo.toml @@ -9,7 +9,6 @@ serde_json = { workspace = true } serde_yaml = { workspace = true } agg_mode_sdk = { workspace = true } prometheus = { workspace = true } -aligned-sdk = { workspace = true } sp1-sdk = { workspace = true } db = { workspace = true } tracing = { version = "0.1", features = ["log"] } diff --git a/aggregation_mode/gateway/src/http.rs b/aggregation_mode/gateway/src/http.rs index 8da144270a..9b4db44429 100644 --- a/aggregation_mode/gateway/src/http.rs +++ b/aggregation_mode/gateway/src/http.rs @@ -10,8 +10,7 @@ use actix_web::{ App, HttpRequest, HttpResponse, HttpServer, Responder, }; use actix_web_prometheus::PrometheusMetricsBuilder; -use agg_mode_sdk::types::types::Network; -use aligned_sdk::aggregation_layer::AggregationModeProvingSystem; +use agg_mode_sdk::{blockchain::AggregationModeProvingSystem, types::Network}; use alloy::signers::Signature; use sp1_sdk::{SP1ProofWithPublicValues, SP1VerifyingKey}; use sqlx::types::BigDecimal; From 64985c58330022f3ce8b21c599d256df12953ec3 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Wed, 7 Jan 2026 16:18:00 -0300 Subject: [PATCH 35/45] Add a health check for monitoring poller status --- .../aligned/aggregation_mode_gateway.json | 170 ++++++++++++++---- 1 file changed, 131 insertions(+), 39 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 0e4f5ee5aa..58b05752f9 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,12 +18,12 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 7, + "id": 8, "links": [], "liveNow": false, "panels": [ { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, @@ -107,7 +107,7 @@ "h": 8, "w": 8, "x": 0, - "y": 2 + "y": 10 }, "id": 3, "options": { @@ -201,7 +201,7 @@ "h": 8, "w": 8, "x": 8, - "y": 2 + "y": 10 }, "id": 2, "options": { @@ -295,7 +295,7 @@ "h": 8, "w": 8, "x": 16, - "y": 2 + "y": 10 }, "id": 1, "options": { @@ -374,7 +374,7 @@ "h": 8, "w": 6, "x": 0, - "y": 10 + "y": 18 }, "id": 10, "options": { @@ -478,7 +478,7 @@ "h": 8, "w": 9, "x": 6, - "y": 10 + "y": 18 }, "id": 4, "options": { @@ -572,7 +572,7 @@ "h": 8, "w": 9, "x": 15, - "y": 10 + "y": 18 }, "id": 5, "options": { @@ -640,7 +640,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -655,7 +656,7 @@ "h": 6, "w": 12, "x": 0, - "y": 11 + "y": 3 }, "id": 7, "options": { @@ -724,7 +725,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -739,7 +741,7 @@ "h": 6, "w": 7, "x": 12, - "y": 11 + "y": 3 }, "id": 6, "options": { @@ -789,7 +791,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -804,7 +807,7 @@ "h": 6, "w": 5, "x": 19, - "y": 11 + "y": 3 }, "id": 15, "options": { @@ -838,6 +841,88 @@ ], "title": "Active Subscriptions", "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "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": "Poller", @@ -896,7 +981,7 @@ "h": 6, "w": 8, "x": 0, - "y": 5 + "y": 13 }, "id": 21, "options": { @@ -995,7 +1080,7 @@ "h": 6, "w": 8, "x": 0, - "y": 11 + "y": 19 }, "id": 22, "options": { @@ -1095,7 +1180,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null } ] } @@ -1106,7 +1192,7 @@ "h": 3, "w": 14, "x": 5, - "y": 6 + "y": 20 }, "id": 32, "options": { @@ -1195,7 +1281,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1211,7 +1298,7 @@ "h": 6, "w": 6, "x": 0, - "y": 9 + "y": 23 }, "id": 34, "options": { @@ -1311,7 +1398,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1327,7 +1415,7 @@ "h": 6, "w": 6, "x": 6, - "y": 9 + "y": 23 }, "id": 33, "options": { @@ -1430,7 +1518,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1446,7 +1535,7 @@ "h": 6, "w": 6, "x": 12, - "y": 9 + "y": 23 }, "id": 37, "options": { @@ -1530,7 +1619,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1546,7 +1636,7 @@ "h": 6, "w": 6, "x": 18, - "y": 9 + "y": 23 }, "id": 38, "options": { @@ -1646,7 +1736,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1662,7 +1753,7 @@ "h": 6, "w": 6, "x": 0, - "y": 15 + "y": 29 }, "id": 35, "options": { @@ -1746,7 +1837,8 @@ "mode": "absolute", "steps": [ { - "color": "green" + "color": "green", + "value": null }, { "color": "red", @@ -1762,7 +1854,7 @@ "h": 3, "w": 9, "x": 6, - "y": 15 + "y": 29 }, "id": 36, "options": { @@ -1855,7 +1947,7 @@ "h": 6, "w": 7, "x": 0, - "y": 7 + "y": 15 }, "id": 24, "options": { @@ -1960,7 +2052,7 @@ "h": 6, "w": 9, "x": 7, - "y": 7 + "y": 15 }, "id": 27, "options": { @@ -2040,7 +2132,7 @@ "h": 3, "w": 8, "x": 16, - "y": 7 + "y": 15 }, "id": 31, "options": { @@ -2129,7 +2221,7 @@ "h": 6, "w": 7, "x": 0, - "y": 13 + "y": 21 }, "id": 25, "options": { @@ -2234,7 +2326,7 @@ "h": 6, "w": 9, "x": 7, - "y": 13 + "y": 21 }, "id": 28, "options": { @@ -2329,7 +2421,7 @@ "h": 6, "w": 7, "x": 0, - "y": 19 + "y": 27 }, "id": 26, "options": { @@ -2424,7 +2516,7 @@ "h": 6, "w": 8, "x": 7, - "y": 19 + "y": 27 }, "id": 29, "options": { @@ -2519,7 +2611,7 @@ "h": 6, "w": 8, "x": 15, - "y": 19 + "y": 27 }, "id": 30, "options": { @@ -2623,6 +2715,6 @@ "timezone": "", "title": "Aggregation Mode", "uid": "a66a5480-6a60-4b87-9d29-4f0f446edafd", - "version": 2, + "version": 1, "weekStart": "" } From 160039ba622f68a536c7794edaa2909f463dc5e7 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Wed, 7 Jan 2026 16:33:30 -0300 Subject: [PATCH 36/45] Move the prometheus URL to the metrics docker compose --- grafana/provisioning/datasources/datasource.yaml | 2 +- metrics-docker-compose.yaml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 8b8fa31a25..974269e76b 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -6,7 +6,7 @@ datasources: uid: prometheus access: proxy orgId: 1 - url: http://prometheus:9090 + url: "${PROMETHEUS_URL}" basicAuth: false isDefault: true editable: true diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index 787f8ef31f..c5d0ec3ddf 100644 --- a/metrics-docker-compose.yaml +++ b/metrics-docker-compose.yaml @@ -27,6 +27,7 @@ services: - POSTGRES_DB=postgres - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres + - PROMETHEUS_URL=http://prometheus:9090 extra_hosts: - "host.docker.internal:host-gateway" restart: unless-stopped From 953c413732c83fbfdbefb1abf3e45da4f6f664b4 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Wed, 7 Jan 2026 16:38:40 -0300 Subject: [PATCH 37/45] rename rpc datasource to http --- .../dashboards/aligned/aggregation_mode_gateway.json | 4 ++-- grafana/provisioning/datasources/datasource.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 58b05752f9..0428b9a4e1 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -330,7 +330,7 @@ { "datasource": { "type": "yesoreyeram-infinity-datasource", - "uid": "rpc" + "uid": "http" }, "fieldConfig": { "defaults": { @@ -397,7 +397,7 @@ "columns": [], "datasource": { "type": "yesoreyeram-infinity-datasource", - "uid": "rpc" + "uid": "http" }, "filters": [], "format": "table", diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 974269e76b..1fe0213a70 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -45,9 +45,9 @@ datasources: # 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: "RPC" + - name: "HTTP" type: "yesoreyeram-infinity-datasource" - uid: "rpc" + uid: "http" access: "proxy" url: "" isDefault: false From fef66d5191a1ead91e69c2390c6eae74d865ca3c Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Thu, 8 Jan 2026 12:22:30 -0300 Subject: [PATCH 38/45] Add the pg_auto_failover Monitor datasource --- .../provisioning/datasources/datasource.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 1fe0213a70..23f7324d80 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -53,3 +53,20 @@ datasources: isDefault: false jsonData: global_queries: [] + + - name: pg_auto_failover Monitor (host port) + type: postgres + uid: pgaf_monitor_host + access: proxy + orgId: 1 + url: host.docker.internal:5436 + database: pg_auto_failover + user: autoctl_node + basicAuth: false + isDefault: false + editable: true + jsonData: + sslmode: require + postgresVersion: 1700 + secureJsonData: + password: "" From 080ef226330f0ff970a010776610b27329002655 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Thu, 8 Jan 2026 14:49:18 -0300 Subject: [PATCH 39/45] Add panels for the database monitoring --- .../aligned/aggregation_mode_gateway.json | 666 ++++++++++++++++-- 1 file changed, 603 insertions(+), 63 deletions(-) diff --git a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json index 0428b9a4e1..290da62273 100644 --- a/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json +++ b/grafana/provisioning/dashboards/aligned/aggregation_mode_gateway.json @@ -18,7 +18,7 @@ "editable": true, "fiscalYearStartMonth": 0, "graphTooltip": 0, - "id": 8, + "id": 5, "links": [], "liveNow": false, "panels": [ @@ -31,7 +31,564 @@ "y": 0 }, "id": 9, - "panels": [], + "panels": [ + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "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": 6, + "x": 0, + "y": 1 + }, + "id": 41, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n CASE\n WHEN pg_is_in_recovery() = false THEN 1\n ELSE 0\n END AS up;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Monitor Status", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "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": 6, + "x": 6, + "y": 1 + }, + "id": 42, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT node.nodename, health\nFROM pgautofailover.node\nWHERE node.nodename = 'node1';", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Node 1 Status", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "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": 6, + "x": 12, + "y": 1 + }, + "id": 43, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT node.nodename, health\nFROM pgautofailover.node\nWHERE node.nodename = 'node2';", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Node 2 Status", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 6, + "x": 18, + "y": 1 + }, + "id": 44, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto" + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT\n CASE\n WHEN node.nodename = 'node1' THEN 1\n WHEN node.nodename = 'node2' THEN 2\n ELSE NULL\n END AS primary_db\nFROM pgautofailover.node\nWHERE node.reportedstate = 'primary'\nLIMIT 1;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Selected Primary DB", + "type": "stat" + }, + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "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": 5, + "w": 12, + "x": 0, + "y": 6 + }, + "id": 40, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true, + "sortBy": [ + { + "desc": false, + "displayName": "reportedpgisrunning" + } + ] + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "pgaf_monitor_host" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT *\nFROM pgautofailover.node;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Complete monitor state", + "type": "table" + }, + { + "datasource": { + "type": "postgres", + "uid": "postgres" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "left", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 12, + "y": 6 + }, + "id": 45, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "10.1.10", + "targets": [ + { + "datasource": { + "type": "postgres", + "uid": "postgres" + }, + "editorMode": "code", + "format": "table", + "rawQuery": true, + "rawSql": "SELECT version, description\nFROM _sqlx_migrations\nORDER BY version DESC LIMIT 1;", + "refId": "A", + "sql": { + "columns": [ + { + "parameters": [], + "type": "function" + } + ], + "groupBy": [ + { + "property": { + "type": "string" + }, + "type": "groupBy" + } + ], + "limit": 50 + } + } + ], + "title": "Schema Version", + "type": "table" + } + ], "title": "Database", "type": "row" }, @@ -91,8 +648,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -107,7 +663,7 @@ "h": 8, "w": 8, "x": 0, - "y": 10 + "y": 50 }, "id": 3, "options": { @@ -185,8 +741,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -201,7 +756,7 @@ "h": 8, "w": 8, "x": 8, - "y": 10 + "y": 50 }, "id": 2, "options": { @@ -279,8 +834,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -295,7 +849,7 @@ "h": 8, "w": 8, "x": 16, - "y": 10 + "y": 50 }, "id": 1, "options": { @@ -358,8 +912,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -374,7 +927,7 @@ "h": 8, "w": 6, "x": 0, - "y": 18 + "y": 58 }, "id": 10, "options": { @@ -462,8 +1015,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -478,7 +1030,7 @@ "h": 8, "w": 9, "x": 6, - "y": 18 + "y": 58 }, "id": 4, "options": { @@ -556,8 +1108,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -572,7 +1123,7 @@ "h": 8, "w": 9, "x": 15, - "y": 18 + "y": 58 }, "id": 5, "options": { @@ -640,8 +1191,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -656,7 +1206,7 @@ "h": 6, "w": 12, "x": 0, - "y": 3 + "y": 43 }, "id": 7, "options": { @@ -725,8 +1275,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -741,7 +1290,7 @@ "h": 6, "w": 7, "x": 12, - "y": 3 + "y": 43 }, "id": 6, "options": { @@ -791,8 +1340,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -807,7 +1355,7 @@ "h": 6, "w": 5, "x": 19, - "y": 3 + "y": 43 }, "id": 15, "options": { @@ -873,8 +1421,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -889,7 +1436,7 @@ "h": 5, "w": 7, "x": 0, - "y": 9 + "y": 49 }, "id": 39, "options": { @@ -981,7 +1528,7 @@ "h": 6, "w": 8, "x": 0, - "y": 13 + "y": 53 }, "id": 21, "options": { @@ -1080,7 +1627,7 @@ "h": 6, "w": 8, "x": 0, - "y": 19 + "y": 59 }, "id": 22, "options": { @@ -1180,8 +1727,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" } ] } @@ -1192,7 +1738,7 @@ "h": 3, "w": 14, "x": 5, - "y": 20 + "y": 60 }, "id": 32, "options": { @@ -1281,8 +1827,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1298,7 +1843,7 @@ "h": 6, "w": 6, "x": 0, - "y": 23 + "y": 63 }, "id": 34, "options": { @@ -1398,8 +1943,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1415,7 +1959,7 @@ "h": 6, "w": 6, "x": 6, - "y": 23 + "y": 63 }, "id": 33, "options": { @@ -1518,8 +2062,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1535,7 +2078,7 @@ "h": 6, "w": 6, "x": 12, - "y": 23 + "y": 63 }, "id": 37, "options": { @@ -1619,8 +2162,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1636,7 +2178,7 @@ "h": 6, "w": 6, "x": 18, - "y": 23 + "y": 63 }, "id": 38, "options": { @@ -1736,8 +2278,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1753,7 +2294,7 @@ "h": 6, "w": 6, "x": 0, - "y": 29 + "y": 69 }, "id": 35, "options": { @@ -1837,8 +2378,7 @@ "mode": "absolute", "steps": [ { - "color": "green", - "value": null + "color": "green" }, { "color": "red", @@ -1854,7 +2394,7 @@ "h": 3, "w": 9, "x": 6, - "y": 29 + "y": 69 }, "id": 36, "options": { @@ -1947,7 +2487,7 @@ "h": 6, "w": 7, "x": 0, - "y": 15 + "y": 55 }, "id": 24, "options": { @@ -2052,7 +2592,7 @@ "h": 6, "w": 9, "x": 7, - "y": 15 + "y": 55 }, "id": 27, "options": { @@ -2132,7 +2672,7 @@ "h": 3, "w": 8, "x": 16, - "y": 15 + "y": 55 }, "id": 31, "options": { @@ -2221,7 +2761,7 @@ "h": 6, "w": 7, "x": 0, - "y": 21 + "y": 61 }, "id": 25, "options": { @@ -2326,7 +2866,7 @@ "h": 6, "w": 9, "x": 7, - "y": 21 + "y": 61 }, "id": 28, "options": { @@ -2421,7 +2961,7 @@ "h": 6, "w": 7, "x": 0, - "y": 27 + "y": 67 }, "id": 26, "options": { @@ -2516,7 +3056,7 @@ "h": 6, "w": 8, "x": 7, - "y": 27 + "y": 67 }, "id": 29, "options": { @@ -2611,7 +3151,7 @@ "h": 6, "w": 8, "x": 15, - "y": 27 + "y": 67 }, "id": 30, "options": { From cc650fa36407c502d78589432361cee4229ae0fe Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Thu, 8 Jan 2026 17:29:18 -0300 Subject: [PATCH 40/45] use env vars to define url in postgres datasource --- grafana/provisioning/datasources/datasource.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 1fe0213a70..dcdbb413eb 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -18,7 +18,7 @@ datasources: uid: postgres access: proxy orgId: 1 - url: postgres:5432 + url: "${POSTGRES_HOST}:${POSTGRES_PORT}" database: ${POSTGRES_DB} user: ${POSTGRES_USER} secureJsonData: From af5305d52b73c962a7f0d3a59a9bbac14e705cf0 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Thu, 8 Jan 2026 17:52:46 -0300 Subject: [PATCH 41/45] Convert the monitor db vars to env vars --- grafana/provisioning/datasources/datasource.yaml | 8 ++++---- metrics-docker-compose.yaml | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 5411f93300..70c0fb9093 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -54,14 +54,14 @@ datasources: jsonData: global_queries: [] - - name: pg_auto_failover Monitor (host port) + - name: pg_auto_failover Monitor type: postgres uid: pgaf_monitor_host access: proxy orgId: 1 - url: host.docker.internal:5436 - database: pg_auto_failover - user: autoctl_node + url: "${MONITOR_DB_HOST}:${MONITOR_DB_PORT}" + database: MONITOR_DB_DB + user: MONITOR_DB_USER basicAuth: false isDefault: false editable: true diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index c5d0ec3ddf..7e05d902b9 100644 --- a/metrics-docker-compose.yaml +++ b/metrics-docker-compose.yaml @@ -28,6 +28,10 @@ services: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - PROMETHEUS_URL=http://prometheus:9090 + - MONITOR_DB_HOST=host.docker.internal + - MONITOR_DB_PORT=5436 + - MONITOR_DB_DB=pg_auto_failover + - MONITOR_DB_USER=autoctl_node extra_hosts: - "host.docker.internal:host-gateway" restart: unless-stopped From 7fd110aa8f53b794970f212c567a615c22ab2f74 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Thu, 8 Jan 2026 18:06:39 -0300 Subject: [PATCH 42/45] Move the securejsondata field to just below the user one --- grafana/provisioning/datasources/datasource.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index 70c0fb9093..e77fd4e8a7 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -62,11 +62,11 @@ datasources: url: "${MONITOR_DB_HOST}:${MONITOR_DB_PORT}" database: MONITOR_DB_DB user: MONITOR_DB_USER + secureJsonData: + password: "" basicAuth: false isDefault: false editable: true jsonData: sslmode: require postgresVersion: 1700 - secureJsonData: - password: "" From e1803421986008dc7f0bcd3d90f03ad2e18e3774 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 9 Jan 2026 11:45:32 -0300 Subject: [PATCH 43/45] fix: use the env values instead of using their names --- grafana/provisioning/datasources/datasource.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/grafana/provisioning/datasources/datasource.yaml b/grafana/provisioning/datasources/datasource.yaml index e77fd4e8a7..4afd2c4a7a 100644 --- a/grafana/provisioning/datasources/datasource.yaml +++ b/grafana/provisioning/datasources/datasource.yaml @@ -60,8 +60,8 @@ datasources: access: proxy orgId: 1 url: "${MONITOR_DB_HOST}:${MONITOR_DB_PORT}" - database: MONITOR_DB_DB - user: MONITOR_DB_USER + database: "${MONITOR_DB_DB}" + user: "${MONITOR_DB_USER}" secureJsonData: password: "" basicAuth: false From 461fca59275091550134bd4fac27b0c8d2281370 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Fri, 9 Jan 2026 11:52:43 -0300 Subject: [PATCH 44/45] feat(aggregation-mode): integrate auto failover to the docker compose --- aggregation_mode/docker-compose.yaml | 53 ++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/aggregation_mode/docker-compose.yaml b/aggregation_mode/docker-compose.yaml index 289184681c..703b8f79bd 100644 --- a/aggregation_mode/docker-compose.yaml +++ b/aggregation_mode/docker-compose.yaml @@ -1,3 +1,20 @@ +# Shared base configuration for Postgres nodes. Avoids duplication and keeps all nodes consistent. +# Note: This is a template, not a service. +x-node: &node + image: citusdata/pg_auto_failover:v2.0-pg14 + volumes: + - /var/lib/postgres + environment: + PGDATA: /var/lib/postgres/pgaf + PGUSER: tutorial + PGDATABASE: tutorial + PG_AUTOCTL_HBA_LAN: true + PG_AUTOCTL_AUTH_METHOD: "trust" + PG_AUTOCTL_SSL_SELF_SIGNED: true + PG_AUTOCTL_MONITOR: "postgresql://autoctl_node@monitor/pg_auto_failover" + expose: + - 5432 + volumes: postgres_data: @@ -31,3 +48,39 @@ services: - 8090:8080 networks: - aligned-network + + monitor: + image: citusdata/pg_auto_failover:v2.0-pg14 + volumes: + - /var/lib/postgres + environment: + PGDATA: /var/lib/postgres/pgaf + PG_AUTOCTL_SSL_SELF_SIGNED: true + ports: + - "5436:5432" + command: | + pg_autoctl create monitor --auth trust --run + + node1: + <<: *node + hostname: node1 + command: > + pg_autoctl create postgres + --name node1 + --ssl-self-signed + --ssl-mode require + --auth trust + --pg-hba-lan + --run + + node2: + <<: *node + hostname: node2 + command: > + pg_autoctl create postgres + --name node2 + --ssl-self-signed + --ssl-mode require + --auth trust + --pg-hba-lan + --run From 48af2116a608366f5ab4ded30be73f6a84b1ebd8 Mon Sep 17 00:00:00 2001 From: maximopalopoli Date: Mon, 12 Jan 2026 10:35:35 -0300 Subject: [PATCH 45/45] use internal network to connect grafana with db monitor in composes --- aggregation_mode/docker-compose.yaml | 4 ++++ metrics-docker-compose.yaml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/aggregation_mode/docker-compose.yaml b/aggregation_mode/docker-compose.yaml index b71a9ad563..45e11ce8ab 100644 --- a/aggregation_mode/docker-compose.yaml +++ b/aggregation_mode/docker-compose.yaml @@ -14,6 +14,8 @@ x-node: &node PG_AUTOCTL_MONITOR: "postgresql://autoctl_node@monitor/pg_auto_failover" expose: - 5432 + networks: + - aligned-network volumes: postgres_data: @@ -60,6 +62,8 @@ services: - "5436:5432" command: | pg_autoctl create monitor --auth trust --run + networks: + - aligned-network node1: <<: *node diff --git a/metrics-docker-compose.yaml b/metrics-docker-compose.yaml index 7e05d902b9..a39d374346 100644 --- a/metrics-docker-compose.yaml +++ b/metrics-docker-compose.yaml @@ -28,8 +28,8 @@ services: - POSTGRES_USER=postgres - POSTGRES_PASSWORD=postgres - PROMETHEUS_URL=http://prometheus:9090 - - MONITOR_DB_HOST=host.docker.internal - - MONITOR_DB_PORT=5436 + - MONITOR_DB_HOST=monitor + - MONITOR_DB_PORT=5432 - MONITOR_DB_DB=pg_auto_failover - MONITOR_DB_USER=autoctl_node extra_hosts: