pub struct SdkLayer { /* private fields */ }
Expand description
A layer to be used with tracing-subscriber
that forwards collected spans
to the Perfetto SDK via the C++ API.
Implementations§
Source§impl SdkLayer
impl SdkLayer
Sourcepub fn from_config(
config: TraceConfig,
output_file: Option<File>,
) -> Builder<'static>
pub fn from_config( config: TraceConfig, output_file: Option<File>, ) -> Builder<'static>
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 output file. If no
file is specified, it is probably only useful to run in system mode, so
that the traces are sent to the traced
daemon instead (else they would
just get lost).
Sourcepub fn from_config_bytes(
config_bytes: &[u8],
output_file: Option<File>,
) -> Builder<'_>
pub fn from_config_bytes( config_bytes: &[u8], output_file: Option<File>, ) -> Builder<'_>
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 output file. If no
file is specified, it is probably only useful to run in system mode, so
that the traces are sent to the traced
daemon instead (else they would
just get lost).
Trait Implementations§
Source§impl<S> Layer<S> for SdkLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
impl<S> Layer<S> for SdkLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
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