fix: return configuration warnings instead of logging them - #341
Merged
Conversation
…onfig package `config.Load` and `config.ScanInterval` logged their three non-fatal parse warnings (an unknown LOG_LEVEL, an invalid SCAN_INTERVAL, a clamped LOOKBACK_HOURS) through the process logger. That put a warning in the output of the `health` subcommand, which runs every 30s and derives its deadline through `ScanInterval`, so a misconfigured interval produced a warning line per probe. Both now return `[]Warning` values; the daemon emits them once, before the parsed LOG_LEVEL is applied, so an `error` level cannot hide the warning that explains it, and the probe discards them. The urlsafe package doc records that registry-stats carries a diverged copy nothing synchronizes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
config.Loadandconfig.ScanIntervallogged their three non-fatal parse warnings (unknownLOG_LEVEL, invalidSCAN_INTERVAL, clampedLOOKBACK_HOURS) straight to the process logger. Thehealthsubcommand runs every 30s and derives its deadline throughScanInterval, so a misconfigured interval produced one warning line per probe. Both functions now return[]Warningvalues and the package never logs. The daemon emits them once, before the parsedLOG_LEVELis applied so anerrorlevel cannot hide the warning that explains it; the probe discards them.The
urlsafepackage doc records that registry-stats carries a diverged copy nothing synchronizes.Tested
Config tests assert on the returned warnings instead of a captured logger; a new
TestLoadNeverLogspins the no-logging contract and was red-checked with a plantedslog.Warn.go test -count=1 -race ./...,golangci-lint run(0 issues) anddeadcode -test ./...clean.