pub struct ObservabilityBuilder { /* private fields */ }Expand description
Builder for configuring observability (tracing, metrics, logging)
Implementations§
Source§impl ObservabilityBuilder
impl ObservabilityBuilder
Sourcepub fn service_version(self, version: impl Into<String>) -> Self
pub fn service_version(self, version: impl Into<String>) -> Self
Set the service version
Sourcepub fn environment(self, env: impl Into<String>) -> Self
pub fn environment(self, env: impl Into<String>) -> Self
Set the environment (e.g., “production”, “staging”, “development”)
Sourcepub fn environment_from_env(self) -> Self
pub fn environment_from_env(self) -> Self
Read environment from ENVIRONMENT or ENV env var
Sourcepub fn otlp_endpoint(self, endpoint: impl Into<String>) -> Self
pub fn otlp_endpoint(self, endpoint: impl Into<String>) -> Self
Set the OTLP endpoint for exporting traces
Sourcepub fn otlp_endpoint_from_env(self) -> Self
pub fn otlp_endpoint_from_env(self) -> Self
Read OTLP endpoint from OTEL_EXPORTER_OTLP_ENDPOINT env var
Sourcepub fn json_logging(self) -> Self
pub fn json_logging(self) -> Self
Enable JSON-formatted log output (for production)
Sourcepub fn log_level(self, level: impl Into<String>) -> Self
pub fn log_level(self, level: impl Into<String>) -> Self
Set the log level (trace, debug, info, warn, error)
Sourcepub fn log_level_from_env(self) -> Self
pub fn log_level_from_env(self) -> Self
Read log level from RUST_LOG env var
Sourcepub fn build(self) -> Result<ObservabilityGuard, ObservabilityError>
pub fn build(self) -> Result<ObservabilityGuard, ObservabilityError>
Build without OTLP - just tracing subscriber
Auto Trait Implementations§
impl Freeze for ObservabilityBuilder
impl RefUnwindSafe for ObservabilityBuilder
impl Send for ObservabilityBuilder
impl Sync for ObservabilityBuilder
impl Unpin for ObservabilityBuilder
impl UnwindSafe for ObservabilityBuilder
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
Mutably borrows from an owned value. Read more