Skip to content

Commit 445c62c

Browse files
feat: auto-mark app as ready on first inbound HTTP request (#144)
1 parent c830ea3 commit 445c62c

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/core/TuskDrift.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,16 @@ export class TuskDriftCore {
170170
}
171171

172172
if (!status.enabled) {
173-
logger.info(`Rust core path disabled at startup (env=${envDisplay}, reason=${status.reason}).`);
173+
logger.info(
174+
`Rust core path disabled at startup (env=${envDisplay}, reason=${status.reason}).`,
175+
);
174176
return;
175177
}
176178

177179
if (status.bindingLoaded) {
178-
logger.info(`Rust core path enabled at startup (env=${envDisplay}, reason=${status.reason}).`);
180+
logger.info(
181+
`Rust core path enabled at startup (env=${envDisplay}, reason=${status.reason}).`,
182+
);
179183
return;
180184
}
181185

src/instrumentation/libraries/http/Instrumentation.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,10 @@ export class HttpInstrumentation extends TdInstrumentationBase {
13651365
return (originalEmit: Function) => {
13661366
return function (this: Server, eventName: string, ...args: any[]) {
13671367
if (eventName === "request") {
1368-
// Sample as soon as we can to avoid additional overhead if this request is not sampled
1368+
if (!self.tuskDrift.isAppReady()) {
1369+
self.tuskDrift.markAppAsReady();
1370+
}
1371+
13691372
if (self.mode === TuskDriftMode.RECORD) {
13701373
if (
13711374
!shouldSample({

0 commit comments

Comments
 (0)