Skip to content

Commit

Permalink
refactor(fetch): revert to original code in endSpanOnSuccess (#3037)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ugzuzg authored Jul 30, 2022
1 parent 492a3e8 commit fc4dcba
Showing 1 changed file with 7 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,22 +321,15 @@ export class FetchInstrumentation extends InstrumentationBase<Promise<Response>>

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, response);
} else {
plugin._endSpan(span, spanData, {
status: response.status,
statusText: response.statusText,
url,
});
}
plugin._endSpan(span, spanData, {
status: response.status,
statusText: response.statusText,
url,
});
}

function onSuccess(
Expand Down

0 comments on commit fc4dcba

Please sign in to comment.