1
- use opentelemetry:: trace:: SpanId ;
2
1
use opentelemetry_proto:: tonic:: trace:: v1:: { ResourceSpans , Span , TracesData } ;
3
2
use std:: collections:: { HashMap , HashSet } ;
4
3
use std:: fmt:: { Debug , Formatter } ;
@@ -53,7 +52,6 @@ impl TraceAsserter {
53
52
54
53
let results_span_forest = SpanForest :: from_spans ( results_spans) ;
55
54
let expected_span_forest = SpanForest :: from_spans ( expected_spans) ;
56
- results_span_forest. print_tree ( ) ;
57
55
assert_eq ! ( results_span_forest, expected_span_forest) ;
58
56
}
59
57
}
@@ -144,12 +142,6 @@ impl SpanForest {
144
142
} )
145
143
. collect ( )
146
144
}
147
-
148
- fn print_tree ( & self ) {
149
- for ( _, root_span) in self . get_root_spans ( ) . iter ( ) . enumerate ( ) {
150
- root_span. draw_tree ( "" . to_string ( ) , root_span. children . is_empty ( ) ) ;
151
- }
152
- }
153
145
}
154
146
155
147
impl PartialEq for SpanForest {
@@ -184,28 +176,6 @@ impl SpanTreeNode {
184
176
fn add_child ( & mut self , child : Span ) {
185
177
self . children . push ( SpanTreeNode :: new ( child) ) ;
186
178
}
187
-
188
- fn draw_tree ( & self , prefix : String , last : bool ) {
189
- println ! (
190
- "{}{}{}" ,
191
- prefix,
192
- if last { "└─ " } else { "├─ " } ,
193
- self . span. name,
194
- ) ;
195
- let new_prefix = format ! ( "{}{}" , prefix, if last { " " } else { "│ " } ) ;
196
- let children_count = self . children . len ( ) ;
197
- for ( i, child) in self . children . iter ( ) . enumerate ( ) {
198
- child. draw_tree ( new_prefix. clone ( ) , i == children_count - 1 ) ;
199
- }
200
- }
201
- }
202
-
203
- fn vec_to_u64 ( vec : Vec < u8 > ) -> Option < u64 > {
204
- if vec. len ( ) != 8 {
205
- return None ;
206
- }
207
- let array: [ u8 ; 8 ] = vec. try_into ( ) . ok ( ) ?;
208
- Some ( u64:: from_le_bytes ( array) )
209
179
}
210
180
211
181
impl PartialEq for SpanTreeNode {
@@ -248,4 +218,4 @@ pub fn read_spans_from_json(file: File) -> Vec<ResourceSpans> {
248
218
249
219
let trace_data: TracesData = serde_json:: from_reader ( reader) . unwrap ( ) ;
250
220
trace_data. resource_spans
251
- }
221
+ }
0 commit comments