Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(instrumentation-http): add diag debug on http request events #2126

Merged
merged 7 commits into from
Sep 9, 2021
3 changes: 3 additions & 0 deletions packages/opentelemetry-instrumentation-http/src/http.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,17 +338,20 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
this._closeHttpSpan(span);
});
response.on('error', (error: Err) => {
diag.debug('outgoingRequest on error()');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be outgoingRequest on response error() but then we probably need to change this line https://github.com/open-telemetry/opentelemetry-js/blob/main/packages/opentelemetry-instrumentation-http/src/http.ts#L314

Asafb26 marked this conversation as resolved.
Show resolved Hide resolved
dyladan marked this conversation as resolved.
Show resolved Hide resolved
utils.setSpanWithError(span, error, response);
this._closeHttpSpan(span);
});
}
);
request.on('close', () => {
diag.debug('outgoingRequest on request close()');
if (!request.aborted) {
this._closeHttpSpan(span);
}
});
request.on('error', (error: Err) => {
diag.debug('outgoingRequest on request error()');
Asafb26 marked this conversation as resolved.
Show resolved Hide resolved
utils.setSpanWithError(span, error, request);
this._closeHttpSpan(span);
});
Expand Down