pub struct ObservabilityBuilder { /* private fields */ }Expand description
Builder for configuring observability (tracing, metrics, logging)
Implementations§
Source§impl ObservabilityBuilder
impl ObservabilityBuilder
Sourcepub fn new(service_name: impl Into<String>) -> ObservabilityBuilder
pub fn new(service_name: impl Into<String>) -> ObservabilityBuilder
Create a new observability builder
Sourcepub fn service_version(self, version: impl Into<String>) -> ObservabilityBuilder
pub fn service_version(self, version: impl Into<String>) -> ObservabilityBuilder
Set the service version
Sourcepub fn environment(self, env: impl Into<String>) -> ObservabilityBuilder
pub fn environment(self, env: impl Into<String>) -> ObservabilityBuilder
Set the environment (e.g., “production”, “staging”, “development”)
Sourcepub fn environment_from_env(self) -> ObservabilityBuilder
pub fn environment_from_env(self) -> ObservabilityBuilder
Read environment from ENVIRONMENT or ENV env var
Sourcepub fn otlp_endpoint(self, endpoint: impl Into<String>) -> ObservabilityBuilder
pub fn otlp_endpoint(self, endpoint: impl Into<String>) -> ObservabilityBuilder
Set the OTLP endpoint for exporting traces
Sourcepub fn otlp_endpoint_from_env(self) -> ObservabilityBuilder
pub fn otlp_endpoint_from_env(self) -> ObservabilityBuilder
Read OTLP endpoint from OTEL_EXPORTER_OTLP_ENDPOINT env var
Sourcepub fn json_logging(self) -> ObservabilityBuilder
pub fn json_logging(self) -> ObservabilityBuilder
Enable JSON-formatted log output (for production)
Sourcepub fn log_level(self, level: impl Into<String>) -> ObservabilityBuilder
pub fn log_level(self, level: impl Into<String>) -> ObservabilityBuilder
Set the log level (trace, debug, info, warn, error)
Sourcepub fn log_level_from_env(self) -> ObservabilityBuilder
pub fn log_level_from_env(self) -> ObservabilityBuilder
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 Forget for ObservabilityBuilder
impl Freeze for ObservabilityBuilder
impl Move for ObservabilityBuilder
impl RefUnwindSafe for ObservabilityBuilder
impl Send for ObservabilityBuilder
impl Sync for ObservabilityBuilder
impl Unpin for ObservabilityBuilder
impl UnsafeUnpin 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