tor_config/metrics.rs
1//! Configuration for metrics reporting via Prometheus / etc
2
3use derive_deftly::Deftly;
4
5use crate::Listen;
6use crate::derive::prelude::*;
7
8/// Configuration for exporting metrics (eg, perf data)
9#[derive(Debug, Clone, Deftly, Eq, PartialEq)]
10#[derive_deftly(TorConfig)]
11#[non_exhaustive]
12pub struct MetricsConfig {
13 /// Where to listen for incoming HTTP connections.
14 #[deftly(tor_config(sub_builder))]
15 pub prometheus: PrometheusConfig,
16}
17
18/// Configuration for one or more proxy listeners.
19#[derive(Debug, Clone, Deftly, Eq, PartialEq)]
20#[derive_deftly(TorConfig)]
21#[non_exhaustive]
22pub struct PrometheusConfig {
23 /// Port on which to establish a Prometheus scrape endpoint
24 ///
25 /// We listen here for incoming HTTP connections.
26 ///
27 /// If just a port is provided, we don't support IPv6.
28 /// Alternatively, (only) a single address and port can be specified.
29 /// These restrictions are due to upstream limitations:
30 /// <https://github.com/metrics-rs/metrics/issues/567>.
31 #[deftly(tor_config(default))]
32 pub listen: Listen,
33}