Skip to content

Commit 98226fa

Browse files
committed
Add active bundles in the heartbeat.
1 parent d606a85 commit 98226fa

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

sdks/go/pkg/beam/runners/prism/internal/execute.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,8 @@ func executePipeline(ctx context.Context, wks map[string]*worker.W, j *jobservic
396396
j.Logger.Info("worker status",
397397
slog.String("workerID", wk.ID),
398398
slog.String("envID", envID),
399-
slog.Duration("uptime", wk.Uptime()))
399+
slog.Duration("uptime", wk.Uptime()),
400+
slog.Any("active_bundles", wk.ActiveBundles()))
400401
}
401402
}
402403
}

sdks/go/pkg/beam/runners/prism/internal/worker/worker.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,19 @@ func (wk *W) Uptime() time.Duration {
303303
return time.Since(wk.StartTime)
304304
}
305305

306+
// ActiveBundles returns a list of active bundles currently processing on this worker.
307+
func (wk *W) ActiveBundles() []string {
308+
wk.mu.Lock()
309+
defer wk.mu.Unlock()
310+
var bundles []string
311+
for id, responder := range wk.activeInstructions {
312+
if b, ok := responder.(*B); ok {
313+
bundles = append(bundles, fmt.Sprintf("%s (%s)", id, b.PBDID))
314+
}
315+
}
316+
return bundles
317+
}
318+
306319
// Control relays instructions to SDKs and back again, coordinated via unique instructionIDs.
307320
//
308321
// Requests come from the runner, and are sent to the client in the SDK.

0 commit comments

Comments
 (0)