Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2

* refactor(opentelemetry-sdk-node): simplify calculation of traceExportersList [#6132](https://github.com/open-telemetry/opentelemetry-js/pull/6132) @cjihrig
* refactor(instrumentation): combine filter() calls in \_onRequire [#6142](https://github.com/open-telemetry/opentelemetry-js/pull/6142) @cjihrig
* test(instrumentation-http): make timing dependent test more robust [#6144](https://github.com/open-telemetry/opentelemetry-js/pull/6144) @cjihrig

## 0.208.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,24 +942,29 @@ describe('HttpInstrumentation', () => {

it('should have 2 ended span when client prematurely close', async () => {
const promise = new Promise<void>(resolve => {
function waitForSpans() {
const numSpans = memoryExporter.getFinishedSpans().length;

if (numSpans < 2) {
setTimeout(waitForSpans, 1);
} else if (numSpans > 2) {
throw new Error(`too many spans: ${numSpans}`);
} else {
resolve();
}
}

const req = http.get(
`${protocol}://${hostname}:${serverPort}/hang`,
res => {
res.on('close', () => {});
res.on('close', waitForSpans);
res.on('error', () => {});
// Close the socket.
req.destroy();
}
);
// close the socket.
setTimeout(() => {
req.destroy();
}, 10);

req.on('error', () => {});

req.on('close', () => {
// yield to server to end the span.
setTimeout(resolve, 10);
});
});

await promise;
Expand Down