pub struct TracingBuilder {
pub(crate) progess_bar: bool,
pub(crate) service_name: Option<&'static str>,
}
Fields§
§progess_bar: bool
§service_name: Option<&'static str>
Implementations§
source§impl TracingBuilder
impl TracingBuilder
sourcepub fn enable_otlp(self, service_name: &'static str) -> TracingBuilder
pub fn enable_otlp(self, service_name: &'static str) -> TracingBuilder
Enable otlp by setting a custom service_name
sourcepub fn enable_progressbar(self) -> TracingBuilder
pub fn enable_progressbar(self) -> TracingBuilder
Enable progress bar layer, default is disabled
sourcepub fn build(self) -> Result<TracingHandle, Error>
pub fn build(self) -> Result<TracingHandle, Error>
This will setup tracing based on the configuration passed in. It will setup a stderr writer output layer and configure EnvFilter to honor RUST_LOG. The EnvFilter will be applied to all configured layers, also otlp.
It will also configure otlp if the feature is enabled and a service_name was provided. It will then correctly setup a channel which is later used for flushing the provider.
sourcepub fn build_with_additional<L>(
self,
additional_layer: L,
) -> Result<TracingHandle, Error>
pub fn build_with_additional<L>( self, additional_layer: L, ) -> Result<TracingHandle, Error>
Similar to build()
but allows passing in an additional tracing Layer
.
This method is generic over the Layer
to avoid the runtime cost of dynamic dispatch.
While it only allows passing a single Layer
, it can be composed of multiple ones:
ⓘ
build_with_additional(
fmt::layer()
.and_then(some_other_layer)
.and_then(yet_another_layer)
.with_filter(my_filter)
)
Trait Implementations§
source§impl Default for TracingBuilder
impl Default for TracingBuilder
source§fn default() -> TracingBuilder
fn default() -> TracingBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for TracingBuilder
impl RefUnwindSafe for TracingBuilder
impl Send for TracingBuilder
impl Sync for TracingBuilder
impl Unpin for TracingBuilder
impl UnwindSafe for TracingBuilder
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
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