pub struct ProcessTelemetryConfig { /* private fields */ }Expand description
Validated process-root inputs for release identity and metrics bootstrap.
Parsing is intentionally separated from environment access so service composition roots can validate deterministic values in tests and fail closed before advertising readiness.
Implementations§
Source§impl ProcessTelemetryConfig
impl ProcessTelemetryConfig
Sourcepub fn try_from_values(
service: impl Into<String>,
commit: Option<&str>,
nonce: Option<&str>,
metrics_enabled: Option<&str>,
exporter: Option<&str>,
bind_addr: Option<&str>,
path: Option<&str>,
) -> Result<Self, ProcessTelemetryConfigError>
pub fn try_from_values( service: impl Into<String>, commit: Option<&str>, nonce: Option<&str>, metrics_enabled: Option<&str>, exporter: Option<&str>, bind_addr: Option<&str>, path: Option<&str>, ) -> Result<Self, ProcessTelemetryConfigError>
Parses process telemetry inputs without reading global process state.
A missing runtime commit uses a real build-time
ROCKETMQ_BUILD_COMMIT. When no real build revision was embedded, the
all-zero sentinel remains available only as the local host-development
default. An explicit all-zero runtime commit is rejected, and an
explicit runtime commit must match a real embedded build commit. Other
missing values select local nonce, disabled metrics, loopback binding,
and /metrics. An explicitly enabled exporter must be non-disabled;
explicitly disabling metrics normalizes the exporter to Disable.
§Errors
Returns ProcessTelemetryConfigError for an invalid release identity,
boolean, exporter, bind address, path, or inconsistent enabled/exporter
selection.
Sourcepub fn try_from_observability_and_values(
service: impl Into<String>,
base: &ObservabilityConfig,
commit: Option<&OsStr>,
nonce: Option<&OsStr>,
metrics_enabled: Option<&OsStr>,
exporter: Option<&OsStr>,
bind_addr: Option<&OsStr>,
path: Option<&OsStr>,
) -> Result<Self, ProcessTelemetryConfigError>
pub fn try_from_observability_and_values( service: impl Into<String>, base: &ObservabilityConfig, commit: Option<&OsStr>, nonce: Option<&OsStr>, metrics_enabled: Option<&OsStr>, exporter: Option<&OsStr>, bind_addr: Option<&OsStr>, path: Option<&OsStr>, ) -> Result<Self, ProcessTelemetryConfigError>
Parses process telemetry inputs over an existing observability base.
Missing metrics values preserve the corresponding base configuration.
§Errors
Returns ProcessTelemetryConfigError when an explicitly supplied
value is non-Unicode or otherwise invalid.
Sourcepub fn from_process_env(
service: impl Into<String>,
) -> Result<Self, ProcessTelemetryConfigError>
pub fn from_process_env( service: impl Into<String>, ) -> Result<Self, ProcessTelemetryConfigError>
Reads and validates the supported process environment variables.
§Errors
Returns ProcessTelemetryConfigError when an environment value is not
Unicode or fails the same validation as Self::try_from_values.
Sourcepub fn release_identity(&self) -> &ValidatedReleaseIdentity
pub fn release_identity(&self) -> &ValidatedReleaseIdentity
Returns the validated release identity.
Sourcepub const fn metrics_enabled(&self) -> bool
pub const fn metrics_enabled(&self) -> bool
Returns whether metrics are enabled for this process.
Sourcepub const fn metrics_exporter(&self) -> MetricsExporter
pub const fn metrics_exporter(&self) -> MetricsExporter
Returns the selected metrics exporter.
Sourcepub fn prometheus_listener_addr(&self) -> Option<SocketAddr>
pub fn prometheus_listener_addr(&self) -> Option<SocketAddr>
Returns the Prometheus listener that will actually be bound by this process.
Sourcepub fn prometheus_host(&self) -> &str
pub fn prometheus_host(&self) -> &str
Returns the validated Prometheus listener host.
Sourcepub const fn prometheus_port(&self) -> u16
pub const fn prometheus_port(&self) -> u16
Returns the validated Prometheus listener port.
Sourcepub fn prometheus_path(&self) -> &str
pub fn prometheus_path(&self) -> &str
Returns the canonical Prometheus scrape path.
Sourcepub fn apply_to(&self, config: &mut ObservabilityConfig)
pub fn apply_to(&self, config: &mut ObservabilityConfig)
Applies the validated process-root values to observability configuration.
Enabling metrics necessarily enables the observability runtime. Disabling metrics does not disable independently configured traces or logs.