pub struct RunBuilder { /* private fields */ }Expand description
Advanced/import API for completed-run artifact assembly.
RunBuilder assembles a finalized Run from already measured evidence.
It validates event shape and timestamp ordering, but does not perform live
request lifecycle tracking.
Elapsed duration fields such as request latency, stage latency, and queue
wait are accepted as authoritative completed evidence. RunBuilder does
not synthesize or repair durations from wall-clock timestamps.
Push methods use first-N retention through the same bounded
retention/truncation helper used by the live collector. Overflow items are
dropped and reflected in Run::truncation.
Implementations§
Source§impl RunBuilder
impl RunBuilder
Sourcepub fn new(options: RunBuilderOptions) -> Result<Self, BuildError>
pub fn new(options: RunBuilderOptions) -> Result<Self, BuildError>
Creates a new completed-run builder from RunBuilderOptions.
§Errors
Returns BuildError::EmptyServiceName when the service name is blank.
Returns BuildError::InvalidRunTimeBounds when finished timestamp is
earlier than start timestamp.
Returns BuildError::InvalidFinalizationTime when finalization
timestamp is earlier than finished timestamp.
Sourcepub fn push_request(
&mut self,
event: RequestEvent,
) -> Result<(), RunBuilderEventError>
pub fn push_request( &mut self, event: RequestEvent, ) -> Result<(), RunBuilderEventError>
Appends a request event.
The event is retained only while request capture-limit capacity remains;
otherwise it is dropped and truncation.dropped_requests is updated.
§Errors
Returns RunBuilderEventError when the event has invalid shape.
Sourcepub fn push_stage(
&mut self,
event: StageEvent,
) -> Result<(), RunBuilderEventError>
pub fn push_stage( &mut self, event: StageEvent, ) -> Result<(), RunBuilderEventError>
Appends a stage event.
The event is retained only while stage capture-limit capacity remains;
otherwise it is dropped and truncation.dropped_stages is updated.
§Errors
Returns RunBuilderEventError when the event has invalid shape.
Sourcepub fn push_queue(
&mut self,
event: QueueEvent,
) -> Result<(), RunBuilderEventError>
pub fn push_queue( &mut self, event: QueueEvent, ) -> Result<(), RunBuilderEventError>
Appends a queue event.
The event is retained only while queue capture-limit capacity remains;
otherwise it is dropped and truncation.dropped_queues is updated.
§Errors
Returns RunBuilderEventError when the event has invalid shape.
Sourcepub fn push_inflight_snapshot(
&mut self,
snapshot: InFlightSnapshot,
) -> Result<(), RunBuilderEventError>
pub fn push_inflight_snapshot( &mut self, snapshot: InFlightSnapshot, ) -> Result<(), RunBuilderEventError>
Appends an in-flight snapshot.
The snapshot is retained only while in-flight snapshot capture-limit
capacity remains; otherwise it is dropped and
truncation.dropped_inflight_snapshots is updated.
§Errors
Returns RunBuilderEventError when the snapshot has invalid shape.
Sourcepub fn push_runtime_snapshot(
&mut self,
snapshot: RuntimeSnapshot,
) -> Result<(), RunBuilderEventError>
pub fn push_runtime_snapshot( &mut self, snapshot: RuntimeSnapshot, ) -> Result<(), RunBuilderEventError>
Appends a runtime snapshot.
The snapshot is retained only while runtime snapshot capture-limit
capacity remains; otherwise it is dropped and
truncation.dropped_runtime_snapshots is updated.
§Errors
Currently returns Ok(()) for all runtime snapshots. The Result
keeps this API consistent with other RunBuilder push methods and
leaves room for future runtime snapshot validation without changing
the method shape.
Sourcepub fn add_lifecycle_warning(&mut self, warning: impl Into<String>)
pub fn add_lifecycle_warning(&mut self, warning: impl Into<String>)
Adds one lifecycle warning string.
Sourcepub fn set_unfinished_requests(&mut self, unfinished: UnfinishedRequests)
pub fn set_unfinished_requests(&mut self, unfinished: UnfinishedRequests)
Sets unfinished-request metadata.
Sourcepub fn set_effective_tokio_sampler_config(
&mut self,
config: EffectiveTokioSamplerConfig,
)
pub fn set_effective_tokio_sampler_config( &mut self, config: EffectiveTokioSamplerConfig, )
Sets effective Tokio sampler configuration metadata.
Sourcepub fn set_run_end_reason_if_absent(&mut self, reason: RunEndReason)
pub fn set_run_end_reason_if_absent(&mut self, reason: RunEndReason)
Sets run-end reason only when absent.