pub struct SpanGuard { /* private fields */ }Expand description
RAII guard that ends the span when dropped.
Use builder-style methods to attach data before the span completes.
Implementations§
Source§impl SpanGuard
impl SpanGuard
Sourcepub fn with_tokens(self, usage: SpanTokenUsage) -> Self
pub fn with_tokens(self, usage: SpanTokenUsage) -> Self
Set token usage on this span.
Sourcepub fn with_cost(self, cost: f64) -> Self
pub fn with_cost(self, cost: f64) -> Self
Set cost on this span.
When set, end uses this value verbatim. When left None, cost is
auto-estimated from token usage + gen_ai model at span end (E3).
Sourcepub fn with_gen_ai_request_model(self, model: impl Into<String>) -> Self
pub fn with_gen_ai_request_model(self, model: impl Into<String>) -> Self
Set the gen_ai request model (used for auto cost estimation).
Sourcepub fn with_gen_ai_response_model(self, model: impl Into<String>) -> Self
pub fn with_gen_ai_response_model(self, model: impl Into<String>) -> Self
Set the gen_ai response model (fallback for auto cost estimation).
Sourcepub fn with_metadata(self, key: &str, value: Value) -> Self
pub fn with_metadata(self, key: &str, value: Value) -> Self
Add a metadata key-value pair.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SpanGuard
impl !UnwindSafe for SpanGuard
impl Freeze for SpanGuard
impl Send for SpanGuard
impl Sync for SpanGuard
impl Unpin for SpanGuard
impl UnsafeUnpin for SpanGuard
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