pub struct TraceBuilder { /* private fields */ }Expand description
Accumulates trace data during a function execution.
Created at the start of each function call. Each protocol message
updates the builder. When the function completes, finish() produces
the final FnTrace.
Implementations§
Source§impl TraceBuilder
impl TraceBuilder
pub fn new( call_id: String, fn_name: String, fn_type: FnType, user_id: Option<String>, ) -> Self
pub fn new_with_tenant( call_id: String, fn_name: String, fn_type: FnType, user_id: Option<String>, tenant_id: Option<String>, ) -> Self
Sourcepub fn tenant_id(&self) -> Option<&str>
pub fn tenant_id(&self) -> Option<&str>
Tenant at call time. Used by the nested-call path in the runner to carry tenant id down to helper mutations an action invokes.
Sourcepub fn record_op(
&mut self,
op: DbOp,
entity: &str,
id: Option<&str>,
duration: Duration,
row_count: Option<usize>,
ok: bool,
)
pub fn record_op( &mut self, op: DbOp, entity: &str, id: Option<&str>, duration: Duration, row_count: Option<usize>, ok: bool, )
Record a completed DB operation.
Sourcepub fn record_stream_chunk(&mut self, bytes: usize)
pub fn record_stream_chunk(&mut self, bytes: usize)
Record a stream chunk sent to the client.
Sourcepub fn record_schedule(
&mut self,
fn_name: &str,
delay_ms: Option<u64>,
run_at: Option<u64>,
)
pub fn record_schedule( &mut self, fn_name: &str, delay_ms: Option<u64>, run_at: Option<u64>, )
Record a scheduled function.
Sourcepub fn finish_ok(self, value: Option<Value>) -> FnTrace
pub fn finish_ok(self, value: Option<Value>) -> FnTrace
Finalize the trace with a successful outcome.
Sourcepub fn finish_error(self, code: String, message: String) -> FnTrace
pub fn finish_error(self, code: String, message: String) -> FnTrace
Finalize the trace with an error outcome.
Sourcepub fn finish_rolled_back(self, code: String, message: String) -> FnTrace
pub fn finish_rolled_back(self, code: String, message: String) -> FnTrace
Finalize the trace with a rollback outcome.
Auto Trait Implementations§
impl Freeze for TraceBuilder
impl RefUnwindSafe for TraceBuilder
impl Send for TraceBuilder
impl Sync for TraceBuilder
impl Unpin for TraceBuilder
impl UnsafeUnpin for TraceBuilder
impl UnwindSafe for TraceBuilder
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