Skip to content

refactor(beat): replace startup fmt.Fprintf with structured slog.Error - #227

Merged
IanEff merged 8 commits into
mainfrom
issue-192-slog-startup-failures
Aug 18, 2026
Merged

refactor(beat): replace startup fmt.Fprintf with structured slog.Error#227
IanEff merged 8 commits into
mainfrom
issue-192-slog-startup-failures

Conversation

@IanEff

@IanEff IanEff commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Closes #192

Summary

Replaces bare fmt.Fprintf(stderr, ...) and fmt.Fprintln(stderr, ...) during startup/initialization across all four beats (clank, hiss, rattle, thump) and beat.Start with structured slog.Error calls.

Changes

  • internal/beat:
    • Attached "beat" attribute to the default JSON slog logger upon startup.
    • Flag parsing errors now emit structured slog.Error("failed to parse flags", "err", err) to stdout before exiting.
    • Audited BrokerHooks and removed redundant "beat" attribute logs.
    • Added table-driven cross-beat test verifying structured startup logs across all beats.
  • internal/clank:
    • Converted config/catalog/weights/limits/tracer/metrics/transport/broker startup errors to slog.Error.
    • Cleaned up redundant "beat", "clank" attributes.
    • Updated startup tests to assert structured JSON records on stdout.
  • internal/hiss:
    • Converted config/policy/tracer/metrics/transport/broker startup errors to slog.Error.
    • Cleaned up redundant "beat", "hiss" attributes.
    • Updated startup tests to assert structured JSON records on stdout.
  • internal/rattle:
    • Converted config/watch/query/sources/metrics/transport/broker startup errors to slog.Error.
    • Cleaned up redundant "beat", "rattle" attributes.
    • Updated startup tests to assert structured JSON records on stdout.
  • internal/thump:
    • Converted config/catalog/tracer/metrics/executor/reversal/broker startup errors to slog.Error.
    • Cleaned up redundant "beat", "thump" attributes.
    • Updated startup tests to assert structured JSON records on stdout.

Verification

  • go test -race ./... passed.
  • task ci (including gofmt, go vet, golangci-lint, govulncheck, kubeconform, promtool, calipers validate, go test -race ./..., task build) passed clean.

@IanEff
IanEff merged commit 9e454f8 into main Aug 18, 2026
1 check passed
@IanEff
IanEff deleted the issue-192-slog-startup-failures branch August 18, 2026 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The five beats report startup failures as unstructured stderr text

1 participant