Skip to content

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

Merged
SuperQ merged 8 commits into
prometheus:masterfrom
dwellir-public:device-mapper-backing-device-info
Sep 21, 2026
Merged

SuperQ merged 8 commits into
prometheus:masterfrom
dwellir-public:device-mapper-backing-device-info

Conversation

@Maharacha

Copy link
Copy Markdown
Contributor

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
Contributor

@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
Contributor

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

@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
@nicolastakashi

Copy link
Copy Markdown
Contributor

@Maharacha can you fix CI?

@Maharacha
Maharacha force-pushed the device-mapper-backing-device-info branch from af6346c to d7a6d33 Compare June 22, 2026 11:22
@Maharacha

Copy link
Copy Markdown
Contributor Author

@Maharacha can you fix CI?

I have added this d7a6d33

Can you approve workflows?

@Maharacha
Maharacha force-pushed the device-mapper-backing-device-info branch from d7a6d33 to a6446ce Compare June 29, 2026 09:56
@Maharacha
Maharacha requested a review from nicolastakashi June 29, 2026 09:57
@ArthurSens

ArthurSens commented Aug 6, 2026 •

Copy link
Copy Markdown
Member

Looks like we have some conflicts with the device name dm-5 you added to some test fixtures. Could you address that?

@discordianfish

Copy link
Copy Markdown
Member

See test failures

@ArthurSens

Copy link
Copy Markdown
Member

/workflow-approve

@ibrahim-dwellir

Copy link
Copy Markdown

@nicolastakashi. Can we get this merged?

@SuperQ
SuperQ merged commit 125a020 into prometheus:master Sep 21, 2026
17 checks passed
@Maharacha
Maharacha deleted the device-mapper-backing-device-info branch September 22, 2026 04:55
@SuperQ SuperQ mentioned this pull request Nov 18, 2026
SuperQ added a commit that referenced this pull request Nov 18, 2026
The behavior of `node_cpu_frequency_hertz` has changed. There are two different sources
of data for this metric. One from the `cpu` collector, one from the `cpufreq` collector.
Due to historical feature migrations the `cpufreq` collector shares the same subsystem
as the `cpu` collector. This caused conflicting data behavior. An attempt to fix this
was introduced in #3318. This behavior has been reverted to the previous behavior in #3795.

A new flag (`--collector.cpufreq.enable-cpufreq-prefix`) has been introduced that gives
the `cpufreq` a dedicated metric name subsystem (`node_cpufreq_...`). This will likely
be the default in v2.

* [CHANGE] netstat: Use procfs parsers for netstat, snmp and snmp6 #3796
* [CHANGE] edac: Fix no data results #3863
* [CHANGE] nvme: Deprecate metric nvme_namespace_capacity_bytes #3899
* [FEATURE] Add tainted collector for /proc/sys/kernel/tainted #3745
* [FEATURE] Add resctrl collector #3797
* [ENHANCEMENT] netstat: Add new FreeBSD metrics #3334
* [ENHANCEMENT] Add `chip` label to DRM metrics #3572
* [ENHANCEMENT] diskstats: add device-mapper backing device info metric #3676
* [ENHANCEMENT] textfile: support UTF-8 metric and label names #3729
* [ENHANCEMENT] ksmd: add general_profit metric #3778 #3894
* [BUGFIX] edac: Fix printf-style formatting in slog call #3759
* [BUGFIX] fibre_channel: fix crash when attempting to dereference invalid counters #3573
* [BUGFIX] thermal: Fix collecting Darwin temperatures without CPU power status #3767
* [BUGFIX] fibrechannel: Fix for ppc64le #3769
* [BUGFIX] cpu: Revert dup cpu frequency, add node_cpufreq flag #3795
* [BUGFIX] infiniband: skip sysfs reads for excluded devices #3824
* [BUGFIX] bcache: Fix btree_read_average_duration_seconds unit #3828

Signed-off-by: Ben Kochie <[email protected]>
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.

7 participants