Skip to content

Commit

Permalink
log debug
Browse files Browse the repository at this point in the history
  • Loading branch information
jjbayer committed Nov 15, 2024
1 parent be740a7 commit ea95b59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion relay-server/src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ pub enum ItemType {
CheckIn,
/// A standalone span.
Span,
/// A standalone OpenTelemetry span.
/// A standalone OpenTelemetry span serialized as JSON.
OtelSpan,
/// An OTLP TracesData container.
OtelTracesData,
Expand Down
20 changes: 14 additions & 6 deletions relay-server/src/services/processor/span.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,20 @@ fn track_invalid(managed_envelope: &mut TypedEnvelope<SpanGroup>, reason: Discar

fn parse_traces_data(item: Item) -> Result<TracesData, DiscardReason> {
match item.content_type() {
Some(&ContentType::Json) => {
serde_json::from_slice(&item.payload()).map_err(|_| DiscardReason::InvalidJson)
}
Some(&ContentType::Protobuf) => {
TracesData::decode(item.payload()).map_err(|_| DiscardReason::InvalidProtobuf)
}
Some(&ContentType::Json) => serde_json::from_slice(&item.payload()).map_err(|e| {
relay_log::debug!(
error = &e as &dyn std::error::Error,
"Failed to parse traces data as JSON"
);
DiscardReason::InvalidJson
}),
Some(&ContentType::Protobuf) => TracesData::decode(item.payload()).map_err(|e| {
relay_log::debug!(
error = &e as &dyn std::error::Error,
"Failed to parse traces data as protobuf"
);
DiscardReason::InvalidProtobuf
}),
_ => Err(DiscardReason::ContentType),
}
}
Expand Down

0 comments on commit ea95b59

Please sign in to comment.