diff --git a/cmd/service/service.go b/cmd/service/service.go index 0cf29bb..8457a5a 100644 --- a/cmd/service/service.go +++ b/cmd/service/service.go @@ -66,6 +66,13 @@ func main() { cli, ); err != nil { logger.With("error", err).Error("process error") + // start() defers the OTel SDK shutdown, so by the time we get here the + // log exporter may already be torn down and the line above never + // reaches Alloy. Write to stderr too so startup failures are always + // visible in `kubectl logs`, and exit non-zero so the container is + // reported as failed (CrashLoopBackOff) instead of "Completed". + fmt.Fprintf(os.Stderr, "fatal: process error: %v\n", err) + os.Exit(1) } }