@@ -46,6 +46,7 @@ use apollo_network::network_manager::metrics::{
4646use apollo_state_sync_metrics:: metrics:: STATE_SYNC_CLASS_MANAGER_MARKER ;
4747
4848use crate :: dashboard:: { Panel , PanelType , Row , Unit } ;
49+ use crate :: query_builder;
4950
5051// The key events that are relevant to the consensus panel.
5152const CONSENSUS_KEY_EVENTS_LOG_QUERY : & str =
@@ -96,7 +97,7 @@ pub(crate) fn get_panel_consensus_round_advanced() -> Panel {
9697 "Consensus Round Advanced" ,
9798 "The number of times the consensus round advanced (counter is increased whenever round > \
9899 0) (10m window)",
99- format ! ( " increase({}[10m])" , CONSENSUS_ROUND_ADVANCES . get_name_with_filter ( ) ) ,
100+ query_builder :: increase ( & CONSENSUS_ROUND_ADVANCES , "10m" ) ,
100101 PanelType :: TimeSeries ,
101102 )
102103 . with_log_query ( "\" START_ROUND\" OR \" PROPOSAL_FAILED\" OR textPayload=~\" DECISION_REACHED\" " )
@@ -131,10 +132,7 @@ fn get_panel_consensus_decisions_reached_by_consensus() -> Panel {
131132 Panel :: new (
132133 "Decisions Reached By Consensus" ,
133134 "The number of decisions reached by way of consensus (10m window)" ,
134- format ! (
135- "increase({}[10m])" ,
136- CONSENSUS_DECISIONS_REACHED_BY_CONSENSUS . get_name_with_filter( )
137- ) ,
135+ query_builder:: increase ( & CONSENSUS_DECISIONS_REACHED_BY_CONSENSUS , "10m" ) ,
138136 PanelType :: TimeSeries ,
139137 )
140138 . with_log_query ( "DECISION_REACHED: Decision reached for round" )
@@ -145,7 +143,7 @@ fn get_panel_consensus_decisions_reached_by_sync() -> Panel {
145143 Panel :: new (
146144 "Decisions Reached By Sync" ,
147145 "The number of decisions reached by way of sync (10m window)" ,
148- format ! ( " increase({}[10m])" , CONSENSUS_DECISIONS_REACHED_BY_SYNC . get_name_with_filter ( ) ) ,
146+ query_builder :: increase ( & CONSENSUS_DECISIONS_REACHED_BY_SYNC , "10m" ) ,
149147 PanelType :: TimeSeries ,
150148 )
151149 . with_log_query ( "Decision learned via sync protocol." )
@@ -156,7 +154,7 @@ fn get_panel_consensus_proposals_received() -> Panel {
156154 Panel :: new (
157155 "Proposal Validation: Number of Received Proposals" ,
158156 "The number of proposals received from the network (10m window)" ,
159- format ! ( " increase({}[10m])" , CONSENSUS_PROPOSALS_RECEIVED . get_name_with_filter ( ) ) ,
157+ query_builder :: increase ( & CONSENSUS_PROPOSALS_RECEIVED , "10m" ) ,
160158 PanelType :: TimeSeries ,
161159 )
162160}
@@ -165,7 +163,7 @@ fn get_panel_consensus_proposals_validated() -> Panel {
165163 Panel :: new (
166164 "Proposal Validation: Number of Validated Proposals" ,
167165 "The number of proposals received and validated successfully (10m window)" ,
168- format ! ( " increase({}[10m])" , CONSENSUS_PROPOSALS_VALIDATED . get_name_with_filter ( ) ) ,
166+ query_builder :: increase ( & CONSENSUS_PROPOSALS_VALIDATED , "10m" ) ,
169167 PanelType :: TimeSeries ,
170168 )
171169 . with_log_query ( "\" Validated proposal.\" OR \" PROPOSAL_FAILED\" " )
@@ -176,7 +174,7 @@ fn get_panel_consensus_proposals_invalid() -> Panel {
176174 Panel :: new (
177175 "Proposal Validation: Number of Invalid Proposals" ,
178176 "The number of proposals received and failed validation (10m window)" ,
179- format ! ( " increase({}[10m])" , CONSENSUS_PROPOSALS_INVALID . get_name_with_filter ( ) ) ,
177+ query_builder :: increase ( & CONSENSUS_PROPOSALS_INVALID , "10m" ) ,
180178 PanelType :: TimeSeries ,
181179 )
182180 . with_log_query ( "\" Validated proposal.\" OR \" PROPOSAL_FAILED\" " )
@@ -202,7 +200,7 @@ fn get_panel_consensus_build_proposal_total() -> Panel {
202200 Panel :: new (
203201 "Proposal Build: Number of Proposals Started" ,
204202 "The number of proposals that started building (10m window)" ,
205- format ! ( " increase({}[10m])" , CONSENSUS_BUILD_PROPOSAL_TOTAL . get_name_with_filter ( ) ) ,
203+ query_builder :: increase ( & CONSENSUS_BUILD_PROPOSAL_TOTAL , "10m" ) ,
206204 PanelType :: TimeSeries ,
207205 )
208206}
@@ -211,7 +209,7 @@ fn get_panel_consensus_build_proposal_failed() -> Panel {
211209 Panel :: new (
212210 "Proposal Build: Number of Proposals Failed" ,
213211 "The number of proposals that failed to be built (10m window)" ,
214- format ! ( " increase({}[10m])" , CONSENSUS_BUILD_PROPOSAL_FAILED . get_name_with_filter ( ) ) ,
212+ query_builder :: increase ( & CONSENSUS_BUILD_PROPOSAL_FAILED , "10m" ) ,
215213 PanelType :: TimeSeries ,
216214 )
217215}
@@ -290,7 +288,7 @@ fn get_panel_cende_write_blob_success() -> Panel {
290288 Panel :: new (
291289 "Write Blob Success" ,
292290 "The number of successful blob writes to Cende (10m window)" ,
293- format ! ( " increase({}[10m])" , CENDE_WRITE_BLOB_SUCCESS . get_name_with_filter ( ) ) ,
291+ query_builder :: increase ( & CENDE_WRITE_BLOB_SUCCESS , "10m" ) ,
294292 PanelType :: TimeSeries ,
295293 )
296294 . with_log_query ( query_expression)
@@ -315,7 +313,7 @@ fn get_panel_cende_write_preconfirmed_block() -> Panel {
315313 "Write Preconfirmed Block Success" ,
316314 "The number of successful writes to Cende for preconfirmed blocks (10m window). Each \
317315 preconfirmed block may involve multiple writes.",
318- format ! ( " increase({}[10m])" , PRECONFIRMED_BLOCK_WRITTEN . get_name_with_filter ( ) ) ,
316+ query_builder :: increase ( & PRECONFIRMED_BLOCK_WRITTEN , "10m" ) ,
319317 PanelType :: TimeSeries ,
320318 )
321319 . with_log_query ( "write_pre_confirmed_block request succeeded." )
@@ -335,7 +333,7 @@ fn get_panel_consensus_votes_num_sent_messages() -> Panel {
335333 "Consensus Votes Number of Sent Messages" ,
336334 "The increase in the number of vote messages sent by consensus p2p (over the selected \
337335 time range)",
338- format ! ( " increase({}[ $__range])" , CONSENSUS_VOTES_NUM_SENT_MESSAGES . get_name_with_filter ( ) ) ,
336+ query_builder :: increase ( & CONSENSUS_VOTES_NUM_SENT_MESSAGES , " $__range" ) ,
339337 PanelType :: Stat ,
340338 )
341339}
@@ -345,10 +343,7 @@ fn get_panel_consensus_votes_num_received_messages() -> Panel {
345343 "Consensus Votes Number of Received Messages" ,
346344 "The increase in the number of vote messages received by consensus p2p (over the selected \
347345 time range)",
348- format ! (
349- "increase({}[$__range])" ,
350- CONSENSUS_VOTES_NUM_RECEIVED_MESSAGES . get_name_with_filter( )
351- ) ,
346+ query_builder:: increase ( & CONSENSUS_VOTES_NUM_RECEIVED_MESSAGES , "$__range" ) ,
352347 PanelType :: Stat ,
353348 )
354349}
@@ -358,10 +353,7 @@ fn get_panel_consensus_proposals_num_sent_messages() -> Panel {
358353 "Consensus Proposals Number of Sent Messages" ,
359354 "The increase in the number of proposal messages sent by consensus p2p (over the selected \
360355 time range)",
361- format ! (
362- "increase({}[$__range])" ,
363- CONSENSUS_PROPOSALS_NUM_SENT_MESSAGES . get_name_with_filter( )
364- ) ,
356+ query_builder:: increase ( & CONSENSUS_PROPOSALS_NUM_SENT_MESSAGES , "$__range" ) ,
365357 PanelType :: Stat ,
366358 )
367359}
@@ -371,10 +363,7 @@ fn get_panel_consensus_proposals_num_received_messages() -> Panel {
371363 "Consensus Proposals Number of Received Messages" ,
372364 "The increase in the number of proposal messages received by consensus p2p (over the \
373365 selected time range)",
374- format ! (
375- "increase({}[$__range])" ,
376- CONSENSUS_PROPOSALS_NUM_RECEIVED_MESSAGES . get_name_with_filter( )
377- ) ,
366+ query_builder:: increase ( & CONSENSUS_PROPOSALS_NUM_RECEIVED_MESSAGES , "$__range" ) ,
378367 PanelType :: Stat ,
379368 )
380369}
@@ -383,7 +372,7 @@ fn get_panel_consensus_conflicting_votes() -> Panel {
383372 Panel :: new (
384373 "Consensus Conflicting Votes" ,
385374 "The increase in the number of conflicting votes (over the selected time range)" ,
386- format ! ( " increase({}[ $__range])" , CONSENSUS_CONFLICTING_VOTES . get_name_with_filter ( ) ) ,
375+ query_builder :: increase ( & CONSENSUS_CONFLICTING_VOTES , " $__range" ) ,
387376 PanelType :: Stat ,
388377 )
389378}
@@ -432,10 +421,7 @@ fn get_panel_consensus_decisions_reached_as_proposer() -> Panel {
432421 Panel :: new (
433422 "Consensus Decisions Reached As Proposer" ,
434423 "The number of rounds with decision reached where this node is the proposer (10m window)" ,
435- format ! (
436- "increase({}[10m])" ,
437- CONSENSUS_DECISIONS_REACHED_AS_PROPOSER . get_name_with_filter( )
438- ) ,
424+ query_builder:: increase ( & CONSENSUS_DECISIONS_REACHED_AS_PROPOSER , "10m" ) ,
439425 PanelType :: TimeSeries ,
440426 )
441427 . with_log_query ( "\" Building proposal\" OR \" BATCHER_FIN_PROPOSER\" " )
0 commit comments