#20546·aptos-core

[Bug] Linux disk metrics are duplicated once per bind mount of the same device

Author: bbhenryCreated Sep 15, 2026Updated Sep 15, 2026

Bug

LinuxDiskMetricsCollector and DiskMetricsCollector emit duplicate Prometheus samples when the process has several bind mounts of the same block device.

/metrics then contains the same series (same name and labels, no client timestamp) several times in one scrape. Prometheus drops the extras (Error on ingesting samples with different value but same timestamp).

node_linux_disk_info is already unique per device. The I/O counters and the sysinfo space gauges are not.

To reproduce

Run aptos-node with more than one mount of the same maj:min (for example sharded storage bind-mounts on one disk). Scrape http://<node>:9101/metrics and count copies of one series:

node_linux_disk_num_reads{name="md0"} <value>
node_linux_disk_num_reads{name="md0"} <value>
# ... one line per bind mount, same labels

Same pattern for:

  • node_linux_disk_{num_merged_reads,num_merged_writes,num_reads,num_writes,num_sectors_read,num_sectors_written,time_reading_ms,time_writing_ms,io_in_progress,total_io_time_ms}
  • node_disk_available_space / node_disk_total_space (sysinfo collector; labels name, type, file_system only)

node_linux_disk_info appears once per device.

Code

In crates/node-resource-metrics/src/collectors/linux_collectors.rs, collect() walks every mount in process.mountinfo(), looks up /proc/diskstats by maj:min, and emits I/O series labeled only with disk_stat.name. Bind mounts of the same device therefore collide.

disk_info already uses seen_devices (“to avoid duplicates from bind mounts”). That set is not applied to the I/O metrics.

crates/node-resource-metrics/src/collectors/disk_metrics_collector.rs iterates sysinfo disks with the same incomplete label set, so space gauges collide the same way.

register_node_metrics_collector already registers each collector once. This is not a double-register.

Expected Behavior

One sample per unique block device (or include the mount point in the labels so series are distinct).

Suggested change: extend the existing seen_devices dedup (by maj:min or device name) to all node_linux_disk_* I/O metrics. Dedup or label uniquely in DiskMetricsCollector as well.

System information

  • Aptos Core Version: reproduced on aptos-node-v1.48.7-hotfix and aptos-node-v1.49.0-rc
  • Rust Version: n/a (prebuilt node image)
  • Computer OS: Linux

Additional context

Prometheus scrape of :9101/metrics. Extra copies equal (number of bind mounts of that device - 1) per affected series.