Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a51d8f7
feat(aggregation-mode): add grafana dashboard
maximopalopoli Dec 19, 2025
94c0404
fix: return BadRequest for the request denied exams
maximopalopoli Dec 19, 2025
9ce4dde
Update the dashboard to include code ranges (2xx, 4xx, 5xx)
maximopalopoli Dec 22, 2025
531e929
Filter by range in dashboards and remove the /metrics reqs in 2xx one
maximopalopoli Dec 22, 2025
61f889a
Add time_elapsed_db_post metric to have a metric in use
maximopalopoli Dec 22, 2025
00d5338
Add the payments poller metrics integration
maximopalopoli Dec 22, 2025
77fc789
fix clippy lints on agg mode
maximopalopoli Dec 22, 2025
710ff46
Remove unnecessary labeling on actix prometheus metrics builder
maximopalopoli Dec 22, 2025
3aeb64a
use tracing::error instead of eprintln
maximopalopoli Dec 22, 2025
07eb91b
Remove anyhow dependency
maximopalopoli Dec 22, 2025
dad51de
Convert the warp servers into
maximopalopoli Dec 22, 2025
09cc63c
Merge branch 'staging' into feataggmode/add-grafana-dashboard
maximopalopoli Dec 23, 2025
deaa77a
Add comment about the actix http prometheus server
maximopalopoli Dec 23, 2025
09eb015
Return an Arc in the Metrics structs start method
maximopalopoli Dec 23, 2025
7ee8201
Make the time_elapsed_db_query to be a histogram vec
maximopalopoli Dec 23, 2025
b50ebb4
Change the actix prometheus version to the latest stable
maximopalopoli Jan 5, 2026
2aa1550
Fix expression in grafana dashboard to match the rate interval instea…
maximopalopoli Jan 5, 2026
63d136d
Move the aligned-network to the root docker compose and use it on met…
maximopalopoli Jan 5, 2026
e077c6e
Add postgres datasource
maximopalopoli Jan 5, 2026
37d8c7b
add infinity datasource to make queries to RPC
maximopalopoli Jan 5, 2026
924f140
Add a counter for active subscriptions to the payments poller metrics
maximopalopoli Jan 5, 2026
6e08596
Update the dashboard json with some poller metrics
maximopalopoli Jan 5, 2026
d922ad0
Fix the infinity rpc integration
maximopalopoli Jan 5, 2026
d48b39d
Add the Current Block field using UQL
maximopalopoli Jan 5, 2026
a5984a1
Transform the values to decimal ones
maximopalopoli Jan 6, 2026
3dc04d0
Add some contract calls to the dashboard
maximopalopoli Jan 6, 2026
c38b398
Merge branch 'staging' into feataggmode/add-grafana-dashboard
maximopalopoli Jan 6, 2026
f4696d8
update the grafana dashboard timeline queries
maximopalopoli Jan 6, 2026
816e710
Improve naming on time elapsed vars of http server
maximopalopoli Jan 6, 2026
c00abcd
simplify the name for the prometheus jobs and bots for agg mode
maximopalopoli Jan 6, 2026
c608dc2
update the agg mode dash with the new names
maximopalopoli Jan 6, 2026
1bf2bc4
Merge branch 'feataggmode/add-grafana-dashboard' into feataggmode/add…
maximopalopoli Jan 6, 2026
66a55ff
fetch the risc0 and sp1 ids from proof aggregator contract
maximopalopoli Jan 6, 2026
dc5db7b
remove UQL from the ethereum panels
maximopalopoli Jan 6, 2026
3281d07
Merge branch 'staging' into feataggmode/add-grafana-dashboard
maximopalopoli Jan 6, 2026
0031c20
Merge branch 'feataggmode/add-grafana-dashboard' into feataggmode/add…
maximopalopoli Jan 6, 2026
f7fdb36
update the active subscriptions query
maximopalopoli Jan 6, 2026
37e1cc8
Add gateway status to the Gateway row panels
maximopalopoli Jan 7, 2026
44cec84
Merge branch 'staging' into feataggmode/add-datasources-grafana-dashb…
maximopalopoli Jan 7, 2026
efd9294
fix errors in cargo toml and imports
maximopalopoli Jan 7, 2026
64985c5
Add a health check for monitoring poller status
maximopalopoli Jan 7, 2026
160039b
Move the prometheus URL to the metrics docker compose
maximopalopoli Jan 7, 2026
953c413
rename rpc datasource to http
maximopalopoli Jan 7, 2026
cc650fa
use env vars to define url in postgres datasource
maximopalopoli Jan 8, 2026
254f944
Move the network declaration to the agg mode compose file
maximopalopoli Jan 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions aggregation_mode/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
volumes:
postgres_data:

networks:
aligned-network:
name: aligned-network
driver: bridge

name: aggregation-mode
services:
postgres:
Expand All @@ -14,10 +19,15 @@ services:
- postgres_data:/var/lib/postgresql/data
ports:
- 5435:5432
networks:
- aligned-network

adminer:
image: adminer
restart: always
depends_on:
- postgres
ports:
- 8090:8080
networks:
- aligned-network
19 changes: 19 additions & 0 deletions aggregation_mode/payments_poller/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,23 @@ impl Db {
})
.await
}

pub async fn count_total_active_subscriptions(
&self,
epoch: BigDecimal,
) -> Result<i64, sqlx::Error> {
self.orchestrator
.query(async |pool| {
sqlx::query_scalar::<_, i64>(
"
SELECT COUNT(*)
FROM payment_events
WHERE started_at < $1 AND $1 < valid_until",
)
.bind(&epoch)
.fetch_one(&pool)
.await
})
.await
}
}
12 changes: 12 additions & 0 deletions aggregation_mode/payments_poller/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -17,14 +18,21 @@ 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(),
// so the data must be static and safely shared between threads.
let metrics = Arc::new(Self {
registry,
last_processed_block,
active_subscriptions,
});

let server_metrics = metrics.clone();
Expand Down Expand Up @@ -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);
}
}
27 changes: 26 additions & 1 deletion aggregation_mode/payments_poller/src/payments.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
use std::{str::FromStr, sync::Arc};
use std::{
str::FromStr,
sync::Arc,
time::{SystemTime, UNIX_EPOCH},
};

use crate::{
config::Config,
Expand Down Expand Up @@ -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,
Expand Down
Loading
Loading