From 47ab8c21f80fb8e5e7e0e87d41e9aa9e6ac2158d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaras=C5=82a=C5=AD=20Viktor=C4=8Dyk?= Date: Thu, 21 Jul 2022 20:10:43 +0200 Subject: [PATCH] fix(fetch): revert to original code in endSpanOnSuccess --- .../src/fetch.ts | 23 +++++++------------ 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts b/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts index 37ff62e234e..7c0b5521835 100644 --- a/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts +++ b/experimental/packages/opentelemetry-instrumentation-fetch/src/fetch.ts @@ -321,22 +321,15 @@ export class FetchInstrumentation extends InstrumentationBase> function endSpanOnSuccess(span: api.Span, response: Response) { plugin._applyAttributesAfterFetch(span, options, response); - const spanResponse = { - status: response.status, - statusText: response.statusText, - headers: response.headers, - url - }; if (response.status >= 200 && response.status < 400) { - if (response.url != null && response.url !== '') { - spanResponse.url = url; - } - } - plugin._endSpan(span, spanData, { - status: response.status, - statusText: response.statusText, - url, - }); + plugin._endSpan(span, spanData, response); + } else { + plugin._endSpan(span, spanData, { + status: response.status, + statusText: response.statusText, + url, + }); + }( } function onSuccess(