Skip to content

Commit

Permalink
fix: rename methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mhennoch committed May 15, 2021
1 parent 501521e commit afcbdd6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/opentelemetry-instrumentation-fetch/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ export class FetchInstrumentation extends InstrumentationBase<
}
const spanData = plugin._prepareSpanData(url);

function endSpanWithError(span: api.Span, error: FetchError) {
function endSpanOnError(span: api.Span, error: FetchError) {
plugin._applyAttributesAfterFetch(span, options, error);
plugin._endSpan(span, spanData, {
status: error.status || 0,
Expand All @@ -323,7 +323,7 @@ export class FetchInstrumentation extends InstrumentationBase<
});
}

function endSpanSuccessfully(span: api.Span, response: Response) {
function endSpanOnSuccess(span: api.Span, response: Response) {
plugin._applyAttributesAfterFetch(span, options, response);
if (response.status >= 200 && response.status < 400) {
plugin._endSpan(span, spanData, response);
Expand Down Expand Up @@ -351,20 +351,20 @@ export class FetchInstrumentation extends InstrumentationBase<
reader.read().then(
({ done }) => {
if (done) {
endSpanSuccessfully(span, response);
endSpanOnSuccess(span, response);
} else {
read();
}
},
error => {
endSpanWithError(span, error);
endSpanOnError(span, error);
}
);
};
read();
} else {
// some older browsers don't have .body implemented
endSpanSuccessfully(span, response);
endSpanOnSuccess(span, response);
}
} finally {
resolve(response);
Expand All @@ -377,7 +377,7 @@ export class FetchInstrumentation extends InstrumentationBase<
error: FetchError
) {
try {
endSpanWithError(span, error);
endSpanOnError(span, error);
} finally {
reject(error);
}
Expand Down

0 comments on commit afcbdd6

Please sign in to comment.