reth_node_core/args/
metric.rs

1use clap::Parser;
2use reth_cli_util::{parse_duration_from_secs, parse_socket_address};
3use std::{net::SocketAddr, time::Duration};
4
5/// Metrics configuration.
6#[derive(Debug, Clone, Default, Parser)]
7pub struct MetricArgs {
8    /// Enable Prometheus metrics.
9    ///
10    /// The metrics will be served at the given interface and port.
11    #[arg(long="metrics", alias = "metrics.prometheus", value_name = "PROMETHEUS", value_parser = parse_socket_address, help_heading = "Metrics")]
12    pub prometheus: Option<SocketAddr>,
13
14    /// URL for pushing Prometheus metrics to a push gateway.
15    ///
16    /// If set, the node will periodically push metrics to the specified push gateway URL.
17    #[arg(
18        long = "metrics.prometheus.push.url",
19        value_name = "PUSH_GATEWAY_URL",
20        help_heading = "Metrics"
21    )]
22    pub push_gateway_url: Option<String>,
23
24    /// Interval in seconds for pushing metrics to push gateway.
25    ///
26    /// Default: 5 seconds
27    #[arg(
28        long = "metrics.prometheus.push.interval",
29        default_value = "5",
30        value_parser = parse_duration_from_secs,
31        value_name = "SECONDS",
32        help_heading = "Metrics"
33    )]
34    pub push_gateway_interval: Duration,
35}