collector/cpu: avoid frequency_hertz clash with cpufreq#3749
Open
locker95 wants to merge 1 commit into
Open
Conversation
Both collectors export node_cpu_frequency_hertz, but with different help text and labels. When cpu.info and cpufreq run together (the common case), Prometheus gather fails with inconsistent help strings. Only fall back to /proc/cpuinfo when the cpufreq collector is disabled. Drop the overlapping samples from the e2e fixture. Fixes prometheus#3689 Signed-off-by: Dean Chen <862469039@qq.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.
What
node_cpu_frequency_hertzwas being emitted from both the cpu.info path (/proc/cpuinfo) and the cpufreq collector, with different help strings and label sets. On hosts where both sources actually produce samples (often large-core machines), Prometheus gather fails:Why
#3318 flipped the guard so cpu.info always emitted frequency while cpufreq was enabled. That restored the metric in some setups, but made the two collectors share a metric name they cannot share.
Fix
Only export
/proc/cpuinfofrequency when the cpufreq collector is disabled. When cpufreq is on, it ownsnode_cpu_frequency_hertz.Updated the e2e fixture accordingly (those samples only appeared because of the broken dual export; the fixture has no
cpuinfo_cur_freqfor the cpufreq path).Test
Fixes #3689