Skip to content

Commit

Permalink
fix: wrong span usage
Browse files Browse the repository at this point in the history
  • Loading branch information
AH-dark committed Apr 23, 2024
1 parent 27db76d commit 24766de
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
11 changes: 1 addition & 10 deletions rust-common/src/bot/utils.rs
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion rust-common/src/observability/tracing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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://"
Expand Down

0 comments on commit 24766de

Please sign in to comment.