Summary
In internal/gadget/registry.go, gadgets run in goroutines and errors are only logged — there's no mechanism to surface failures back to the caller.
Current Code
go func(name string, config *GadgetConfig, gadgetCtx *gadgetcontext.GadgetContext) {
if err := r.runtimeManager.RunGadget(gadgetCtx, config.Params); err != nil {
slog.Error("Error running gadget", "name", name, "error", err)
}
}(name, config, gadgetCtx)
Problems
- If a gadget fails to start, the main process doesn't know
- No way to trigger shutdown if a critical gadget fails
- No health status reporting for running gadgets
What's Needed
Options:
- Return an error channel from
RunAll that the caller can select on
- Use an
errgroup.Group to manage goroutine lifecycle
- Add a callback/hook mechanism for gadget lifecycle events
- At minimum, propagate first error and cancel context
Files
internal/gadget/registry.go
cmd/micromize/root.go (caller)
Summary
In
internal/gadget/registry.go, gadgets run in goroutines and errors are only logged — there's no mechanism to surface failures back to the caller.Current Code
Problems
What's Needed
Options:
RunAllthat the caller can select onerrgroup.Groupto manage goroutine lifecycleFiles
internal/gadget/registry.gocmd/micromize/root.go(caller)