Skip to content

Commit eb60b26

Browse files
committed
Rename TraceContext random constructor
1 parent 9927ecc commit eb60b26

File tree

2 files changed

+6
-6
lines changed
  • relay-event-normalization/src
  • relay-event-schema/src/protocol/contexts

2 files changed

+6
-6
lines changed

relay-event-normalization/src/event.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,10 +1331,10 @@ fn normalize_contexts(
13311331
contexts.0.remove("reprocessing");
13321332

13331333
// We need a TraceId to ingest the event into EAP.
1334-
// If the event lacks a TraceContext, add a random one.
1334+
// If the event lacks a TraceContext, derive one from the event id.
13351335

13361336
if config.derive_trace_id && !contexts.contains::<TraceContext>() {
1337-
contexts.add(TraceContext::random(event_id))
1337+
contexts.add(TraceContext::from_event_id(event_id))
13381338
}
13391339

13401340
for annotated in &mut contexts.0.values_mut() {

relay-event-schema/src/protocol/contexts/trace.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,9 @@ pub struct TraceContext {
332332
}
333333

334334
impl TraceContext {
335-
/// Generates a random [`SpanId`] and takes `[TraceId]` from the event's UUID.
335+
/// Generates a random [`SpanId`] and derives [`TraceId`] from the event's UUID.
336336
/// Leaves all other fields blank.
337-
pub fn random(event_id: Uuid) -> Self {
337+
pub fn from_event_id(event_id: Uuid) -> Self {
338338
let mut trace_meta = Meta::default();
339339
trace_meta.add_remark(Remark::new(RemarkType::Substituted, "trace_id.missing"));
340340

@@ -641,8 +641,8 @@ mod tests {
641641
}
642642

643643
#[test]
644-
fn test_random_trace_context() {
645-
let rand_context = TraceContext::random(Uuid::new_v4());
644+
fn test_trace_context_from_event_id() {
645+
let rand_context = TraceContext::from_event_id(Uuid::new_v4());
646646
assert!(rand_context.trace_id.value().is_some());
647647
assert_eq!(
648648
rand_context

0 commit comments

Comments
 (0)