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§
source§impl 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.
source§impl 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 = _
pub const DEFAULT_PUBLISH_INTERVAL: Duration = _
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 = _
pub const DEFAULT_RETENTION: Duration = _
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
.
sourcepub const DEFAULT_POLL_DURATION_MAX: Duration = _
pub const DEFAULT_POLL_DURATION_MAX: Duration = _
The default maximum value for task poll duration histograms.
Any poll duration exceeding this will be clamped to this value. By default, the maximum poll duration is one second.
See also Builder::poll_duration_histogram_max
.
sourcepub const DEFAULT_SCHEDULED_DURATION_MAX: Duration = _
pub const DEFAULT_SCHEDULED_DURATION_MAX: Duration = _
The default maximum value for the task scheduled duration histogram.
Any scheduled duration (the time from a task being woken until it is next polled) exceeding this will be clamped to this value. By default, the maximum scheduled duration is one second.
Trait Implementations§
source§impl Debug for ConsoleLayer
impl Debug for ConsoleLayer
source§impl<S> Layer<S> for ConsoleLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
impl<S> Layer<S> for ConsoleLayerwhere
S: Subscriber + for<'a> LookupSpan<'a>,
source§fn register_callsite(&self, meta: &'static Metadata<'static>) -> Interest
fn register_callsite(&self, meta: &'static Metadata<'static>) -> Interest
Subscriber::register_callsite
. Read moresource§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_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
fn on_event(&self, event: &Event<'_>, ctx: Context<'_, S>)
source§fn on_enter(&self, id: &Id, cx: Context<'_, S>)
fn on_enter(&self, id: &Id, cx: Context<'_, S>)
source§fn on_exit(&self, id: &Id, cx: Context<'_, S>)
fn on_exit(&self, id: &Id, cx: Context<'_, S>)
source§fn on_close(&self, id: Id, cx: Context<'_, S>)
fn on_close(&self, id: Id, cx: Context<'_, S>)
§fn on_register_dispatch(&self, subscriber: &Dispatch)
fn on_register_dispatch(&self, subscriber: &Dispatch)
Subscriber
. Read more§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 more§fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
fn on_record(&self, _span: &Id, _values: &Record<'_>, _ctx: Context<'_, S>)
Id
recorded the given
values
.§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
.§fn event_enabled(&self, _event: &Event<'_>, _ctx: Context<'_, S>) -> bool
fn event_enabled(&self, _event: &Event<'_>, _ctx: Context<'_, S>) -> bool
on_event
, to determine if on_event
should be called.§fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
fn on_id_change(&self, _old: &Id, _new: &Id, _ctx: Context<'_, S>)
§fn and_then<L>(self, layer: L) -> Layered<L, Self, S>where
L: Layer<S>,
Self: Sized,
fn and_then<L>(self, layer: L) -> Layered<L, Self, S>where
L: Layer<S>,
Self: Sized,
Layer
, returning a Layered
struct implementing Layer
. Read more§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§fn with_filter<F>(self, filter: F) -> Filtered<Self, F, S>where
Self: Sized,
F: Filter<S>,
fn with_filter<F>(self, filter: F) -> Filtered<Self, F, S>where
Self: Sized,
F: Filter<S>,
Auto Trait Implementations§
impl !Freeze for ConsoleLayer
impl !RefUnwindSafe for ConsoleLayer
impl Send for ConsoleLayer
impl Sync for ConsoleLayer
impl Unpin for ConsoleLayer
impl !UnwindSafe for ConsoleLayer
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
T
in a tonic::Request