collector/meminfo_numa: append _bytes suffix to kB metrics#3589
Open
ricardbejarano wants to merge 1 commit intoprometheus:masterfrom
Open
collector/meminfo_numa: append _bytes suffix to kB metrics#3589ricardbejarano wants to merge 1 commit intoprometheus:masterfrom
ricardbejarano wants to merge 1 commit intoprometheus:masterfrom
Conversation
The meminfo_numa collector exposes memory fields without the _bytes suffix (e.g. node_memory_numa_Active), while the meminfo collector follows the Prometheus naming convention and appends _bytes for all kibibyte-scaled fields (e.g. node_memory_Active_bytes). This inconsistency was reported in issue prometheus#3460. Fix parseMemInfoNuma to append _bytes to metric names when the source line carries a kB unit, keeping the three HugePages_* fields (which have no unit) as-is. Update the unit test assertion and the e2e expected-output fixtures to reflect the renamed metrics. Fixes prometheus#3460 Signed-off-by: bejaratommy <tommy@bejarano.io>
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 #3460 in prometheus/node_exporter.
The
meminfo_numacollector exposes NUMA memory fields without the_bytessuffix (e.g.node_memory_numa_Active), while thememinfocollector correctly follows the Prometheus naming conventions and appends_bytesto all kibibyte-scaled fields (e.g.node_memory_Active_bytes).A maintainer acknowledged the inconsistency in the issue:
Changes
collector/meminfo_numa_linux.go: InparseMemInfoNuma, append_bytesto the metric name when the source line carries akBunit. The threeHugePages_*fields — which have no unit and are page counts — are left unchanged.collector/meminfo_numa_linux_test.go: Update themetricNameassertion forActive(anon)fromActive_anontoActive_anon_bytes.collector/fixtures/e2e-output.txtande2e-64k-page-output.txt: Update all expected metric names and HELP strings to reflect the new_bytessuffix.Before / After
node_memory_numa_Activenode_memory_numa_Active_bytesnode_memory_numa_MemTotalnode_memory_numa_MemTotal_bytesnode_memory_numa_HugePages_Totalnode_memory_numa_HugePages_Total(unchanged)Testing
Built and vetted on the host machine:
Unit tests for
TestMemInfoNumaare Linux-only (file uses_linuxsuffix) and cannot be executed in a cross-compiled environment, but the test assertions have been updated to match the new metric names.