Skip to content

Commit c89d5bc

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 db7fd31 commit c89d5bc

File tree

1 file changed

+5
-3
lines changed
  • crates/factor-outbound-http/src

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 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(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,8 +116,10 @@ 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)
120-
.record("http.request.method", method)
122+
span.record("http.request.method", method)
121123
.record("url.full", req.uri.clone());
122124
if let Ok(uri) = req.uri.parse::<http::Uri>() {
123125
if let Some(authority) = uri.authority() {

0 commit comments

Comments
 (0)