Skip to content

Commit 6a013de

Browse files
committed
Don't mark outbound http spans as errors.
We log errors in all the cases that are legit (non-user) related errors and so there's no need to also mark the span as errored. This prevents user related issues (e.g., timeouts) from not being bubbled up to telemetry as errors. Additionally, we stop renaming the span after the http method which isn't very helpful. Signed-off-by: Ryan Levick <[email protected]>
1 parent 92bb6c5 commit 6a013de

File tree

1 file changed

+4
-2
lines changed
  • crates/factor-outbound-http/src

1 file changed

+4
-2
lines changed

crates/factor-outbound-http/src/spin.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ use spin_world::v1::{
33
http as spin_http,
44
http_types::{self, HttpError, Method, Request, Response},
55
};
6-
use tracing::{field::Empty, instrument, Level, Span};
6+
use tracing::{field::Empty, instrument, Span};
77

88
use crate::intercept::InterceptOutcome;
99

1010
impl spin_http::Host for crate::InstanceState {
11-
#[instrument(name = "spin_outbound_http.send_request", skip_all, err(level = Level::INFO),
11+
#[instrument(name = "spin_outbound_http.send_request", skip_all,
1212
fields(otel.kind = "client", url.full = Empty, http.request.method = Empty,
1313
http.response.status_code = Empty, otel.name = Empty, server.address = Empty, server.port = Empty))]
1414
async fn send_request(&mut self, req: Request) -> Result<Response, HttpError> {
@@ -116,6 +116,8 @@ fn record_request_fields(span: &Span, req: &Request) {
116116
Method::Head => "HEAD",
117117
Method::Options => "OPTIONS",
118118
};
119+
// Set otel.name to just the method name to fit with OpenTelemetry conventions
120+
// <https://opentelemetry.io/docs/specs/semconv/http/http-spans/#name>
119121
span.record("otel.name", method)
120122
.record("http.request.method", method)
121123
.record("url.full", req.uri.clone());

0 commit comments

Comments
 (0)