Rust

Crate root

Module
What utopia_span defines at its root.

Modules

Contents

use utopia_span::Span;
Rust
pub struct Span(Arc<Inner>)

One unit of work: an action, attributes, and the error it failed with, if any.

A new span has a random 128-bit trace id (span.trace_id), a random 64-bit span id (span.id), both in lowercase hex, and its start time in seconds since the epoch (span.started_at). A Span is a handle: clones share one span.

Rust
use utopia_span::{Span, Value};

let span = Span::new("db.query");
span.set("db.table", "users").set("db.rows", 3);

assert_eq!(span.action(), "db.query");
assert_eq!(span.get("db.rows"), Value::Int(3));
assert_eq!(span.get("missing"), Value::Null);
assert_eq!(span.get("span.trace_id").as_str().map(str::len), Some(32));
Also implements Debug, PartialEq, Default.
use utopia_span::Error;
Rust
pub enum Error

Why an exporter could not be created.

use utopia_span::Level;
Rust
pub enum Level

The severity of a span, from least to most severe.

Also implements Display.