pub struct NativeLayer<W>where
W: for<'w> MakeWriter<'w>,{ /* private fields */ }
Expand description
A layer to be used with tracing-subscriber
that natively writes the
Perfetto trace packets in Rust code, but also polls the Perfetto SDK for
system-level events.
Implementations§
Source§impl<W> NativeLayer<W>
impl<W> NativeLayer<W>
Sourcepub fn from_config(config: TraceConfig, writer: W) -> Builder<'static, W>
pub fn from_config(config: TraceConfig, writer: W) -> Builder<'static, W>
Create a new layer builder from the supplied proto config.
The proto config is usually read from an external source using the
prototext syntax, or else using one of the serde
codecs. The config
will internally be encoded to bytes straight away, so prefer
NativeLayer::from_config_bytes
if you already have the byte
representation.
The built layer will write traces to the supplied writer.
Sourcepub fn from_config_bytes(config_bytes: &[u8], writer: W) -> Builder<'_, W>
pub fn from_config_bytes(config_bytes: &[u8], writer: W) -> Builder<'_, W>
Create a new layer builder from the supplied proto config bytes.
The proto config bytes needs to be an already encoded message of type
schema::TraceConfig
.
The built layer will write traces to the supplied writer.
Trait Implementations§
Source§impl<W> Clone for NativeLayer<W>where
W: for<'w> MakeWriter<'w> + Clone,
impl<W> Clone for NativeLayer<W>where
W: for<'w> MakeWriter<'w> + Clone,
Source§fn clone(&self) -> NativeLayer<W>
fn clone(&self) -> NativeLayer<W>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl<S, W> Layer<S> for NativeLayer<W>
impl<S, W> Layer<S> for NativeLayer<W>
Source§fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Attributes
and Id
.Source§fn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>)
fn on_record(&self, id: &Id, values: &Record<'_>, ctx: Context<'_, S>)
Id
recorded the given
values
.Source§fn on_event(&self, event: &Event<'_>, _ctx: Context<'_, S>)
fn on_event(&self, event: &Event<'_>, _ctx: Context<'_, S>)
Source§fn on_enter(&self, id: &Id, ctx: Context<'_, S>)
fn on_enter(&self, id: &Id, ctx: Context<'_, S>)
Source§fn on_exit(&self, id: &Id, ctx: Context<'_, S>)
fn on_exit(&self, id: &Id, ctx: Context<'_, S>)
Source§fn on_close(&self, id: Id, ctx: Context<'_, S>)
fn on_close(&self, id: Id, ctx: Context<'_, S>)
Source§fn on_register_dispatch(&self, subscriber: &Dispatch)
fn on_register_dispatch(&self, subscriber: &Dispatch)
Subscriber
. Read moreSource§fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest
Subscriber::register_callsite
. Read moreSource§fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
true
if this layer is interested in a span or event with the
given metadata
in the current Context
, similarly to
Subscriber::enabled
. Read moreSource§fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
span
recorded that it
follows from the span with the ID follows
.Source§fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
Source§fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
fn and_then<L>(self, layer: L) -> Layered<L, Self, S>
Layer
, returning a Layered
struct implementing Layer
. Read moreSource§fn with_subscriber(self, inner: S) -> Layered<Self, S>where
Self: Sized,
fn with_subscriber(self, inner: S) -> Layered<Self, S>where
Self: Sized,
Layer
with the given Subscriber
, returning a
Layered
struct that implements Subscriber
. Read more