Skip to content

Commit fb7909d

Browse files
committed
feat(core): add mongo instrumentation terminate
1 parent 008b810 commit fb7909d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

packages/core/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,12 @@ export const setupCore = () => {
2323

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

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

packages/core/src/mongoMeasurement.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,10 @@ export class MongoMeasurement {
3939
});
4040
}
4141
}
42+
43+
public async terminate() {
44+
if (this.tracerClient !== undefined) {
45+
return await this.tracerClient.instrumentation.terminate();
46+
}
47+
}
4248
}

0 commit comments

Comments
 (0)