Skip to content

Commit

Permalink
feat(instrumentation-http): add diag debug on http request events (#2126
Browse files Browse the repository at this point in the history
)

* feat: add diag debug on http request events

* Update packages/opentelemetry-instrumentation-http/src/http.ts

Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>

* Update packages/opentelemetry-instrumentation-http/src/http.ts

Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>

* fix: _diag private

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>
Co-authored-by: Bartlomiej Obecny <bobecny@gmail.com>
Co-authored-by: Rauno Viskus <Rauno56@users.noreply.github.com>
  • Loading branch information
4 people committed Sep 9, 2021
1 parent feea516 commit a1875b6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/opentelemetry-instrumentation-http/src/http.ts
Expand Up @@ -326,17 +326,20 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
this._closeHttpSpan(span);
});
response.on('error', (error: Err) => {
this._diag.debug('outgoingRequest on error()', error);
utils.setSpanWithError(span, error, response);
this._closeHttpSpan(span);
});
}
);
request.on('close', () => {
this._diag.debug('outgoingRequest on request close()');
if (!request.aborted) {
this._closeHttpSpan(span);
}
});
request.on('error', (error: Err) => {
this._diag.debug('outgoingRequest on request error()', error);
utils.setSpanWithError(span, error, request);
this._closeHttpSpan(span);
});
Expand Down

0 comments on commit a1875b6

Please sign in to comment.