pub struct ResourceSpan {Show 13 fields
pub name: String,
pub trace_context: TraceContext,
pub parent_span_id: Option<SpanId>,
pub start_time_unix_us: u64,
pub end_time_unix_us: u64,
pub status: SpanStatus,
pub lease_ids: Vec<u128>,
pub ops: Vec<(OpKey, u64)>,
pub bytes_read: u64,
pub bytes_written: u64,
pub lease_cost_byte_secs: u64,
pub lease_acquire_wait_us: u64,
pub attributes: Vec<(String, String)>,
}Expand description
A resource-attributed span carrying grafOS-specific metadata.
Populated automatically by lease API instrumentation hooks and the
#[grafos::instrument] proc macro. Exported to OTel collectors via
the otlp exporter (requires otlp feature).
Fields§
§name: StringHuman-readable name for this span (usually the function name).
trace_context: TraceContextTrace context (trace_id + span_id + flags).
parent_span_id: Option<SpanId>Parent span ID (if this span has a parent in the same service).
start_time_unix_us: u64Start time as Unix microseconds.
end_time_unix_us: u64End time as Unix microseconds.
status: SpanStatusCompletion status.
lease_ids: Vec<u128>Lease IDs touched during this span.
ops: Vec<(OpKey, u64)>Operation counts by (resource_type, op_type).
bytes_read: u64Total bytes read across all lease operations in this span.
bytes_written: u64Total bytes written across all lease operations in this span.
lease_cost_byte_secs: u64Sum of (leased_bytes * seconds_held) for all leases in this span.
lease_acquire_wait_us: u64Time spent waiting for lease acquisition, in microseconds.
attributes: Vec<(String, String)>User-defined key-value attributes.
Implementations§
Source§impl ResourceSpan
impl ResourceSpan
Sourcepub fn new(name: &str, trace_context: TraceContext) -> Self
pub fn new(name: &str, trace_context: TraceContext) -> Self
Create a new span with the given name and trace context.
Sourcepub fn duration_us(&self) -> u64
pub fn duration_us(&self) -> u64
Duration in microseconds.
Sourcepub fn record_op(
&mut self,
resource_type: ResourceType,
op_type: OpType,
count: u64,
)
pub fn record_op( &mut self, resource_type: ResourceType, op_type: OpType, count: u64, )
Record an operation.
Sourcepub fn op_count(&self, resource_type: ResourceType, op_type: OpType) -> u64
pub fn op_count(&self, resource_type: ResourceType, op_type: OpType) -> u64
Get the operation count for a specific (resource_type, op_type) pair.
Sourcepub fn add_lease_id(&mut self, lease_id: u128)
pub fn add_lease_id(&mut self, lease_id: u128)
Add a lease ID to the span’s lease list.
Sourcepub fn set_attribute(&mut self, key: &str, value: &str)
pub fn set_attribute(&mut self, key: &str, value: &str)
Add a user-defined attribute.
Trait Implementations§
Source§impl Clone for ResourceSpan
impl Clone for ResourceSpan
Source§fn clone(&self) -> ResourceSpan
fn clone(&self) -> ResourceSpan
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more