Struct console_subscriber::ConsoleLayer
source · [−]pub struct ConsoleLayer { /* private fields */ }
Expand description
A ConsoleLayer
is a tracing_subscriber::Layer
that records tracing
spans and events emitted by the async runtime.
Runtimes emit tracing
spans and events that represent specific operations
that occur in asynchronous Rust programs, such as spawning tasks and waker
operations. The ConsoleLayer
collects and aggregates these events, and the
resulting diagnostic data is exported to clients by the corresponding gRPC
Server
instance.
Implementations
sourceimpl ConsoleLayer
impl ConsoleLayer
sourcepub fn new() -> (Self, Server)
pub fn new() -> (Self, Server)
Returns a ConsoleLayer
built with the default settings.
Note: these defaults do not include values provided via the
environment variables specified in Builder::with_default_env
.
See also Builder::build
.
sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Returns a Builder
for configuring a ConsoleLayer
.
Note that the returned builder does not include values provided via
the environment variables specified in Builder::with_default_env
.
To extract those, you can call that method on the returned builder.
sourceimpl ConsoleLayer
impl ConsoleLayer
sourcepub const DEFAULT_EVENT_BUFFER_CAPACITY: usize = 102_400usize
pub const DEFAULT_EVENT_BUFFER_CAPACITY: usize = 102_400usize
Default maximum capacity for the channel of events sent from a
ConsoleLayer
to a Server
.
When this capacity is exhausted, additional events will be dropped. Decreasing this value will reduce memory usage, but may result in events being dropped more frequently.
See also Builder::event_buffer_capacity
.
sourcepub const DEFAULT_CLIENT_BUFFER_CAPACITY: usize = 4_096usize
pub const DEFAULT_CLIENT_BUFFER_CAPACITY: usize = 4_096usize
Default maximum capacity for th echannel of events sent from a
Server
to each subscribed client.
When this capacity is exhausted, the client is assumed to be inactive, and may be disconnected.
See also Builder::client_buffer_capacity
.
sourcepub const DEFAULT_PUBLISH_INTERVAL: Duration = Duration::from_secs(1)
pub const DEFAULT_PUBLISH_INTERVAL: Duration = Duration::from_secs(1)
Default frequency for publishing events to clients.
Note that methods like init
and spawn
will take the value
from the TOKIO_CONSOLE_PUBLISH_INTERVAL
environment variable before falling
back on this default.
See also Builder::publish_interval
.
sourcepub const DEFAULT_RETENTION: Duration = Duration::from_secs(60 * 60)
pub const DEFAULT_RETENTION: Duration = Duration::from_secs(60 * 60)
By default, completed spans are retained for one hour.
Note that methods like init
and
spawn
will take the value from the
TOKIO_CONSOLE_RETENTION
environment variable before falling back on
this default.
See also Builder::retention
.
Trait Implementations
sourceimpl Debug for ConsoleLayer
impl Debug for ConsoleLayer
sourceimpl<S> Layer<S> for ConsoleLayer where
S: Subscriber + for<'a> LookupSpan<'a>,
impl<S> Layer<S> for ConsoleLayer where
S: Subscriber + for<'a> LookupSpan<'a>,
sourcefn register_callsite(&self, meta: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, meta: &'static Metadata<'static>) -> Interest
Registers a new callsite with this layer, returning whether or not
the layer is interested in being notified about the callsite, similarly
to Subscriber::register_callsite
. Read more
sourcefn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
fn on_new_span(&self, attrs: &Attributes<'_>, id: &Id, ctx: Context<'_, S>)
Notifies this layer that a new span was constructed with the given
Attributes
and Id
. Read more
sourcefn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
Notifies this layer that an event has occurred.
sourcefn on_enter(&self, id: &Id, cx: Context<'_, S>)
fn on_enter(&self, id: &Id, cx: Context<'_, S>)
Notifies this layer that a span with the given ID was entered.
sourcefn on_exit(&self, id: &Id, cx: Context<'_, S>)
fn on_exit(&self, id: &Id, cx: Context<'_, S>)
Notifies this layer that the span with the given ID was exited.
sourcefn on_close(&self, id: Id, cx: Context<'_, S>)
fn on_close(&self, id: Id, cx: Context<'_, S>)
Notifies this layer that the span with the given ID has been closed.
sourcefn on_layer(&mut self, subscriber: &mut S)
fn on_layer(&mut self, subscriber: &mut S)
Performs late initialization when attaching a Layer
to a
Subscriber
. Read more
sourcefn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
fn enabled(&self, metadata: &Metadata<'_>, ctx: Context<'_, S>) -> bool
Returns true
if this layer is interested in a span or event with the
given metadata
in the current Context
, similarly to
Subscriber::enabled
. Read more
sourcefn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
Notifies this layer that a span with the given Id
recorded the given
values
. Read more
sourcefn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
fn on_follows_from(&self, _span: &Id, _follows: &Id, _ctx: Context<'_, S>)
Notifies this layer that a span with the ID span
recorded that it
follows from the span with the ID follows
. Read more
sourcefn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
Notifies this layer that a span ID has been cloned, and that the subscriber returned a different ID. Read more
sourcefn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
fn and_then<L>(self, layer: L) -> Layered<L, Self, S> where
L: Layer<S>,
Composes this layer around the given Layer
, returning a Layered
struct implementing Layer
. Read more
sourcefn with_subscriber(self, inner: S) -> Layered<Self, S, S>
fn with_subscriber(self, inner: S) -> Layered<Self, S, S>
Composes this Layer
with the given Subscriber
, returning a
Layered
struct that implements Subscriber
. Read more
sourcefn with_filter<F>(self, filter: F) -> Filtered<Self, F, S> where
F: Filter<S>,
fn with_filter<F>(self, filter: F) -> Filtered<Self, F, S> where
F: Filter<S>,
Auto Trait Implementations
impl !RefUnwindSafe for ConsoleLayer
impl Send for ConsoleLayer
impl Sync for ConsoleLayer
impl Unpin for ConsoleLayer
impl !UnwindSafe for ConsoleLayer
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more