Skip to content

Commit

Permalink
chore(core): DO NOT MERGE add logs to debug
Browse files Browse the repository at this point in the history
  • Loading branch information
adriencaccia committed Dec 19, 2023
1 parent 4319e35 commit e557e19
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/core/src/mongoMeasurement.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,41 @@ export class MongoMeasurement {
const serverUrl = process.env.CODSPEED_MONGO_INSTR_SERVER_ADDRESS;

if (serverUrl !== undefined) {
console.log(`[CORE] Connecting to MongoTracer at ${serverUrl}`);
this.tracerClient = new MongoTracer({
BASE: serverUrl,
});
console.log(`[CORE] MongoTracer connected`);
}
}

public async start(uri: string) {
console.log(`[CORE] Starting MongoTracer for ${uri}`);
if (this.tracerClient !== undefined) {
console.log(`[CORE] MongoTracer started for ${uri}`);
await this.tracerClient.instrumentation.start({
uri,
});
console.log(`[CORE] MongoTracer started for ${uri}`);
} else {
console.log(
`[CORE] MongoTracer not started for ${uri}, tracerClient is undefined`
);
}
}

public async stop(uri: string) {
console.log(`[CORE] Stopping MongoTracer for ${uri}`);
if (this.tracerClient !== undefined) {
console.log(`[CORE] MongoTracer stopped for ${uri}`);
await this.tracerClient.instrumentation.stop({
uri,
});
console.log(`[CORE] MongoTracer stopped for ${uri}`);
} else {
console.log(
`[CORE] MongoTracer not stopped for ${uri}, tracerClient is undefined`
);
}
}
}

0 comments on commit e557e19

Please sign in to comment.