Skip to main content

Trace

Struct Trace 

Source
#[non_exhaustive]
pub struct Trace { pub incidents: Vec<Incident>, pub dropped_incidents: u64, pub schema_version: u32, pub progress: Option<Snapshot>, pub metadata: Vec<(String, String)>, pub spans: Vec<SpanRecord>, pub dropped_spans: u64, pub active_spans: usize, pub cancelled_at: Option<Duration>, pub observed_at: Option<Duration>, pub returned_at: Option<Duration>, }
Expand description

A finished run’s spans, optionally with its progress tree attached.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§incidents: Vec<Incident>

Bounded reporting-protocol incidents, independent from work outcomes.

§dropped_incidents: u64

Incidents omitted because their separate retention budget was exhausted.

§schema_version: u32

Version of the JSON format.

§progress: Option<Snapshot>

The progress tree, attached with with_progress.

§metadata: Vec<(String, String)>

Key/value pairs from Profiler::metadata.

§spans: Vec<SpanRecord>

Retained finished spans, in the order they finished.

§dropped_spans: u64

Finished spans beyond the profiler’s capacity.

§active_spans: usize

Spans still running when the trace was taken.

§cancelled_at: Option<Duration>

When cancellation was requested, if recorded.

§observed_at: Option<Duration>

When an instrumented check first returned a stop error.

§returned_at: Option<Duration>

When the operation returned, if recorded.

Implementations§

Source§

impl Trace

Source

pub fn diagnose(&self, options: &Options) -> Vec<Finding>

Analyze the retained spans and the attached progress tree, if any.

Rates are per span’s wall time, not exact intervals at one line. Report gaps need Profiler::set_report_timing on while recording. Callback findings need callback spans, which Profiler::measure_callback records around each callback.

Source§

impl Trace

Source

pub fn with_progress(self, progress: Snapshot) -> Self

Attach the progress tree, usually a final snapshot taken after every worker joined.

Source

pub fn overlap(&self, ids: &[SpanId]) -> Option<Overlap>

Measure how the given work spans overlapped.

Returns None for an empty, missing or repeated ID, a span that is not Work, a span with clock regressions, or a span together with one of its ancestors (which would count time twice).

Source

pub fn cancellation_observation_latency(&self) -> Option<Duration>

Time from the cancellation request to the first check that saw it.

Source

pub fn cancellation_return_latency(&self) -> Option<Duration>

Time from the cancellation request to the operation’s return, including stragglers, joins, and cleanup.

Source

pub fn write_json(&self, out: &mut impl Write) -> Result

Write the trace as JSON.

Times are nanoseconds since the clock’s epoch, written as decimal strings so 64-bit values survive JavaScript. Labels are escaped. Later versions may add keys; readers should ignore keys they do not know.

Trait Implementations§

Source§

impl Clone for Trace

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Trace

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for Trace

Source§

fn fmt(&self, out: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Trace

§

impl RefUnwindSafe for Trace

§

impl Send for Trace

§

impl Sync for Trace

§

impl Unpin for Trace

§

impl UnsafeUnpin for Trace

§

impl UnwindSafe for Trace

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.