1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#![warn(missing_docs)]
#![cfg_attr(feature = "cargo-clippy", allow(doc_markdown))]
extern crate backtrace;
extern crate rand;
#[macro_use]
extern crate trackable;
pub use error::{Error, ErrorKind};
pub use tracer::Tracer;
pub mod carrier;
pub mod convert;
pub mod log;
pub mod sampler;
pub mod span;
pub mod tag;
mod error;
mod tracer;
pub type Result<T> = std::result::Result<T, Error>;
#[cfg(test)]
mod test {
use sampler::AllSampler;
use super::*;
#[test]
fn it_works() {
let (tracer, span_rx) = Tracer::new(AllSampler);
{
let span = tracer.span("it_works").start_with_context(());
let _child = span.child("child", |options| options.start_with_state(()));
}
let span = span_rx.try_recv().unwrap();
assert_eq!(span.operation_name(), "child");
let span = span_rx.try_recv().unwrap();
assert_eq!(span.operation_name(), "it_works");
}
}