Documentation Index
Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Span
Defined in the trace module.
Rust AI Agent SDK
A span representing a unit of work.
Fields
| Name | Type | Description |
|---|
id | String | Span ID |
parent_id | Option<String> | Parent span ID |
trace_id | String | Trace ID |
name | String | Span name |
kind | SpanKind | Span kind |
status | SpanStatus | Span status |
start_offset | Duration | Start time (as duration since trace start) |
end_offset | Option<Duration> | End time (as duration since trace start) |
duration | Option<Duration> | Duration |
attributes | HashMap<String | Attributes |
serde_json | :Value> | Attributes |
events | Vec<SpanEvent> | Events |
error_message | Option<String> | Error message (if status is Error) |
Methods
new
fn new(
trace_id: impl Into<String>,
name: impl Into<String>,
kind: SpanKind,
start_offset: Duration,
) -> Self
Create a new span.
Parameters:
| Name | Type |
|---|
trace_id | impl Into<String> |
name | impl Into<String> |
kind | SpanKind |
start_offset | Duration |
with_parent
fn with_parent(mut self, parent_id: impl Into<String>) -> Self
Set parent span.
Parameters:
| Name | Type |
|---|
parent_id | impl Into<String> |
set_attribute
fn set_attribute(&mut self, key: impl Into<String>, value: impl Serialize) -> ()
Add an attribute.
Parameters:
| Name | Type |
|---|
key | impl Into<String> |
value | impl Serialize |
add_event
fn add_event(&mut self, event: SpanEvent) -> ()
Add an event.
Parameters:
end
fn end(&mut self, end_offset: Duration) -> ()
End the span.
Parameters:
| Name | Type |
|---|
end_offset | Duration |
set_error
fn set_error(&mut self, message: impl Into<String>) -> ()
Mark as error.
Parameters:
| Name | Type |
|---|
message | impl Into<String> |
is_ended
fn is_ended(&self) -> bool
Check if span is ended.
Source
View on GitHub
praisonai/src/trace/mod.rs at line 81