Skip to content

Commit 609055e

Browse files
rochdevtlhunter
authored andcommitted
add support for adding strings to the string table from an event
1 parent b1bf08a commit 609055e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

collector/src/processing.rs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl Processor {
3939
let event_count = read_array_len(&mut rd).unwrap();
4040

4141
for _ in 0..event_count {
42-
self.process_event(&strings, &mut rd);
42+
self.process_event(&mut strings, &mut rd);
4343
}
4444
}
4545

@@ -51,7 +51,7 @@ impl Processor {
5151
self.exporter.export(finished_traces).await;
5252
}
5353

54-
fn process_event<R: Read>(&mut self, strings: &[String], mut rd: R) {
54+
fn process_event<R: Read>(&mut self, strings: &mut Vec<String>, mut rd: R) {
5555
read_array_len(&mut rd).unwrap();
5656

5757
let event_type = read_u64(&mut rd).unwrap();
@@ -63,10 +63,21 @@ impl Processor {
6363
4 => self.process_start_span(strings, rd),
6464
5 => self.process_finish_span(strings, rd),
6565
6 => self.process_add_tags(strings, rd),
66+
7 => self.process_strings(strings, rd),
6667
_ => ()
6768
}
6869
}
6970

71+
fn process_strings<R: Read>(&mut self, strings: &mut Vec<String>, mut rd: R) {
72+
let size = read_array_len(&mut rd).unwrap();
73+
74+
strings.reserve(size as usize);
75+
76+
for _ in 0..size {
77+
strings.push(read_str(&mut rd));
78+
}
79+
}
80+
7081
fn process_add_error<R: Read>(&mut self, strings: &[String], mut rd: R) {
7182
let size = read_array_len(&mut rd).unwrap();
7283

0 commit comments

Comments
 (0)