Skip to content

Commit

Permalink
Merge pull request #4332 from dyladan/node-20-leak
Browse files Browse the repository at this point in the history
fix(instrumentation-http): resume responses when there is no response…
  • Loading branch information
dyladan authored Nov 30, 2023
2 parents f654636 + 3f96f1f commit cc4ff2d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ All notable changes to experimental packages in this project will be documented
* fix(sdk-logs): avoid map attribute set when count limit exceeded
* fix(instrumentation-fetch): only access navigator if it is defined [#4063](https://github.com/open-telemetry/opentelemetry-js/pull/4063)
* allows for experimental usage of this instrumentation with non-browser runtimes
* fix(instrumentation-http): memory leak when responses are not resumed

## 0.45.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ export class HttpInstrumentation extends InstrumentationBase<Http> {
'response',
(response: http.IncomingMessage & { aborted?: boolean }) => {
this._diag.debug('outgoingRequest on response()');
if (request.listenerCount('response') <= 1) {
response.resume();
}
const responseAttributes =
utils.getOutgoingRequestAttributesOnResponse(response);
span.setAttributes(responseAttributes);
Expand Down

0 comments on commit cc4ff2d

Please sign in to comment.