Skip to content

collector/meminfo_numa: append _bytes suffix to kB metrics#3589

Open
ricardbejarano wants to merge 1 commit intoprometheus:masterfrom
bejaratommy:fix/3460-meminfo-numa-bytes-suffix
Open

collector/meminfo_numa: append _bytes suffix to kB metrics#3589
ricardbejarano wants to merge 1 commit intoprometheus:masterfrom
bejaratommy:fix/3460-meminfo-numa-bytes-suffix

Conversation

@ricardbejarano
Copy link

Summary

Fixes #3460 in prometheus/node_exporter.

The meminfo_numa collector exposes NUMA memory fields without the _bytes suffix (e.g. node_memory_numa_Active), while the meminfo collector correctly follows the Prometheus naming conventions and appends _bytes to all kibibyte-scaled fields (e.g. node_memory_Active_bytes).

A maintainer acknowledged the inconsistency in the issue:

I guess we could append _bytes there as well.

Changes

  • collector/meminfo_numa_linux.go: In parseMemInfoNuma, append _bytes to the metric name when the source line carries a kB unit. The three HugePages_* fields — which have no unit and are page counts — are left unchanged.
  • collector/meminfo_numa_linux_test.go: Update the metricName assertion for Active(anon) from Active_anon to Active_anon_bytes.
  • collector/fixtures/e2e-output.txt and e2e-64k-page-output.txt: Update all expected metric names and HELP strings to reflect the new _bytes suffix.

Before / After

Before After
node_memory_numa_Active node_memory_numa_Active_bytes
node_memory_numa_MemTotal node_memory_numa_MemTotal_bytes
node_memory_numa_HugePages_Total node_memory_numa_HugePages_Total (unchanged)

Testing

Built and vetted on the host machine:

go build ./...
go vet ./...

Unit tests for TestMemInfoNuma are Linux-only (file uses _linux suffix) and cannot be executed in a cross-compiled environment, but the test assertions have been updated to match the new metric names.

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>
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.

Meminfo metric naming inconsistency

1 participant