File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
plugins/node/instrumentation-undici/src Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -266,6 +266,9 @@ export class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumenta
266266 const userAgentValues = headersMap . get ( 'user-agent' ) ;
267267
268268 if ( userAgentValues ) {
269+ // NOTE: having multiple user agents is not expected so
270+ // we're going to take last one like `curl` does
271+ // ref: https://curl.se/docs/manpage.html#-A
269272 const userAgent = Array . isArray ( userAgentValues )
270273 ? userAgentValues [ userAgentValues . length - 1 ]
271274 : userAgentValues ;
@@ -367,7 +370,7 @@ export class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumenta
367370 for ( const [ name , value ] of headersMap . entries ( ) ) {
368371 if ( headersToAttribs . has ( name ) ) {
369372 const attrValue = Array . isArray ( value ) ? value . join ( ', ' ) : value ;
370- spanAttributes [ `http.request.header.${ name } ` ] = attrValue . trim ( ) ;
373+ spanAttributes [ `http.request.header.${ name } ` ] = attrValue ;
371374 }
372375 }
373376 }
You can’t perform that action at this time.
0 commit comments