Skip to content

Commit 48ed223

Browse files
committed
chore: remove unnecessary trim
1 parent 01c1c86 commit 48ed223

File tree

1 file changed

+4
-1
lines changed
  • plugins/node/instrumentation-undici/src

1 file changed

+4
-1
lines changed

plugins/node/instrumentation-undici/src/undici.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)