Struct tracing_opentelemetry::OpenTelemetryLayer [−][src]
An OpenTelemetry propagation layer for use in a project that uses tracing.
Implementations
impl<S, T> OpenTelemetryLayer<S, T> where
S: Subscriber + for<'span> LookupSpan<'span>,
T: Tracer + PreSampledTracer + 'static,
[src]
S: Subscriber + for<'span> LookupSpan<'span>,
T: Tracer + PreSampledTracer + 'static,
pub fn new(tracer: T) -> Self
[src]
Set the Tracer
that this layer will use to produce and track
OpenTelemetry Span
s.
Examples
use tracing_opentelemetry::OpenTelemetryLayer; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::Registry; // Create a jaeger exporter pipeline for a `trace_demo` service. let tracer = opentelemetry_jaeger::new_pipeline() .with_service_name("trace_demo") .install_simple() .expect("Error initializing Jaeger exporter"); // Create a layer with the configured tracer let otel_layer = OpenTelemetryLayer::new(tracer); // Use the tracing subscriber `Registry`, or any other subscriber // that impls `LookupSpan` let subscriber = Registry::default().with(otel_layer);
pub fn with_tracer<Tracer>(
self,
tracer: Tracer
) -> OpenTelemetryLayer<S, Tracer> where
Tracer: Tracer + PreSampledTracer + 'static,
[src]
self,
tracer: Tracer
) -> OpenTelemetryLayer<S, Tracer> where
Tracer: Tracer + PreSampledTracer + 'static,
Set the Tracer
that this layer will use to produce and track
OpenTelemetry Span
s.
Examples
use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::Registry; // Create a jaeger exporter pipeline for a `trace_demo` service. let tracer = opentelemetry_jaeger::new_pipeline() .with_service_name("trace_demo") .install_simple() .expect("Error initializing Jaeger exporter"); // Create a layer with the configured tracer let otel_layer = tracing_opentelemetry::layer().with_tracer(tracer); // Use the tracing subscriber `Registry`, or any other subscriber // that impls `LookupSpan` let subscriber = Registry::default().with(otel_layer);
pub fn with_tracked_inactivity(self, tracked_inactivity: bool) -> Self
[src]
Sets whether or not spans metadata should include the busy time (total time for which it was entered), and idle time (total time the span existed but was not entered).
Trait Implementations
impl<S> Default for OpenTelemetryLayer<S, NoopTracer> where
S: Subscriber + for<'span> LookupSpan<'span>,
[src]
S: Subscriber + for<'span> LookupSpan<'span>,
impl<S, T> Layer<S> for OpenTelemetryLayer<S, T> where
S: Subscriber + for<'span> LookupSpan<'span>,
T: Tracer + PreSampledTracer + 'static,
[src]
S: Subscriber + for<'span> LookupSpan<'span>,
T: Tracer + PreSampledTracer + 'static,
fn new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
[src]
Creates an OpenTelemetry Span
for the corresponding tracing Span
.
fn on_enter(&self, id: &Id, ctx: Context<'_, S>)
[src]
fn on_exit(&self, id: &Id, ctx: Context<'_, S>)
[src]
fn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>)
[src]
Record OpenTelemetry attributes
for the given values.
fn on_follows_from(&self, id: &Id, follows: &Id, ctx: Context<'_, S>)
[src]
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
[src]
Records OpenTelemetry Event
data on event.
Note: an ERROR
-level event will also set the OpenTelemetry span status code to
Error
, signaling that an error has occurred.
fn on_close(&self, id: Id, ctx: Context<'_, S>)
[src]
Exports an OpenTelemetry Span
on close.
unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>
[src]
pub fn register_callsite(
&self,
metadata: &'static Metadata<'static>
) -> Interest
[src]
&self,
metadata: &'static Metadata<'static>
) -> Interest
pub fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
[src]
pub fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
[src]
pub fn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
[src]
L: Layer<S>,
pub fn with_subscriber(self, inner: S) -> Layered<Self, S, S>
[src]
Auto Trait Implementations
impl<S, T> RefUnwindSafe for OpenTelemetryLayer<S, T> where
S: RefUnwindSafe,
T: RefUnwindSafe,
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<S, T> Send for OpenTelemetryLayer<S, T> where
S: Send,
T: Send,
S: Send,
T: Send,
impl<S, T> Sync for OpenTelemetryLayer<S, T> where
S: Sync,
T: Sync,
S: Sync,
T: Sync,
impl<S, T> Unpin for OpenTelemetryLayer<S, T> where
S: Unpin,
T: Unpin,
S: Unpin,
T: Unpin,
impl<S, T> UnwindSafe for OpenTelemetryLayer<S, T> where
S: UnwindSafe,
T: UnwindSafe,
S: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> FutureExt for T
[src]
pub fn with_context(self, otel_cx: Context) -> WithContext<Self>
[src]
pub fn with_current_context(self) -> WithContext<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,