pub struct TaskOutput<T> {
pub value: T,
pub metrics: Vec<(String, f64)>,
}Expand description
The output of firing a task, including named metrics for pattern detection.
Fields§
§value: TThe primary output value.
metrics: Vec<(String, f64)>Named metrics extracted during firing, used by pattern detectors.
Implementations§
Source§impl<T> TaskOutput<T>
impl<T> TaskOutput<T>
Sourcepub fn new(value: T, metrics: Vec<(String, f64)>) -> Self
pub fn new(value: T, metrics: Vec<(String, f64)>) -> Self
Create a new task output with a value and metrics.
Examples found in repository?
More examples
examples/event_stream_processor.rs (lines 32-48)
31 fn fire(&self) -> TaskOutput<Self::Output> {
32 TaskOutput::new(
33 self.processing_time_ms,
34 vec![
35 ("processing_time_ms".into(), self.processing_time_ms),
36 ("throughput".into(), self.throughput),
37 ("memory_mb".into(), self.memory_mb),
38 ("error_rate".into(), self.error_rate),
39 ("records_in".into(), self.records_in),
40 ("records_out".into(), self.records_out),
41 ("cpu_temp_c".into(), self.cpu_temp_c),
42 ("latency_p99_ms".into(), self.latency_p99_ms),
43 ("consumer_lag".into(), self.consumer_lag),
44 ("gc_pause_ms".into(), self.gc_pause_ms),
45 ("event_id".into(), self.event_id as f64),
46 ("batch_id".into(), self.batch_id as f64),
47 ],
48 )
49 }Sourcepub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
pub fn with_metric(self, name: impl Into<String>, value: f64) -> Self
Add a named metric.
Trait Implementations§
Source§impl<T: Clone> Clone for TaskOutput<T>
impl<T: Clone> Clone for TaskOutput<T>
Source§fn clone(&self) -> TaskOutput<T>
fn clone(&self) -> TaskOutput<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for TaskOutput<T>where
T: Freeze,
impl<T> RefUnwindSafe for TaskOutput<T>where
T: RefUnwindSafe,
impl<T> Send for TaskOutput<T>where
T: Send,
impl<T> Sync for TaskOutput<T>where
T: Sync,
impl<T> Unpin for TaskOutput<T>where
T: Unpin,
impl<T> UnsafeUnpin for TaskOutput<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for TaskOutput<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more