|
1 | 1 | use crate::models::Properties; |
2 | 2 | use chrono::{DateTime, SecondsFormat, Utc}; |
3 | | -use opentelemetry::{ |
4 | | - sdk::{trace::EvictedHashMap, Resource}, |
5 | | - trace::{SpanId, TraceId}, |
6 | | -}; |
| 3 | +use opentelemetry::sdk::{trace::EvictedHashMap, Resource}; |
7 | 4 | use std::time::{Duration, SystemTime}; |
8 | 5 |
|
9 | | -pub(crate) fn trace_id_to_string(trace_id: TraceId) -> String { |
10 | | - format!("{:032x}", trace_id.to_u128()) |
11 | | -} |
12 | | - |
13 | | -pub(crate) fn span_id_to_string(span_id: SpanId) -> String { |
14 | | - format!("{:016x}", span_id.to_u64()) |
15 | | -} |
16 | | - |
17 | 6 | pub(crate) fn duration_to_string(duration: Duration) -> String { |
18 | 7 | let micros = duration.as_micros(); |
19 | 8 | let s = micros / 1_000_000 % 60; |
@@ -55,20 +44,6 @@ mod tests { |
55 | 44 | use super::*; |
56 | 45 | use test_case::test_case; |
57 | 46 |
|
58 | | - #[test_case(TraceId::invalid(), "00000000000000000000000000000000" ; "zero")] |
59 | | - #[test_case(TraceId::from_u128(314), "0000000000000000000000000000013a" ; "some number")] |
60 | | - #[test_case(TraceId::from_u128(u128::MAX), "ffffffffffffffffffffffffffffffff" ; "max")] |
61 | | - fn trace_id(id: TraceId, expected: &'static str) { |
62 | | - assert_eq!(expected.to_string(), trace_id_to_string(id)); |
63 | | - } |
64 | | - |
65 | | - #[test_case(SpanId::invalid(), "0000000000000000" ; "zero")] |
66 | | - #[test_case(SpanId::from_u64(314), "000000000000013a" ; "some number")] |
67 | | - #[test_case(SpanId::from_u64(u64::MAX), "ffffffffffffffff" ; "max")] |
68 | | - fn span_id(id: SpanId, expected: &'static str) { |
69 | | - assert_eq!(expected.to_string(), span_id_to_string(id)); |
70 | | - } |
71 | | - |
72 | 47 | #[test_case(Duration::from_micros(123456789123), "1.10:17:36.789123" ; "all")] |
73 | 48 | fn duration(duration: Duration, expected: &'static str) { |
74 | 49 | assert_eq!(expected.to_string(), duration_to_string(duration)); |
|
0 commit comments