@@ -4,6 +4,8 @@ use reth_metrics::{
4
4
Metrics ,
5
5
} ;
6
6
7
+ use crate :: args:: OpRbuilderArgs ;
8
+
7
9
/// The latest version from Cargo.toml.
8
10
pub const CARGO_PKG_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
9
11
@@ -155,6 +157,35 @@ impl OpRBuilderMetrics {
155
157
}
156
158
}
157
159
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
+
158
189
/// Contains version information for the application.
159
190
#[ derive( Debug , Clone ) ]
160
191
pub struct VersionInfo {
0 commit comments