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 <[email protected]>

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

Co-authored-by: Bartlomiej Obecny <[email protected]>

* fix: _diag private

Co-authored-by: Daniel Dyla <[email protected]>
Co-authored-by: Bartlomiej Obecny <[email protected]>
Co-authored-by: Rauno Viskus <[email protected]>
  • Loading branch information
4 people authored 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
Original file line number Diff line number Diff line change
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.