Skip to main content

RecorderBuilder

Struct RecorderBuilder 

pub struct RecorderBuilder<M = Disk>
where M: BufferMode,
{ /* private fields */ }
Available on crate feature dial9 only.
Expand description

Builder for a runtime-agnostic Recorder. See recorder.

Implementations§

§

impl<M> RecorderBuilder<M>
where M: BufferMode,

pub fn source(self, source: impl Source + 'static) -> RecorderBuilder<M>

Register a Source drained by the flush thread each cycle.

pub fn source_names(&self) -> impl Iterator<Item = &str>

Names of the registered sources, in registration order.

pub fn writer_boot_id(&self) -> Option<&str>

The writer’s per-process namespace boot id, or None before set_namespace has run.

pub fn segment_metadata( self, entries: impl IntoIterator<Item = (String, String)>, ) -> RecorderBuilder<M>

Static metadata written into every rotated segment header. Merged across calls (and across the tokio layer); on a key collision the later value wins.

§Examples
use dial9_core::buffer::MemoryBuffer;
use dial9_core::recorder::recorder;

let recorder = recorder(MemoryBuffer::new(1024 * 1024)?)
    .segment_metadata([("service".into(), "checkout".into())])
    .segment_metadata([("environment".into(), "production".into())])
    .segment_metadata([("service".into(), "payments".into())])
    .build();

// Metadata is merged across calls. The third call overrides `service`
// from the first, so its value is `payments`.

pub fn metrics_sink(self, sink: BoxEntrySink) -> RecorderBuilder<M>

Metrics sink for the flush (and, with pipeline, worker) threads. Defaults to discarding flush metrics.

pub fn build(self) -> Recorder

Start the recorder and begin recording.

Chain paused beforehand to build without recording, then start it later with Recorder::enable.

Yields a disabled recorder when the writer could not be created (see recorder_or_disabled); the sources and pipeline configured on the way here are never started.

pub fn paused(self) -> RecorderBuilder<M>

Build without recording. Recorder::enable starts it later.

Use for a recorder that should exist but stay quiet until something turns it on; for permanently-off telemetry prefer recorder_disabled, which allocates no writer at all.

§

impl<M> RecorderBuilder<M>
where M: BufferMode,

pub fn pipe( self, processor: impl SegmentProcessor + 'static, ) -> RecorderBuilder<M>

Available on crate feature pipeline only.

Append a segment processor (compress, symbolize, upload, write-back), replacing dial9’s default pipeline with your own stages.

pub fn processors( self, processors: Vec<Box<dyn SegmentProcessor>>, ) -> RecorderBuilder<M>

Available on crate feature pipeline only.

Set the full processor pipeline at once, replacing dial9’s default and anything added with pipe. Use this when you already have a built list, or pipe to append incrementally.

pub fn terminal_processor( self, processor: impl SegmentProcessor + 'static, ) -> RecorderBuilder<M>

Available on crate feature pipeline only.

Replace write-back as the last stage of the default pipeline, so sealed segments are shipped elsewhere instead of written back to disk. This also makes processing meaningful even with no other stage, so the worker still runs.

Ignored when a custom pipeline is set. The S3 uploader is wired up this way.

pub fn worker_poll_interval(self, interval: Duration) -> RecorderBuilder<M>

Available on crate feature pipeline only.

How often the background worker polls for sealed segments.

pub fn trigger(self, trigger: DumpRx) -> RecorderBuilder<M>

Available on crate feature pipeline only.

Trigger receiver switching the worker into on-demand dump mode; see crate::dump. None keeps continuous mode.

pub fn with_dump_trigger<F>(self, configure: F) -> RecorderBuilder<M>
where F: FnOnce(&mut DumpTriggerConfig),

Available on crate feature pipeline only.

Enable on-demand dump mode: the background worker runs the pipeline only when a dump is requested through the DumpTrigger, reachable from any recording thread via Dial9Handle::dump_trigger. Pass |_| {} for the default, or |t| { t.debounce(window); } to coalesce bursts.

Trait Implementations§

§

impl<M> Debug for RecorderBuilder<M>
where M: BufferMode,

§

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

Formats the value using the given formatter. Read more
§

impl<M> RecorderPipelineExt<M> for RecorderBuilder<M>
where M: BufferMode,

§

fn with_custom_pipeline<F>(self, build: F) -> RecorderBuilder<M>

Replace the default pipeline with your own processors, run verbatim. Read more
§

impl<M> RecorderSourceExt for RecorderBuilder<M>
where M: BufferMode,

§

fn source(self, source: impl Source + 'static) -> RecorderBuilder<M>

Register a Source with the underlying recording recorder.
§

fn on_recording_start( self, hook: impl FnOnce(&Dial9Handle) + Send + 'static, ) -> RecorderBuilder<M>

Register a hook run once, with the live Dial9Handle, when the recorder starts recording.
§

fn on_recording_thread_start<F, T>(self, hook: F) -> RecorderBuilder<M>
where F: Fn() -> T + Send + Sync + 'static, T: FnOnce() + Send + 'static,

Register a hook run on each of dial9’s own threads (the flush thread and, with pipeline, the background worker) before it starts, returning a teardown run when it stops. Defaults to a no-op.
§

fn with_custom_events<F>(self, config: CustomEventsConfig, callback: F) -> Self
where F: for<'a> FnMut(&mut CustomEventsContext<'a>) + Send + 'static,

Register a callback that dial9 invokes on the flush thread at the config’s interval to emit custom events. Sugar for source with a CustomEventsSource. Not tokio-coupled — works on the plain recorder and the tokio builder.

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
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

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

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

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
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a rama_grpc::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

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

§

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
§

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
§

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

§

fn rama_from(value: T) -> U

§

impl<T, U, CrateMarker> RamaInto<U, CrateMarker> for T
where U: RamaFrom<T, CrateMarker>,

§

fn rama_into(self) -> U

§

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

§

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

§

fn rama_try_from(value: T) -> Result<U, <U as RamaTryFrom<T>>::Error>

§

impl<T, U, CrateMarker> RamaTryInto<U, CrateMarker> for T
where U: RamaTryFrom<T, CrateMarker>,

§

type Error = <U as RamaTryFrom<T, CrateMarker>>::Error

§

fn rama_try_into(self) -> Result<U, <U as RamaTryFrom<T, CrateMarker>>::Error>

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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, <T as TryFrom<U>>::Error>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<V, F> ValueFormatter<&V> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &&V)

Write value to writer
§

impl<V, F> ValueFormatter<Arc<V>> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Arc<V>)

Write value to writer
§

impl<V, F> ValueFormatter<Box<V>> for F
where F: ValueFormatter<V> + ?Sized, V: ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Box<V>)

Write value to writer
§

impl<V, F> ValueFormatter<Cow<'_, V>> for F
where V: ToOwned + ?Sized, F: ValueFormatter<V> + ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)

Write value to writer
§

impl<V, F> ValueFormatter<Option<V>> for F
where F: ValueFormatter<V> + ?Sized,

§

const SHAPE: FieldShape<'static>

Available on non-metrique_require_explicit_impls only.
The shape of values produced by this formatter. Read more
§

fn format_value(writer: impl ValueWriter, value: &Option<V>)

Write value to writer
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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