timex: filter unreasonable offset values from kernel adjtimex() overflow - #3766
Open
dongjiang1989 wants to merge 1 commit into
Open
timex: filter unreasonable offset values from kernel adjtimex() overflow#3766dongjiang1989 wants to merge 1 commit into
dongjiang1989 wants to merge 1 commit into
Conversation
On KVM/pvclock guests, a race condition in the kernel NTP PLL can cause adjtimex() to return 2^32 ns (4.294967296s) as a transient overflow value, triggering false-positive NodeClockSkewDetected alerts hundreds of times per day despite NTP being correctly synchronized. Add a ±1.0s sanity bound in the timex collector: values exceeding this threshold are discarded (set to 0) with a warning log, as real NTP sync never produces offsets of this magnitude. Apply the same bound in the NodeClockSkewDetected alert expression to provide defense-in-depth at the rule layer. Fixes prometheus#3764 Signed-off-by: dongjiang <dongjiang1989@126.com>
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
Fixes #3764
On KVM/pvclock guests, a race condition in the kernel NTP PLL can cause
adjtimex()to return2^32 ns(4.294967296s) as a transient overflow value, triggering false-positiveNodeClockSkewDetectedalerts hundreds of times per day despite NTP being correctly synchronized.This PR applies defense-in-depth at two layers:
collector/timex.go): values exceeding ±1.0s are discarded (set to 0) with a warning log. Real NTP synchronization never produces offsets of this magnitude.docs/node-mixin/alerts/alerts.libsonnet):NodeClockSkewDetectedexpression gains an upper bound check (< 1.0/> -1.0) so the overflow artifact no longer passes the threshold filter even if the collector still emits it.Why ±1.0s?
MAXPHASEin the kernel is 500ms