Skip to content

Commit

Permalink
Merge pull request #21 from merc1031/128bit-trace-id
Browse files Browse the repository at this point in the history
feat: Change trace_id to u128 to follow spec https://www.w3.org/TR/trace-context/#trace-id
  • Loading branch information
krojew authored May 20, 2024
2 parents eac570a + 2b50f99 commit bd521fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{

#[derive(Copy, Clone)]
struct TraceContext {
pub trace_id: u64,
pub trace_id: u128,
}

struct SpanContext {
Expand Down
6 changes: 4 additions & 2 deletions src/visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ impl ApmVisitor {

#[derive(Default)]
#[repr(transparent)]
pub(crate) struct TraceIdVisitor(pub(crate) Option<u64>);
pub(crate) struct TraceIdVisitor(pub(crate) Option<u128>);

impl Visit for TraceIdVisitor {
fn record_i64(&mut self, _field: &Field, _value: i64) {}

fn record_u64(&mut self, field: &Field, value: u64) {
fn record_u64(&mut self, _field: &Field, _value: u64) {}

fn record_u128(&mut self, field: &Field, value: u128) {
if field.name() == TRACE_ID_FIELD_NAME {
self.0 = Some(value);
}
Expand Down

0 comments on commit bd521fb

Please sign in to comment.