@@ -19,7 +19,7 @@ use apollo_integration_tests::utils::{
19
19
CreateRpcTxsFn ,
20
20
TestTxHashesFn ,
21
21
} ;
22
- use metrics_exporter_prometheus:: { PrometheusBuilder , PrometheusRecorder } ;
22
+ use metrics_exporter_prometheus:: { PrometheusBuilder , PrometheusHandle } ;
23
23
use pretty_assertions:: assert_eq;
24
24
use starknet_api:: execution_resources:: GasAmount ;
25
25
use starknet_api:: transaction:: TransactionHash ;
@@ -38,8 +38,9 @@ pub async fn end_to_end_flow(
38
38
configure_tracing ( ) . await ;
39
39
40
40
let mut tx_generator = create_flow_test_tx_generator ( ) ;
41
- let recorder = PrometheusBuilder :: new ( ) . build_recorder ( ) ;
42
- let _recorder_guard = metrics:: set_default_local_recorder ( & recorder) ;
41
+ let global_recorder_handle = PrometheusBuilder :: new ( )
42
+ . install_recorder ( )
43
+ . expect ( "Should be able to install global prometheus recorder" ) ;
43
44
44
45
const TEST_SCENARIO_TIMEOUT : std:: time:: Duration = std:: time:: Duration :: from_secs ( 50 ) ;
45
46
// Setup.
@@ -106,7 +107,7 @@ pub async fn end_to_end_flow(
106
107
{current_batched_txs_count}"
107
108
) ;
108
109
109
- current_batched_txs_count = get_total_batched_txs_count ( & recorder ) ;
110
+ current_batched_txs_count = get_total_batched_txs_count ( & global_recorder_handle ) ;
110
111
if current_batched_txs_count == total_expected_batched_txs_count {
111
112
break ;
112
113
}
@@ -124,7 +125,7 @@ pub async fn end_to_end_flow(
124
125
} ) ;
125
126
}
126
127
127
- assert_full_blocks_flow ( & recorder , expecting_full_blocks) ;
128
+ assert_full_blocks_flow ( & global_recorder_handle , expecting_full_blocks) ;
128
129
}
129
130
130
131
pub struct TestScenario {
@@ -133,13 +134,13 @@ pub struct TestScenario {
133
134
pub test_tx_hashes_fn : TestTxHashesFn ,
134
135
}
135
136
136
- fn get_total_batched_txs_count ( recorder : & PrometheusRecorder ) -> usize {
137
- let metrics = recorder . handle ( ) . render ( ) ;
137
+ fn get_total_batched_txs_count ( handle : & PrometheusHandle ) -> usize {
138
+ let metrics = handle. render ( ) ;
138
139
apollo_batcher:: metrics:: BATCHED_TRANSACTIONS . parse_numeric_metric :: < usize > ( & metrics) . unwrap ( )
139
140
}
140
141
141
- fn assert_full_blocks_flow ( recorder : & PrometheusRecorder , expecting_full_blocks : bool ) {
142
- let metrics = recorder . handle ( ) . render ( ) ;
142
+ fn assert_full_blocks_flow ( recorder_handle : & PrometheusHandle , expecting_full_blocks : bool ) {
143
+ let metrics = recorder_handle . render ( ) ;
143
144
let full_blocks_metric = apollo_batcher:: metrics:: BLOCK_CLOSE_REASON
144
145
. parse_numeric_metric :: < u64 > (
145
146
& metrics,
0 commit comments