Skip to content

Commit 1f76bc7

Browse files
committed
add warm start count to all controller logs
1 parent 76ac4a8 commit 1f76bc7

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/cli-v3/src/entryPoints/managed/controller.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ export class ManagedRunController {
5959
private readonly runHeartbeat: RunExecutionHeartbeat;
6060
private readonly snapshotPoller: RunExecutionSnapshotPoller;
6161

62+
private warmStartCount = 0;
63+
6264
constructor(opts: ManagedRunControllerOptions) {
6365
const env = new RunnerEnv(opts.env);
6466
this.env = env;
@@ -138,6 +140,12 @@ export class ManagedRunController {
138140
});
139141
}
140142

143+
get metrics() {
144+
return {
145+
warmStartCount: this.warmStartCount,
146+
};
147+
}
148+
141149
// These settings depend on env vars that may be overridden, e.g. after runs and restores
142150

143151
get heartbeatIntervalSeconds() {
@@ -1076,6 +1084,8 @@ export class ManagedRunController {
10761084
this.exitProcess(this.successExitCode);
10771085
}
10781086

1087+
this.warmStartCount++;
1088+
10791089
this.sendDebugLog({
10801090
runId: this.runFriendlyId,
10811091
message: "waitForNextRun: got next run",
@@ -1429,7 +1439,13 @@ export class ManagedRunController {
14291439
}
14301440

14311441
sendDebugLog(opts: SendDebugLogOptions) {
1432-
this.logger.sendDebugLog(opts);
1442+
this.logger.sendDebugLog({
1443+
...opts,
1444+
properties: {
1445+
...opts.properties,
1446+
warmStartCount: this.warmStartCount,
1447+
},
1448+
});
14331449
}
14341450

14351451
async cancelAttempt(runId: string) {

0 commit comments

Comments
 (0)