Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global error handler cleanup - Jaeger Propagator #2250

Merged
merged 4 commits into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 17 additions & 12 deletions opentelemetry-jaeger-propagator/src/propagator.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use opentelemetry::propagation::PropagationError;
use opentelemetry::{
global::{self, Error},
otel_warn,
propagation::{text_map_propagator::FieldIter, Extractor, Injector, TextMapPropagator},
trace::{SpanContext, SpanId, TraceContextExt, TraceError, TraceFlags, TraceId, TraceState},
trace::{SpanContext, SpanId, TraceContextExt, TraceFlags, TraceId, TraceState},
Context,
};
use std::borrow::Cow;
Expand Down Expand Up @@ -82,10 +81,11 @@ impl Propagator {

let parts = header_value.split_terminator(':').collect::<Vec<&str>>();
if parts.len() != 4 {
global::handle_error(Error::Propagation(PropagationError::extract(
"invalid jaeger header format",
"JaegerPropagator",
)));
otel_warn!(
name: "JaegerPropagator.InvalidHeader",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't followed the entire code path, so unclear what is the impact of this Warning. For eg: if an end users see this log entry, what should they be doing?
For all user facing logs, we should be very clear about the impact of this - will a span be dropped? will a span be using different parent ? will a span be created as root span? will we just ignore the header for tracestate and baggage too? or just ignore the traceparent header? something else?

I am not saying this should be fixed in this PR, as these are existing issues, nothing newly introduced in this PR. Since Metrics, Logs are where we are actively working towards Stable, we can probably merge this now, and come back when we start working towards Tracing Stable release?

message = "Invalid jaeger header format",
header_value = header_value.to_string(),
);
return None;
}

Expand All @@ -100,10 +100,11 @@ impl Propagator {
Some(SpanContext::new(trace_id, span_id, flags, true, state))
}
_ => {
global::handle_error(Error::Propagation(PropagationError::extract(
"invalid jaeger header format",
"JaegerPropagator",
)));
otel_warn!(
name: "JaegerPropagator.InvalidHeader",
message = "Invalid jaeger header format",
header_value = header_value.to_string(),
);
None
}
}
Expand Down Expand Up @@ -171,7 +172,11 @@ impl Propagator {
match TraceState::from_key_value(baggage_keys) {
Ok(trace_state) => Ok(trace_state),
Err(trace_state_err) => {
global::handle_error(Error::Trace(TraceError::Other(Box::new(trace_state_err))));
otel_warn!(
name: "JaegerPropagator.InvalidTraceState",
message = "Invalid trace state",
reason = format!("{:?}", trace_state_err),
);
Err(()) //todo: assign an error type instead of using ()
}
}
Expand Down
Loading