pub struct DurationsLayerBuilder { /* private fields */ }Implementations§
Source§impl DurationsLayerBuilder
impl DurationsLayerBuilder
Sourcepub fn build<S>(self) -> Result<(DurationsLayer<S>, DurationsLayerDropGuard)>
pub fn build<S>(self) -> Result<(DurationsLayer<S>, DurationsLayerDropGuard)>
This function needs to be called on the (tokio) main thread for accurate reporting.
Sourcepub fn with_fields(self, enabled: bool) -> Self
pub fn with_fields(self, enabled: bool) -> Self
Whether to record the fields passed to the span (default: true).
§Example
Span:
info_span!("make_request", host = "example.org", object = 10);With true:
{"id":4,"start":{"secs":0,"nanos":446},"end":{"secs":0,"nanos":448},"name":"make_request","parents":[1,3],"fields":{"host":"example.org","object":"10"}}With false:
{"id":4,"start":{"secs":0,"nanos":446},"end":{"secs":0,"nanos":448},"name":"make_request","parents":[1,3]}Sourcepub fn with_parents(self, enabled: bool) -> Self
pub fn with_parents(self, enabled: bool) -> Self
Whether to record the ids of the parent spans (default: true).
§Example
Span:
info_span!("make_request", host = "example.org", object = 10);With true:
{"id":4,"start":{"secs":0,"nanos":446},"end":{"secs":0,"nanos":448},"name":"make_request","parents":[1,3],"fields":{"host":"example.org","object":"10"}}With false:
{"id":4,"start":{"secs":0,"nanos":446},"end":{"secs":0,"nanos":448},"name":"make_request","fields":{"host":"example.org","object":"10"}}Sourcepub fn durations_file(self, file: impl Into<PathBuf>) -> Self
pub fn durations_file(self, file: impl Into<PathBuf>) -> Self
Record all span active durations as ndjson.
Example output line, see module level documentation for more details.
{"id":6,"name":"read_cache","start":{"secs":0,"nanos":122457871},"end":{"secs":0,"nanos":122463135},"parents":[3,4],"fields":{"id":"2"}}The file is flushed when DurationsLayerDropGuard is dropped.
Sourcepub fn plot_file(self, file: impl Into<PathBuf>) -> Self
pub fn plot_file(self, file: impl Into<PathBuf>) -> Self
Plot the result and save them as svg.
TODO(konstin): Figure out how to embed an svg in rustdoc.
The file is written when DurationsLayerDropGuard is dropped.
pub fn plot_config(self, plot_config: PlotConfig) -> Self
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DurationsLayerBuilder
impl RefUnwindSafe for DurationsLayerBuilder
impl Send for DurationsLayerBuilder
impl Sync for DurationsLayerBuilder
impl Unpin for DurationsLayerBuilder
impl UnwindSafe for DurationsLayerBuilder
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more