Skip to content

Expose disk size as size_bytes label on node_disk_info#8

Merged
anulika-asama merged 1 commit into
masterfrom
diskstats/size_bytes
Jun 23, 2026
Merged

Expose disk size as size_bytes label on node_disk_info#8
anulika-asama merged 1 commit into
masterfrom
diskstats/size_bytes

Conversation

@anulika-asama

@anulika-asama anulika-asama commented Jun 23, 2026

Copy link
Copy Markdown

Summary by CodeRabbit

Release Notes

  • New Features
    • Disk info metrics now include a size_bytes label displaying the size of each device in bytes, providing enhanced visibility into disk capacity information.

@coderabbitai

coderabbitai Bot commented Jun 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d0206f6c-1058-4ce3-894b-6a3c4a0e87a5

📥 Commits

Reviewing files that changed from the base of the PR and between d5f39dc and f86d343.

📒 Files selected for processing (3)
  • collector/diskstats_linux.go
  • collector/diskstats_linux_test.go
  • collector/fixtures/sys.ttar
👮 Files not reviewed due to content moderation or server errors (1)
  • collector/fixtures/sys.ttar

Walkthrough

The node_disk_info Prometheus metric is extended with a new size_bytes label. The diskstats collector queries per-device block size via SysBlockDeviceSize, tolerates missing entries, and formats the value as a decimal string. The sysfs fixture archive gains a sda/size entry, and test golden strings are updated accordingly.

Changes

node_disk_info size_bytes label

Layer / File(s) Summary
size_bytes label descriptor, lookup, and metric emission
collector/diskstats_linux.go
Adds size_bytes to infoDesc's label list, queries c.fs.SysBlockDeviceSize(dev) in Update with os.IsNotExist tolerance and debug logging on other errors, formats the result as a decimal string, and passes it when emitting the info metric.
Sysfs fixture and test expectations
collector/fixtures/sys.ttar, collector/diskstats_linux_test.go
Adds sys/block/sda/size (value 1953525168, mode 664) to the sysfs fixture, reorders NVMe fixture entries, and updates TestDiskStats golden strings to include size_bytes="" or explicit values on every node_disk_info line.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Poem

🐇 A little rabbit checked the disk one day,
And asked, "How big are you, block device, I pray?"
size_bytes now labels each drive in the list,
From sda to nvme — none shall be missed!
The fixtures all shimmer with values so bright,
The tests run in green, everything is just right. 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and specifically describes the main change: exposing disk size as a size_bytes label on the node_disk_info metric.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch diskstats/size_bytes

Comment @coderabbitai help to get the list of available commands.

@anulika-asama anulika-asama merged commit f86d343 into master Jun 23, 2026
34 of 40 checks passed
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.

1 participant