Skip to content

Commit

Permalink
feat(@opentelemetry-instrumentation-fetch): support get response data…
Browse files Browse the repository at this point in the history
… from thehook applyCustomAttributesOnSpan
  • Loading branch information
echoontheway committed Sep 24, 2021
1 parent 6a78db1 commit 6f57be3
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -331,14 +331,15 @@ export class FetchInstrumentation extends InstrumentationBase<
): void {
try {
const resClone = response.clone();
const resClone4Hook = response.clone();
const body = resClone.body;
if (body) {
const reader = body.getReader();
const read = (): void => {
reader.read().then(
({ done }) => {
if (done) {
endSpanOnSuccess(span, response);
endSpanOnSuccess(span, resClone4Hook);
} else {
read();
}
Expand Down

0 comments on commit 6f57be3

Please sign in to comment.