Crates.io | trace-context |
lib.rs | trace-context |
version | 0.1.0 |
source | src |
created_at | 2019-06-02 22:40:57.287347 |
updated_at | 2019-06-02 22:40:57.287347 |
description | Extract and inject W3C TraceContext headers |
homepage | https://github.com/watson/trace-context |
repository | https://github.com/watson/trace-context |
max_upload_size | |
id | 138586 |
size | 21,578 |
Extract and inject W3C TraceContext headers.
cargo add trace-context
let mut headers = http::HeaderMap::new();
headers.insert("traceparent", "00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01".parse().unwrap());
let context = trace_context::TraceContext::extract(&headers).unwrap();
assert_eq!(context.trace_id(), u128::from_str_radix("0af7651916cd43dd8448eb211c80319c", 16).unwrap());
assert_eq!(context.parent_id(), u64::from_str_radix("00f067aa0ba902b7", 16).ok());
assert_eq!(context.sampled(), true);
This crate uses #![deny(unsafe_code)]
to ensure everything is implemented in 100% Safe Rust.
MIT OR Apache-2.0