Skip to content

Commit df5f244

Browse files
committed
simplify trace_id_and_span_id.map reinitialization
1 parent d15aba9 commit df5f244

File tree

1 file changed

+17
-30
lines changed
  • rust/cubestore/cubestore/src/cluster

1 file changed

+17
-30
lines changed

rust/cubestore/cubestore/src/cluster/mod.rs

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -331,36 +331,23 @@ impl WorkerProcessing for WorkerProcessor {
331331
Ok((schema, records, data_loaded_size))
332332
};
333333

334-
let span = match std::env::var("CUBESTORE_TRACING_TYPE")
335-
.unwrap_or("datadog".to_string())
336-
.to_lowercase()
337-
.as_str()
338-
{
339-
"otel" => trace_id_and_span_id.map(|(t, s)| {
340-
let trace_id = TraceId::from(t);
341-
let span_id = SpanId::from(s);
342-
let span_context = SpanContext::new(
343-
trace_id,
344-
span_id,
345-
TraceFlags::SAMPLED,
346-
true,
347-
Default::default(),
348-
);
349-
350-
let context = OtelContext::new().with_remote_span_context(span_context);
351-
let span = tracing::info_span!("Process on select worker");
352-
353-
span.set_parent(context);
354-
span
355-
}),
356-
_ => trace_id_and_span_id.map(|(t, s)| {
357-
tracing::info_span!(
358-
"Process on select worker",
359-
cube_dd_trace_id = t,
360-
cube_dd_parent_span_id = s
361-
)
362-
}),
363-
};
334+
let span = trace_id_and_span_id.map(|(t, s)| {
335+
let trace_id = TraceId::from(t);
336+
let span_id = SpanId::from(s);
337+
let span_context = SpanContext::new(
338+
trace_id,
339+
span_id,
340+
TraceFlags::SAMPLED,
341+
true,
342+
Default::default(),
343+
);
344+
345+
let context = OtelContext::new().with_remote_span_context(span_context);
346+
let span = tracing::info_span!("Process on select worker");
347+
348+
span.set_parent(context);
349+
span
350+
});
364351

365352
if let Some(span) = span {
366353
future.instrument(span).await

0 commit comments

Comments
 (0)