pub struct Observability { /* private fields */ }Expand description
Producer-facing routing runtime for typed observations.
Implementations§
Source§impl Observability
impl Observability
Sourcepub fn new(config: ObservabilityConfig) -> Result<Self, InitError>
pub fn new(config: ObservabilityConfig) -> Result<Self, InitError>
Builds a runtime using the documented default logger integration.
Sourcepub fn builder(config: ObservabilityConfig) -> ObservabilityBuilder
pub fn builder(config: ObservabilityConfig) -> ObservabilityBuilder
Starts a construction-time builder for subscribers and projections.
§Examples
use std::path::PathBuf;
use sc_observability_types::ToolName;
use sc_observe::{Observability, ObservabilityConfig};
let config = ObservabilityConfig::default_for(
ToolName::new("demo-tool").expect("valid tool"),
PathBuf::from("logs"),
)
.expect("valid config");
let _builder = Observability::builder(config);Sourcepub fn emit<T>(
&self,
observation: Observation<T>,
) -> Result<(), ObservationError>where
T: Observable,
pub fn emit<T>(
&self,
observation: Observation<T>,
) -> Result<(), ObservationError>where
T: Observable,
Routes one typed observation through the registered subscribers and projections.
§Panics
Panics if the internal last-error mutex has been poisoned while the runtime records a routing, subscriber, or projection failure summary.
Sourcepub fn flush(&self) -> Result<(), FlushError>
pub fn flush(&self) -> Result<(), FlushError>
Flushes the attached logger. Routing itself does not keep an async queue in v1.
§Panics
Panics if the attached logger encounters a poisoned internal mutex while flushing its registered sinks.
Sourcepub fn shutdown(&self) -> Result<(), ShutdownError>
pub fn shutdown(&self) -> Result<(), ShutdownError>
Shuts down the routing runtime. Repeated calls are idempotent.
§Panics
Panics if the attached logger encounters a poisoned internal mutex while flushing sinks or updating query/follow health during shutdown.
Sourcepub fn health(&self) -> ObservabilityHealthReport
pub fn health(&self) -> ObservabilityHealthReport
Returns the aggregate runtime health view.
§Panics
Panics if the internal last-error mutex has been poisoned.