pub struct Builder<PID, EXP, TIME, THREAD> { /* private fields */ }Expand description
Builder for initializing the telemetry collector.
Uses type-state pattern to ensure all required components are configured at compile time.
Created via build() and finalized with set_global().
Implementations§
Source§impl<PID, EXP, TIME, THREAD> Builder<PID, EXP, TIME, THREAD>
impl<PID, EXP, TIME, THREAD> Builder<PID, EXP, TIME, THREAD>
Sourcepub fn process_id(
self,
process_id: ProcessId,
) -> Builder<WithProcessId, EXP, TIME, THREAD>
pub fn process_id( self, process_id: ProcessId, ) -> Builder<WithProcessId, EXP, TIME, THREAD>
Sets the process id for this collector instance.
Sourcepub fn exporter(
self,
exporter: &'static (dyn Export + Sync),
) -> Builder<PID, WithExporter, TIME, THREAD>
pub fn exporter( self, exporter: &'static (dyn Export + Sync), ) -> Builder<PID, WithExporter, TIME, THREAD>
Sets the exporter for telemetry data.
Sourcepub fn time<T>(self) -> Builder<PID, EXP, WithTime, THREAD>where
T: TimeAbstraction,
pub fn time<T>(self) -> Builder<PID, EXP, WithTime, THREAD>where
T: TimeAbstraction,
Configures the time abstraction to use (monotonic time only).
Sourcepub fn system_time<T>(self) -> Builder<PID, EXP, WithTime, THREAD>where
T: TimeAbstraction + SystemTime,
pub fn system_time<T>(self) -> Builder<PID, EXP, WithTime, THREAD>where
T: TimeAbstraction + SystemTime,
Configures the time abstraction with system time to use (Unix epoch synchronization).
Source§impl<EXP, TIME, THREAD> Builder<NoProcessId, EXP, TIME, THREAD>
impl<EXP, TIME, THREAD> Builder<NoProcessId, EXP, TIME, THREAD>
Sourcepub fn random_process_id(self) -> Builder<WithProcessId, EXP, TIME, THREAD>
pub fn random_process_id(self) -> Builder<WithProcessId, EXP, TIME, THREAD>
Sets a randomly generated process id.
Equivalent to .process_id(ProcessId::random(&mut rand::rng())).
§Examples
use veecle_osal_std::{time::Time, thread::Thread};
use veecle_telemetry::collector;
collector::build()
.random_process_id()
.exporter(exporter)
.time::<Time>()
.thread::<Thread>()
.set_global().unwrap();Source§impl<PID, TIME, THREAD> Builder<PID, NoExporter, TIME, THREAD>
impl<PID, TIME, THREAD> Builder<PID, NoExporter, TIME, THREAD>
Sourcepub fn leaked_exporter(
self,
exporter: impl Export + Sync + 'static,
) -> Builder<PID, WithExporter, TIME, THREAD>
pub fn leaked_exporter( self, exporter: impl Export + Sync + 'static, ) -> Builder<PID, WithExporter, TIME, THREAD>
Sets the given exporter by leaking it to obtain a static reference.
This is a convenience method for dynamic exporters that need to be boxed
and leaked. Equivalent to .exporter(Box::leak(Box::new(exporter))).
§Examples
use veecle_osal_std::{time::Time, thread::Thread};
use veecle_telemetry::collector::TestExporter;
let (exporter, _collected) = TestExporter::new();
veecle_telemetry::collector::build()
.random_process_id()
.leaked_exporter(exporter)
.time::<Time>()
.thread::<Thread>()
.set_global().unwrap();Sourcepub fn console_json_exporter(self) -> Builder<PID, WithExporter, TIME, THREAD>
pub fn console_json_exporter(self) -> Builder<PID, WithExporter, TIME, THREAD>
Sets the exporter to be the ConsoleJsonExporter.
Equivalent to .exporter(&ConsoleJsonExporter::DEFAULT).
§Examples
use veecle_osal_std::{time::Time, thread::Thread};
use veecle_telemetry::collector;
collector::build()
.random_process_id()
.console_json_exporter()
.time::<Time>()
.thread::<Thread>()
.set_global().unwrap();