Skip to main content

RuntimeObservationSession

Struct RuntimeObservationSession 

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

Owner-only capability for one query observation lifetime.

This type is intentionally not Clone. Cloneable execution contexts and workers receive only RuntimeObservationHandle, which cannot seal.

Implementations§

Source§

impl RuntimeObservationSession

Source

pub fn new( query_id: impl Into<QueryId>, trace_id: Option<TraceId>, config: RuntimeObservationConfig, ) -> Self

Creates an owner and recording handle using a system monotonic clock.

Source

pub fn with_clock( query_id: impl Into<QueryId>, trace_id: Option<TraceId>, config: RuntimeObservationConfig, clock: Arc<dyn RuntimeObservationClock>, ) -> Self

Creates an owner and recording handle using an injected clock.

Source

pub const fn disabled() -> Self

Creates a disabled owner and handle.

Source

pub fn handle(&self) -> RuntimeObservationHandle

Returns a cloneable recording capability without seal authority.

Source

pub const fn config(&self) -> RuntimeObservationConfig

Returns the immutable recorder configuration.

Source

pub fn query_id(&self) -> Option<&QueryId>

Returns the immutable query identity when recording is enabled.

Source

pub fn trace_id(&self) -> Option<&TraceId>

Returns the immutable optional parent trace identity.

Source

pub fn record<F>(&self, build_payload: F) -> RuntimeObservationRecordDisposition

Lazily constructs and records a query-level event.

Source

pub fn record_for_plan<F>( &self, plan_execution_id: PlanExecutionId, build_payload: F, ) -> RuntimeObservationRecordDisposition

Lazily constructs and records an event for one plan execution.

Source

pub fn record_with_context<F>( &self, context: RuntimeEventContext, build_payload: F, ) -> RuntimeObservationRecordDisposition

Lazily constructs an event before acquiring recorder order and records it infallibly.

Source

pub fn record_topology<F>( &self, class: RuntimeObservationRecordClass, build_record: F, ) -> RuntimeObservationRecordDisposition

Lazily constructs and records one static topology row.

Source

pub fn live_snapshot(&self) -> Option<LiveRuntimeObservationSnapshot>

Captures an immutable incomplete view. Returns none after sealing or when disabled.

Source

pub fn seal( &self, outcome: RuntimeTerminalOutcome, ) -> Option<SealedRuntimeObservationSnapshot>

Fixes the first terminal outcome and returns the same immutable snapshot to every later or concurrent seal.

Source

pub fn sealed_snapshot(&self) -> Option<SealedRuntimeObservationSnapshot>

Returns the sealed immutable snapshot when a terminal outcome was already fixed.

Trait Implementations§

Source§

impl Debug for RuntimeObservationSession

Source§

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

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

impl Default for RuntimeObservationSession

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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> 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> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
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> Same for T

Source§

type Output = T

Should always be Self
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