aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-config-shared/src/metrics.rs
blob: f8d05c7ab6ed3b174accc4c07ac9d7664a009180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//! Configuration for metrics reporting via Prometheus / etc

use derive_deftly::Deftly;

use tor_config::Listen;
use tor_config::derive::prelude::*;

/// Configuration for exporting metrics (eg, perf data)
#[derive(Debug, Clone, Deftly, Eq, PartialEq)]
#[derive_deftly(TorConfig)]
#[non_exhaustive]
pub struct MetricsConfig {
    /// Where to listen for incoming HTTP connections.
    #[deftly(tor_config(sub_builder))]
    pub prometheus: PrometheusConfig,
}

/// Configuration for one or more proxy listeners.
#[derive(Debug, Clone, Deftly, Eq, PartialEq)]
#[derive_deftly(TorConfig)]
#[non_exhaustive]
pub struct PrometheusConfig {
    /// Port on which to establish a Prometheus scrape endpoint
    ///
    /// We listen here for incoming HTTP connections.
    ///
    /// If just a port is provided, we don't support IPv6.
    /// Alternatively, (only) a single address and port can be specified.
    /// These restrictions are due to upstream limitations:
    /// <https://github.com/metrics-rs/metrics/issues/567>.
    #[deftly(tor_config(default))]
    pub listen: Listen,
}