Skip to content

Commit bf339fc

Browse files
authored
Merge pull request #3158 from spinframework/no-error-span
Don't mark outbound http spans as errors.
2 parents 92bb6c5 + 6a013de commit bf339fc

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)