@@ -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
88use crate :: intercept:: InterceptOutcome ;
99
1010impl 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