pub struct RecorderBuilder<M: BufferMode = Disk> { /* private fields */ }Implementations§
Source§impl<M: BufferMode> RecorderBuilder<M>
impl<M: BufferMode> RecorderBuilder<M>
Sourcepub fn source(self, source: impl Source + 'static) -> Self
pub fn source(self, source: impl Source + 'static) -> Self
Register a Source drained by the flush thread each cycle.
Sourcepub fn source_names(&self) -> impl Iterator<Item = &str> + '_
pub fn source_names(&self) -> impl Iterator<Item = &str> + '_
Names of the registered sources, in registration order.
Sourcepub fn writer_boot_id(&self) -> Option<&str>
pub fn writer_boot_id(&self) -> Option<&str>
The writer’s per-process namespace boot id, or None before
set_namespace has run.
Sourcepub fn segment_metadata(
self,
entries: impl IntoIterator<Item = (String, String)>,
) -> Self
pub fn segment_metadata( self, entries: impl IntoIterator<Item = (String, String)>, ) -> Self
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`.Sourcepub fn metrics_sink(self, sink: BoxEntrySink) -> Self
pub fn metrics_sink(self, sink: BoxEntrySink) -> Self
Metrics sink for the flush (and, with pipeline, worker) threads.
Defaults to discarding flush metrics.
Sourcepub fn build(self) -> Recorder
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.
Sourcepub fn paused(self) -> Self
pub fn paused(self) -> Self
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.
Source§impl<M: BufferMode> RecorderBuilder<M>
impl<M: BufferMode> RecorderBuilder<M>
Sourcepub fn pipe(self, processor: impl SegmentProcessor + 'static) -> Self
Available on crate feature pipeline only.
pub fn pipe(self, processor: impl SegmentProcessor + 'static) -> Self
pipeline only.Append a segment processor (compress, symbolize, upload, write-back), replacing dial9’s default pipeline with your own stages.
Sourcepub fn processors(self, processors: Vec<Box<dyn SegmentProcessor>>) -> Self
Available on crate feature pipeline only.
pub fn processors(self, processors: Vec<Box<dyn SegmentProcessor>>) -> Self
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.
Sourcepub fn terminal_processor(
self,
processor: impl SegmentProcessor + 'static,
) -> Self
Available on crate feature pipeline only.
pub fn terminal_processor( self, processor: impl SegmentProcessor + 'static, ) -> Self
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.
Sourcepub fn worker_poll_interval(self, interval: Duration) -> Self
Available on crate feature pipeline only.
pub fn worker_poll_interval(self, interval: Duration) -> Self
pipeline only.How often the background worker polls for sealed segments.
Sourcepub fn trigger(self, trigger: DumpRx) -> Self
Available on crate feature pipeline only.
pub fn trigger(self, trigger: DumpRx) -> Self
pipeline only.Trigger receiver switching the worker into on-demand dump mode; see
crate::dump. None keeps continuous mode.
Sourcepub fn with_dump_trigger<F>(self, configure: F) -> Selfwhere
F: FnOnce(&mut DumpTriggerConfig),
Available on crate feature pipeline only.
pub fn with_dump_trigger<F>(self, configure: F) -> Selfwhere
F: FnOnce(&mut DumpTriggerConfig),
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§
Source§impl<M: BufferMode> Debug for RecorderBuilder<M>
impl<M: BufferMode> Debug for RecorderBuilder<M>
Source§impl<M: BufferMode> RecorderSourceExt for RecorderBuilder<M>
impl<M: BufferMode> RecorderSourceExt for RecorderBuilder<M>
Source§fn source(self, source: impl Source + 'static) -> Self
fn source(self, source: impl Source + 'static) -> Self
Source with the underlying recording recorder.Source§fn on_recording_start(
self,
hook: impl FnOnce(&Dial9Handle) + Send + 'static,
) -> Self
fn on_recording_start( self, hook: impl FnOnce(&Dial9Handle) + Send + 'static, ) -> Self
Dial9Handle, when the recorder
starts recording.Source§fn on_recording_thread_start<F, T>(self, hook: F) -> Self
fn on_recording_thread_start<F, T>(self, hook: F) -> Self
pipeline, the background worker) before it starts, returning a
teardown run when it stops. Defaults to a no-op.Source§fn with_custom_events<F>(self, config: CustomEventsConfig, callback: F) -> Self
fn with_custom_events<F>(self, config: CustomEventsConfig, callback: F) -> Self
source with a
CustomEventsSource. Not
tokio-coupled — works on the plain recorder and the tokio builder.Auto Trait Implementations§
impl<M = Disk> !RefUnwindSafe for RecorderBuilder<M>
impl<M = Disk> !Sync for RecorderBuilder<M>
impl<M = Disk> !UnwindSafe for RecorderBuilder<M>
impl<M> Freeze for RecorderBuilder<M>
impl<M> Send for RecorderBuilder<M>
impl<M> Unpin for RecorderBuilder<M>
impl<M> UnsafeUnpin for RecorderBuilder<M>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writerSource§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writerSource§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writerSource§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writerSource§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer