From 24766de96292d2e41a2f46610c33ee8acbee8129 Mon Sep 17 00:00:00 2001 From: AH-dark Date: Tue, 23 Apr 2024 09:53:29 +0800 Subject: [PATCH] fix: wrong span usage --- rust-common/src/bot/utils.rs | 11 +---------- rust-common/src/observability/tracing.rs | 2 +- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/rust-common/src/bot/utils.rs b/rust-common/src/bot/utils.rs index df72781..4926b65 100644 --- a/rust-common/src/bot/utils.rs +++ b/rust-common/src/bot/utils.rs @@ -1,7 +1,6 @@ use std::collections::HashMap; use lapin::types::AMQPValue; -use opentelemetry::trace::{SpanKind, TraceContextExt, Tracer}; use opentelemetry::{global, Context}; pub fn extract_span_from_delivery(delivery: &lapin::message::Delivery) -> Context { @@ -34,13 +33,5 @@ pub fn extract_span_from_delivery(delivery: &lapin::message::Delivery) -> Contex propagator.extract(&trace_data_map) }); - let tracer = global::tracer("pegasus/rust-common/bot/channel"); - let span = tracer - .span_builder("UpdateListener::as_stream") - .with_kind(SpanKind::Consumer) - .start_with_context(&tracer, &parent_cx); - - let cx = parent_cx.with_span(span); - - cx + parent_cx } diff --git a/rust-common/src/observability/tracing.rs b/rust-common/src/observability/tracing.rs index 21f91ad..e1125af 100644 --- a/rust-common/src/observability/tracing.rs +++ b/rust-common/src/observability/tracing.rs @@ -22,7 +22,7 @@ pub fn init_tracer(service_name: &str, settings: &Settings) { .unwrap_or_default(), endpoint: format!( "{}{}", - if tracing_config.exporter.insecure.unwrap_or_default() { + if tracing_config.exporter.insecure.unwrap_or(true) { "http://" } else { "https://"