macro_rules! trace {
(
{ $($key:expr => $value:expr),* $(,)? };
$(
$activity:expr $(; { $($keys:expr => $values:expr),* $(,)?})?
),*
) => { ... };
($($content:tt)*) => { ... };
}Expand description
Create a Trace.
A trace is a sequence of events, using the syntax of the event macro.
If an event has no timestamp, it is set 1 hour after the previous event. The
first event uses the unix epoch as the default timestamp.
Trace-level attributes can optionally be provided as the first component of the
macro invocation, using a {key => value, ...} syntax, and separated from the
events with a semicolon.
ยงExamples
use process_mining::{
core::chrono::{DateTime, Utc},
trace
};
let trace_1 = trace!("a", "b", "c", "d");
// Add trace-level attributes
let trace_2 = trace!({"org:resource" => "John"}; "a", "b", "c", "d");
// Add trace and event-level attributes
let trace_3 = trace!(
{"outcome" => "approved"};
"a"; {"time:timestamp" => DateTime::UNIX_EPOCH},
"b"; {"time:timestamp" => Utc::now()},
"c",
"d"; {"approved" => true, "cost" => 2500.00}
);