Skip to main content

Tail

Struct Tail 

Source
pub struct Tail { /* private fields */ }
Expand description

Incremental reader for an append-only StackPulse spool.

Each complete record is decoded once. A record cut off at the visible end of the file is retried after the writer appends the rest of it. Definitions are retained for the life of the reader, while sample storage is bounded and reused between polls.

Implementations§

Source§

impl Tail

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Open a growing spool and decode its current complete prefix.

The writer must flush the spool header before this call.

§Errors

Returns a corrupt-spool error for malformed input, or an I/O category when the file cannot be opened or mapped.

Source

pub fn symbolizer(&self) -> SymbolizerBuilder<'_>

Configure a symbolizer bound to this growing spool.

Call crate::Symbolizer::update with every batch before resolving that batch’s stacks.

Source

pub fn poll(&mut self) -> Result<TailBatch<'_>>

Decode records appended since the previous poll.

The first poll returns samples that were already complete when the tail was opened. Later polls return only newly appended samples.

The returned batch borrows storage owned by this reader. A poll with no appended records performs no allocation once the reader is warm. Call TailBatch::has_more to determine whether another complete batch may already be visible. It does not indicate whether the writer is still active.

§Errors

Returns a corrupt-spool error for malformed appended data. Shrinking the opened file is rejected because tailing supports append only.

Source

pub fn discard_consumed(&mut self) -> Result<()>

Release filesystem blocks occupied by complete records already decoded.

This makes the spool disposable: it remains usable by this tail and its writer, but can no longer be reopened or replayed from the beginning. This is supported by tails created with crate::Recorder::tail; a tail opened with Tail::open holds a read-only file descriptor.

§Errors

Returns an I/O error when the filesystem does not support hole punching or the tail does not hold a writable file descriptor.

Source

pub fn start_timestamp_us(&self) -> Option<u64>

Return the profile timeline anchor in microseconds.

Source

pub fn sample_interval_us(&self) -> Option<u64>

Return the optional sample interval metadata in microseconds.

Trait Implementations§

Source§

impl Debug for Tail

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Tail

§

impl RefUnwindSafe for Tail

§

impl Send for Tail

§

impl Sync for Tail

§

impl Unpin for Tail

§

impl UnsafeUnpin for Tail

§

impl UnwindSafe for Tail

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> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. 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.
Source§

impl<T> WithSubscriber for T

Source§

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
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more