@@ -2,8 +2,9 @@ use std::{thread, time::Duration};
22
33// Prometheus
44use prometheus:: {
5- opts, register_int_counter, register_int_counter_vec, register_int_gauge, IntCounter ,
6- IntCounterVec , IntGauge ,
5+ core:: { AtomicF64 , GenericCounter } ,
6+ opts, register_counter, register_int_counter, register_int_counter_vec, register_int_gauge,
7+ IntCounter , IntCounterVec , IntGauge ,
78} ;
89
910use warp:: { Filter , Rejection , Reply } ;
@@ -22,6 +23,8 @@ pub struct BatcherMetrics {
2223 pub s3_duration : IntGauge ,
2324 pub create_new_task_duration : IntGauge ,
2425 pub cancel_create_new_task_duration : IntGauge ,
26+ pub batcher_gas_cost_create_task_total : GenericCounter < AtomicF64 > ,
27+ pub batcher_gas_cost_cancel_task_total : GenericCounter < AtomicF64 > ,
2528}
2629
2730impl BatcherMetrics {
@@ -59,6 +62,17 @@ impl BatcherMetrics {
5962 "Cancel create New Task Duration"
6063 ) ) ?;
6164
65+ let batcher_gas_cost_create_task_total: GenericCounter < AtomicF64 > =
66+ register_counter ! ( opts!(
67+ "batcher_gas_cost_create_task_total" ,
68+ "Batcher Gas Cost Create Task Total"
69+ ) ) ?;
70+ let batcher_gas_cost_cancel_task_total: GenericCounter < AtomicF64 > =
71+ register_counter ! ( opts!(
72+ "batcher_gas_cost_cancel_task_total" ,
73+ "Batcher Gas Cost Cancel Task Total"
74+ ) ) ?;
75+
6276 registry. register ( Box :: new ( open_connections. clone ( ) ) ) ?;
6377 registry. register ( Box :: new ( received_proofs. clone ( ) ) ) ?;
6478 registry. register ( Box :: new ( sent_batches. clone ( ) ) ) ?;
@@ -71,6 +85,8 @@ impl BatcherMetrics {
7185 registry. register ( Box :: new ( s3_duration. clone ( ) ) ) ?;
7286 registry. register ( Box :: new ( create_new_task_duration. clone ( ) ) ) ?;
7387 registry. register ( Box :: new ( cancel_create_new_task_duration. clone ( ) ) ) ?;
88+ registry. register ( Box :: new ( batcher_gas_cost_create_task_total. clone ( ) ) ) ?;
89+ registry. register ( Box :: new ( batcher_gas_cost_cancel_task_total. clone ( ) ) ) ?;
7490
7591 let metrics_route = warp:: path!( "metrics" )
7692 . and ( warp:: any ( ) . map ( move || registry. clone ( ) ) )
@@ -95,6 +111,8 @@ impl BatcherMetrics {
95111 s3_duration,
96112 create_new_task_duration,
97113 cancel_create_new_task_duration,
114+ batcher_gas_cost_create_task_total,
115+ batcher_gas_cost_cancel_task_total,
98116 } )
99117 }
100118
0 commit comments