From bff7b0cf098a3873a0383849e7162adec02ace94 Mon Sep 17 00:00:00 2001 From: Simon Oehrl Date: Tue, 12 Nov 2024 16:30:37 +0100 Subject: [PATCH 1/2] fix(parser): parsing of span exit record --- tracing-tape-parser/src/lib.rs | 6 ++---- tracing-tape/src/record/span.rs | 6 +++--- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tracing-tape-parser/src/lib.rs b/tracing-tape-parser/src/lib.rs index 872b0b3..3b3d672 100644 --- a/tracing-tape-parser/src/lib.rs +++ b/tracing-tape-parser/src/lib.rs @@ -9,9 +9,7 @@ use smallvec::SmallVec; use tracing_tape::{ intro::Intro, record::{ - field_type, record_kind, CallsiteFieldRecord, CallsiteRecord, EventRecord, - EventValueRecord, RecordHeader, SpanCloseRecord, SpanEnterRecord, SpanOpenRecord, - SpanValueRecord, + field_type, record_kind, CallsiteFieldRecord, CallsiteRecord, EventRecord, EventValueRecord, RecordHeader, SpanCloseRecord, SpanEnterRecord, SpanExitRecord, SpanOpenRecord, SpanValueRecord }, }; use zerocopy::FromBytes; @@ -243,7 +241,7 @@ impl Intermediate { } fn exit_span<'a>(&mut self, slice: &'a [u8]) -> &'a [u8] { - let span_exit_record = SpanEnterRecord::ref_from_prefix(slice).unwrap(); + let span_exit_record = SpanExitRecord::ref_from_prefix(slice).unwrap(); let index = self.opened_spans[&span_exit_record.id.get()]; let span = &mut self.span_graph[index]; diff --git a/tracing-tape/src/record/span.rs b/tracing-tape/src/record/span.rs index f8d297e..d4c3955 100644 --- a/tracing-tape/src/record/span.rs +++ b/tracing-tape/src/record/span.rs @@ -74,9 +74,9 @@ impl SpanEnterRecord { #[derive(AsBytes, FromZeroes, FromBytes, Unaligned)] #[repr(C)] pub struct SpanExitRecord { - header: RecordHeader, - id: little_endian::U64, - timestamp: little_endian::I64, + pub header: RecordHeader, + pub id: little_endian::U64, + pub timestamp: little_endian::I64, } impl SpanExitRecord { From 35125362bebd2e2b508322660eb3e3fbcd123870 Mon Sep 17 00:00:00 2001 From: Simon Oehrl Date: Tue, 12 Nov 2024 16:33:30 +0100 Subject: [PATCH 2/2] chore: add parsing fix to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c01873e..a0641fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - This CHANGELOG file that will contain all notable changes to this project ([#2](https://github.com/soehrl/tracing-tape/pull/2/)) +### Fixed +- Parsing of *SpanExit* records ([#3](https://github.com/soehrl/tracing-tape/pull/3/)) + ## [0.1.0] - 2024-11-10