Skip to content

Commit

Permalink
Simplify TraceParent constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
aqrln committed Sep 26, 2024
1 parent 7162560 commit 4a7d9d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions libs/telemetry/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,11 @@ pub struct TraceParent {
}

impl TraceParent {
pub fn new_unsafe(trace_id: TraceId, span_id: SpanId, sampled: bool) -> Self {
pub fn new_unsafe(trace_id: TraceId, span_id: SpanId, flags: TraceFlags) -> Self {
Self {
trace_id,
span_id,
flags: if sampled {
TraceFlags::SAMPLED
} else {
TraceFlags::default()
},
flags,
}
}

Expand Down
4 changes: 2 additions & 2 deletions query-engine/core/src/interactive_transactions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use derive_more::Display;
use opentelemetry::trace::{SpanId, TraceId};
use opentelemetry::trace::{SpanId, TraceFlags, TraceId};
use serde::Deserialize;

use telemetry::helpers::TraceParent;
Expand Down Expand Up @@ -51,7 +51,7 @@ impl TxId {
/// emitted. Same transaction id is guaranteed to have traceparent with the same trace_id and
/// span_id.
pub fn as_traceparent(&self) -> TraceParent {
TraceParent::new_unsafe(self.as_trace_id(), self.as_span_id(), false)
TraceParent::new_unsafe(self.as_trace_id(), self.as_span_id(), TraceFlags::default())
}
}

Expand Down

0 comments on commit 4a7d9d4

Please sign in to comment.