Skip to content

collector/diskstats: add device-mapper backing device info metric#3676

Open
Maharacha wants to merge 3 commits into
prometheus:masterfrom
dwellir-public:device-mapper-backing-device-info
Open

collector/diskstats: add device-mapper backing device info metric#3676
Maharacha wants to merge 3 commits into
prometheus:masterfrom
dwellir-public:device-mapper-backing-device-info

Conversation

@Maharacha

Copy link
Copy Markdown

We have this use case where we need to see what device is backing a device mapper.

Example:

node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-0",backing_device="nvme0n1"} 1
node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-1",backing_device="nvme0n1"} 1
node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-2",backing_device="dm-0"} 1
node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-2",backing_device="dm-1"} 1
node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-3",backing_device="dm-2"} 1
node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-4",backing_device="dm-2"} 1
node_disk_device_mapper_backing_device_info{instance="foo-bar",device="dm-5",backing_device="dm-2"} 1

Together with the already existing metric node_disk_device_mapper_info, it's now possible to map the backing devices to volume groups.

@erik78se

erik78se commented Jun 2, 2026

Copy link
Copy Markdown

This is a great addition! Well needed! PV:s are critical to surface like this. +1 from me.

@Maharacha Maharacha force-pushed the device-mapper-backing-device-info branch from 48e8ac6 to e59b259 Compare June 3, 2026 14:45
@erik78se

erik78se commented Jun 4, 2026

Copy link
Copy Markdown

@SuperQ - is there anything we need to do to get this into the exporter main ?

@nicolastakashi

Copy link
Copy Markdown

@erik78se could you confirm the e2e check is green by running: go build && ./end-to-end-test.sh -u

Comment thread collector/diskstats_linux.go Outdated
func (c *diskstatsCollector) updateDeviceMapperBackingDevices(ch chan<- prometheus.Metric, dev string) {
underlying, err := c.fs.SysBlockDeviceUnderlyingDevices(dev)
if err != nil {
if !os.IsNotExist(err) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: IIRC other places we are following this style of validation.

Suggested change
if !os.IsNotExist(err) {
if errors.Is(err, os.ErrNotExist)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated!

@Maharacha Maharacha force-pushed the device-mapper-backing-device-info branch 3 times, most recently from 6edfa71 to 785de74 Compare June 11, 2026 15:01
@Maharacha

Copy link
Copy Markdown
Author

@erik78se could you confirm the e2e check is green by running: go build && ./end-to-end-test.sh -u

@nicolastakashi I have updated the fixture so that ./end-to-end-test.sh is green now. 785de74

Signed-off-by: Joakim Nyman <joakim.nyman86@gmail.com>
Signed-off-by: Joakim Nyman <joakim.nyman86@gmail.com>
…rics

Signed-off-by: Joakim Nyman <joakim.nyman86@gmail.com>
@Maharacha Maharacha force-pushed the device-mapper-backing-device-info branch from 785de74 to 9c95be2 Compare June 12, 2026 06:30
@Maharacha Maharacha requested a review from nicolastakashi June 12, 2026 06:30
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.

3 participants