Struct RecorderBuilder
pub struct RecorderBuilder<M = Disk>where
M: BufferMode,{ /* private fields */ }dial9 only.Implementations§
§impl<M> RecorderBuilder<M>where
M: BufferMode,
impl<M> RecorderBuilder<M>where
M: BufferMode,
pub fn source(self, source: impl Source + 'static) -> RecorderBuilder<M>
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>
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>
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>
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>
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
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>
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,
impl<M> RecorderBuilder<M>where
M: BufferMode,
pub fn pipe(
self,
processor: impl SegmentProcessor + 'static,
) -> RecorderBuilder<M>
Available on crate feature pipeline only.
pub fn pipe( self, processor: impl SegmentProcessor + 'static, ) -> RecorderBuilder<M>
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.
pub fn processors( self, processors: Vec<Box<dyn SegmentProcessor>>, ) -> RecorderBuilder<M>
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.
pub fn terminal_processor( self, processor: impl SegmentProcessor + 'static, ) -> RecorderBuilder<M>
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.
pub fn worker_poll_interval(self, interval: Duration) -> RecorderBuilder<M>
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.
pub fn trigger(self, trigger: DumpRx) -> RecorderBuilder<M>
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.
pub fn with_dump_trigger<F>(self, configure: F) -> RecorderBuilder<M>where
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§
§impl<M> Debug for RecorderBuilder<M>where
M: BufferMode,
impl<M> Debug for RecorderBuilder<M>where
M: BufferMode,
§impl<M> RecorderPipelineExt<M> for RecorderBuilder<M>where
M: BufferMode,
impl<M> RecorderPipelineExt<M> for RecorderBuilder<M>where
M: BufferMode,
§fn with_custom_pipeline<F>(self, build: F) -> RecorderBuilder<M>
fn with_custom_pipeline<F>(self, build: F) -> RecorderBuilder<M>
§impl<M> RecorderSourceExt for RecorderBuilder<M>where
M: BufferMode,
impl<M> RecorderSourceExt for RecorderBuilder<M>where
M: BufferMode,
§fn source(self, source: impl Source + 'static) -> RecorderBuilder<M>
fn source(self, source: impl Source + 'static) -> RecorderBuilder<M>
Source with the underlying recording recorder.§fn on_recording_start(
self,
hook: impl FnOnce(&Dial9Handle) + Send + 'static,
) -> RecorderBuilder<M>
fn on_recording_start( self, hook: impl FnOnce(&Dial9Handle) + Send + 'static, ) -> RecorderBuilder<M>
Dial9Handle, when the recorder
starts recording.§fn on_recording_thread_start<F, T>(self, hook: F) -> RecorderBuilder<M>
fn on_recording_thread_start<F, T>(self, hook: F) -> RecorderBuilder<M>
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
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more