Skip to content

Commit 525bd32

Browse files
committed
feat: remove mongo instrumentation terminate as it is done in the runner
1 parent 88b960a commit 525bd32

File tree

4 files changed

+4
-30
lines changed

4 files changed

+4
-30
lines changed

packages/core/src/index.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,8 @@ export const setupCore = () => {
2121
mongoMeasurement = new MongoMeasurement();
2222
};
2323

24-
export const teardownCore = async () => {
24+
export const teardownCore = () => {
2525
linuxPerf.stop();
26-
const aggregate = await mongoMeasurement.terminate();
27-
if (aggregate !== undefined) {
28-
console.log(`[CodSpeed] Mongo Aggregate: ${aggregate}`);
29-
return aggregate;
30-
}
31-
console.log(`[CodSpeed] Mongo Aggregate: no aggregate`);
3226
};
3327

3428
export { getV8Flags, tryIntrospect } from "./introspection";

packages/core/src/mongoMeasurement.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ApiError, MongoTracer } from "./generated/openapi";
1+
import { MongoTracer } from "./generated/openapi";
22

33
export class MongoMeasurement {
44
private tracerClient: MongoTracer | undefined;
@@ -39,18 +39,4 @@ export class MongoMeasurement {
3939
});
4040
}
4141
}
42-
43-
public async terminate() {
44-
if (this.tracerClient !== undefined) {
45-
try {
46-
return await this.tracerClient.instrumentation.terminate();
47-
} catch (e) {
48-
// TODO handle terminate killing the server instead of returning a response first
49-
if (e instanceof ApiError) {
50-
console.error("Terminate failed with error");
51-
console.log(e.body);
52-
}
53-
}
54-
}
55-
}
5642
}

packages/tinybench-plugin/src/index.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,7 @@ export function withCodSpeed(bench: Bench): Bench {
8282
// print results
8383
console.log(` ✔ Measured ${uri}`);
8484
}
85-
const aggregate = await teardownCore();
86-
console.log(
87-
`[CodSpeed] Mongo Aggregate: ${JSON.stringify(aggregate, null, 2)}`
88-
);
85+
teardownCore();
8986
console.log(`[CodSpeed] Done running ${bench.tasks.length} benches.`);
9087
return bench.tasks;
9188
};

packages/vitest-plugin/src/runner.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ class CodSpeedRunner extends NodeBenchmarkRunner {
8585
await runBenchmarkSuite(suite);
8686
logCodSpeed(`running suite ${suite.name} done`);
8787

88-
const mongoAggregate = await teardownCore();
89-
logCodSpeed(
90-
`[CodSpeed] Mongo Aggregate: ${JSON.stringify(mongoAggregate, null, 2)}`
91-
);
88+
teardownCore();
9289
}
9390
}
9491

0 commit comments

Comments
 (0)