pub struct PrometheusConfig { /* private fields */ }Expand description
Prometheus metrics collection configuration
Configures how Prometheus scrapes metrics from the tracker. When present in environment configuration, Prometheus service is enabled. When absent, Prometheus service is disabled.
§Example
use std::num::NonZeroU32;
use torrust_tracker_deployer_lib::domain::prometheus::PrometheusConfig;
let interval = NonZeroU32::new(15).expect("15 is non-zero");
let config = PrometheusConfig::new(interval);§Default Behavior
- Default scrape interval: 15 seconds
- Minimum: 1 second (to avoid zero or negative values)
Implementations§
Source§impl PrometheusConfig
impl PrometheusConfig
Sourcepub const fn new(scrape_interval_in_secs: NonZeroU32) -> Self
pub const fn new(scrape_interval_in_secs: NonZeroU32) -> Self
Creates a new Prometheus configuration with the specified scrape interval
§Arguments
scrape_interval_in_secs- Non-zero interval in seconds
§Examples
use std::num::NonZeroU32;
use torrust_tracker_deployer_lib::domain::prometheus::PrometheusConfig;
let interval = NonZeroU32::new(30).expect("30 is non-zero");
let config = PrometheusConfig::new(interval);
assert_eq!(config.scrape_interval_in_secs(), 30);Sourcepub fn scrape_interval_in_secs(&self) -> u32
pub fn scrape_interval_in_secs(&self) -> u32
Returns the scrape interval in seconds
The value is guaranteed to be non-zero.
Sourcepub fn docker_image() -> DockerImage
pub fn docker_image() -> DockerImage
Returns the Docker image used for the Prometheus service.
This is a pinned constant — not user-configurable.
§Examples
use torrust_tracker_deployer_lib::domain::prometheus::PrometheusConfig;
let image = PrometheusConfig::docker_image();
assert_eq!(image.full_reference(), "prom/prometheus:v3.11.2");Trait Implementations§
Source§impl Clone for PrometheusConfig
impl Clone for PrometheusConfig
Source§impl Debug for PrometheusConfig
impl Debug for PrometheusConfig
Source§impl Default for PrometheusConfig
impl Default for PrometheusConfig
Source§impl<'de> Deserialize<'de> for PrometheusConfig
impl<'de> Deserialize<'de> for PrometheusConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for PrometheusConfig
Source§impl NetworkDerivation for PrometheusConfig
impl NetworkDerivation for PrometheusConfig
Source§fn derive_networks(&self, enabled_services: &EnabledServices) -> Vec<Network>
fn derive_networks(&self, enabled_services: &EnabledServices) -> Vec<Network>
Derives network assignments for the Prometheus service
Implements NET-04 and NET-05:
- NET-04: Metrics network always (to scrape tracker)
- NET-05: Visualization network if Grafana enabled
Source§impl PartialEq for PrometheusConfig
impl PartialEq for PrometheusConfig
Source§impl PortDerivation for PrometheusConfig
impl PortDerivation for PrometheusConfig
Source§fn derive_ports(&self) -> Vec<PortBinding>
fn derive_ports(&self) -> Vec<PortBinding>
Derives port bindings for Prometheus
Implements PORT-10: Prometheus 9090 on localhost only
Prometheus is bound to localhost to prevent external access.
Grafana accesses it via Docker network (http://prometheus:9090).
Source§impl Serialize for PrometheusConfig
impl Serialize for PrometheusConfig
impl StructuralPartialEq for PrometheusConfig
Source§impl TryFrom<PrometheusSection> for PrometheusConfig
impl TryFrom<PrometheusSection> for PrometheusConfig
Source§type Error = CreateConfigError
type Error = CreateConfigError
Auto Trait Implementations§
impl Freeze for PrometheusConfig
impl RefUnwindSafe for PrometheusConfig
impl Send for PrometheusConfig
impl Sync for PrometheusConfig
impl Unpin for PrometheusConfig
impl UnsafeUnpin for PrometheusConfig
impl UnwindSafe for PrometheusConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request