@@ -4,6 +4,8 @@ use reth_metrics::{
44 Metrics ,
55} ;
66
7+ use crate :: args:: OpRbuilderArgs ;
8+
79/// The latest version from Cargo.toml.
810pub const CARGO_PKG_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
911
@@ -155,6 +157,35 @@ impl OpRBuilderMetrics {
155157 }
156158}
157159
160+ /// Gauges to check whether particular flags are enabled or not
161+ #[ derive( Metrics , Clone ) ]
162+ #[ metrics( scope = "op_rbuilder_flags" ) ]
163+ pub struct FlagMetrics {
164+ /// Whether flashblocks.enabled is set or not
165+ pub flashblocks_enabled : Gauge ,
166+ /// Whether flashtestations.enabled is set or not
167+ pub flashtestations_enabled : Gauge ,
168+ /// Whether builder.enable-revert-protection is set or not
169+ pub enable_revert_protection : Gauge ,
170+ }
171+
172+ impl FlagMetrics {
173+ /// Set gauge metrics for some flags so we can inspect which ones are set
174+ /// and which ones aren't.
175+ pub fn record_flags ( builder_args : & OpRbuilderArgs ) {
176+ let flag_metrics = Self :: default ( ) ;
177+ flag_metrics
178+ . flashblocks_enabled
179+ . set ( builder_args. flashblocks . enabled as i32 ) ;
180+ flag_metrics
181+ . flashtestations_enabled
182+ . set ( builder_args. flashtestations . flashtestations_enabled as i32 ) ;
183+ flag_metrics
184+ . enable_revert_protection
185+ . set ( builder_args. enable_revert_protection as i32 ) ;
186+ }
187+ }
188+
158189/// Contains version information for the application.
159190#[ derive( Debug , Clone ) ]
160191pub struct VersionInfo {
0 commit comments