Skip to content

gauge metrics to inspect flag settings #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/op-rbuilder/src/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use eyre::Result;
use crate::{
args::*,
builders::{BuilderConfig, BuilderMode, FlashblocksBuilder, PayloadBuilder, StandardBuilder},
metrics::VERSION,
metrics::{FlagMetrics, VERSION},
monitor_tx_pool::monitor_tx_pool,
primitives::reth::engine_api_builder::OpEngineApiBuilder,
revert_protection::{EthApiExtServer, EthApiOverrideServer, RevertProtectionExt},
Expand Down Expand Up @@ -98,6 +98,8 @@ where
let builder_config = BuilderConfig::<B::Config>::try_from(builder_args.clone())
.expect("Failed to convert rollup args to builder config");

FlagMetrics::record_flags(&builder_args);

let da_config = builder_config.da_config.clone();
let rollup_args = builder_args.rollup_args;
let op_node = OpNode::new(rollup_args.clone());
Expand Down
31 changes: 31 additions & 0 deletions crates/op-rbuilder/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ use reth_metrics::{
Metrics,
};

use crate::args::OpRbuilderArgs;

/// The latest version from Cargo.toml.
pub const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION");

Expand Down Expand Up @@ -155,6 +157,35 @@ impl OpRBuilderMetrics {
}
}

/// Gauges to check whether particular flags are enabled or not
#[derive(Metrics, Clone)]
#[metrics(scope = "op_rbuilder_flags")]
pub struct FlagMetrics {
/// Whether flashblocks.enabled is set or not
pub flashblocks_enabled: Gauge,
/// Whether flashtestations.enabled is set or not
pub flashtestations_enabled: Gauge,
/// Whether builder.enable-revert-protection is set or not
pub enable_revert_protection: Gauge,
}

impl FlagMetrics {
/// Set gauge metrics for some flags so we can inspect which ones are set
/// and which ones aren't.
pub fn record_flags(builder_args: &OpRbuilderArgs) {
let flag_metrics = Self::default();
flag_metrics
.flashblocks_enabled
.set(builder_args.flashblocks.enabled as i32);
flag_metrics
.flashtestations_enabled
.set(builder_args.flashtestations.flashtestations_enabled as i32);
flag_metrics
.enable_revert_protection
.set(builder_args.enable_revert_protection as i32);
}
}

/// Contains version information for the application.
#[derive(Debug, Clone)]
pub struct VersionInfo {
Expand Down
Loading