@@ -3,6 +3,8 @@ use reth_metrics::{
3
3
Metrics ,
4
4
} ;
5
5
6
+ use crate :: args:: OpRbuilderArgs ;
7
+
6
8
/// The latest version from Cargo.toml.
7
9
pub const CARGO_PKG_VERSION : & str = env ! ( "CARGO_PKG_VERSION" ) ;
8
10
@@ -96,6 +98,35 @@ pub struct OpRBuilderMetrics {
96
98
pub bundle_receive_duration : Histogram ,
97
99
}
98
100
101
+ /// Gauges to check whether particular flags are enabled or not
102
+ #[ derive( Metrics , Clone ) ]
103
+ #[ metrics( scope = "op_rbuilder_flags" ) ]
104
+ pub struct FlagMetrics {
105
+ /// Whether flashblocks.enabled is set or not
106
+ pub flashblocks_enabled : Gauge ,
107
+ /// Whether flashtestations.enabled is set or not
108
+ pub flashtestations_enabled : Gauge ,
109
+ /// Whether builder.enable-revert-protection is set or not
110
+ pub enable_revert_protection : Gauge ,
111
+ }
112
+
113
+ impl FlagMetrics {
114
+ /// Set gauge metrics for some flags so we can inspect which ones are set
115
+ /// and which ones aren't.
116
+ pub fn record_flags ( builder_args : & OpRbuilderArgs ) {
117
+ let flag_metrics = Self :: default ( ) ;
118
+ flag_metrics
119
+ . flashblocks_enabled
120
+ . set ( builder_args. flashblocks . enabled as i32 ) ;
121
+ flag_metrics
122
+ . flashtestations_enabled
123
+ . set ( builder_args. flashtestations . flashtestations_enabled as i32 ) ;
124
+ flag_metrics
125
+ . enable_revert_protection
126
+ . set ( builder_args. enable_revert_protection as i32 ) ;
127
+ }
128
+ }
129
+
99
130
/// Contains version information for the application.
100
131
#[ derive( Debug , Clone ) ]
101
132
pub struct VersionInfo {
0 commit comments