pub struct ObservabilityBuilder { /* private fields */ }Expand description
Builder for configuring and initializing observability.
Implementations§
Source§impl ObservabilityBuilder
impl ObservabilityBuilder
Sourcepub fn new(service_name: impl Into<String>) -> Self
pub fn new(service_name: impl Into<String>) -> Self
Creates a new builder with the given service name.
Sourcepub fn service_name(self, service_name: impl Into<String>) -> Self
pub fn service_name(self, service_name: impl Into<String>) -> Self
Overrides the service name.
Sourcepub fn with_attributes(self, attributes: Vec<KeyValue>) -> Self
pub fn with_attributes(self, attributes: Vec<KeyValue>) -> Self
Sets additional resource attributes, replacing any previously set.
Sourcepub fn with_attributes_iter<I>(self, attributes: I) -> Selfwhere
I: IntoIterator<Item = KeyValue>,
pub fn with_attributes_iter<I>(self, attributes: I) -> Selfwhere
I: IntoIterator<Item = KeyValue>,
Sets additional resource attributes from an iterator, replacing any previously set.
Sourcepub fn with_attribute<K, V>(self, key: K, value: V) -> Self
pub fn with_attribute<K, V>(self, key: K, value: V) -> Self
Appends a single resource attribute.
Sourcepub fn with_metrics_callback<F>(self, callback: F) -> Self
pub fn with_metrics_callback<F>(self, callback: F) -> Self
Registers a callback to run after the meter provider is initialized.
Sourcepub fn with_file_logging(self, config: FileLoggingConfig) -> Self
pub fn with_file_logging(self, config: FileLoggingConfig) -> Self
Enables file logging with the given configuration.
Sourcepub fn with_structured_stdout_logging(self) -> Self
pub fn with_structured_stdout_logging(self) -> Self
Enables structured JSON output to stdout.
Sourcepub fn init(self) -> Result<OtelGuard, OtelInitError>
pub fn init(self) -> Result<OtelGuard, OtelInitError>
Initializes all configured observability providers and returns a guard.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for ObservabilityBuilder
impl !UnwindSafe for ObservabilityBuilder
impl Forget for ObservabilityBuilder
impl Freeze for ObservabilityBuilderwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<KeyValue>: Freeze,
PhantomData<Box<dyn Fn(&MetricsInitContext) -> Result<(), MetricsInitError> + Sync + Send>>: Freeze,
impl Move for ObservabilityBuilder
impl Send for ObservabilityBuilder
impl Sync for ObservabilityBuilder
impl Unpin for ObservabilityBuilder
impl UnsafeUnpin for ObservabilityBuilderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<KeyValue>: UnsafeUnpin,
PhantomData<Box<dyn Fn(&MetricsInitContext) -> Result<(), MetricsInitError> + Sync + Send>>: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request