Skip to content

fix: container_fs metrics {device} has no label or info-metric to associate it with a volumeattachment or persistentvolumeclaim#3844

Open
tiemma wants to merge 7 commits intogoogle:masterfrom
baselinehq:add-host-container-mountpoint
Open

fix: container_fs metrics {device} has no label or info-metric to associate it with a volumeattachment or persistentvolumeclaim#3844
tiemma wants to merge 7 commits intogoogle:masterfrom
baselinehq:add-host-container-mountpoint

Conversation

@tiemma
Copy link
Copy Markdown

@tiemma tiemma commented Feb 21, 2026

This pull request adds improved tracking and reporting of filesystem mountpoints and container paths for disk metrics, enabling more accurate association of storage devices with container volumes (such as PersistentVolumeClaims) in Prometheus metrics. The changes include new fields in filesystem stats, a new Prometheus metric, and logic to extract volume names from mount paths, along with expanded test coverage.

Filesystem mountpoint and container path enhancements:

  • Added Mountpoint and ContainerPath fields to the FsStats struct in info/v1/container.go and updated the Fs struct in fs/types.go to track the host-side mountpoint for each filesystem device. [1] [2]
  • Updated fs/fs.go and container/raw/handler.go to populate mountpoint and container path information when collecting filesystem stats, including mapping host mount directories to container paths using external mounts configuration. [1] [2] [3] [4]

Prometheus metrics improvements:

  • Introduced a new Prometheus metric container_fs_device_info to expose device, mountpoint, container path, volume name, and volume type for container filesystems, allowing correlation with other disk metrics. [1] [2] [3] [4]

Volume name extraction logic:

  • Added parseMountPointIntoVolumePath function in metrics/prometheus.go to extract volume names and types from kubelet volume mount paths, supporting CSI and NFS volumes.

Expanded test coverage:

  • Added new unit tests for mountpoint handling and volume name extraction, including test cases for CSI, NFS, and non-standard paths in container/raw/handler_test.go and metrics/prometheus_test.go. [1] [2] [3]

…ociate it with a volumeattachment or persistentvolumeclaim
@google-cla
Copy link
Copy Markdown

google-cla bot commented Feb 21, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@tiemma
Copy link
Copy Markdown
Author

tiemma commented Feb 21, 2026

Currently, there is no way to associate a container workload with a pvc or volume attachment, the goal is to provide volume information based on the mount point to allow the user join on these metrics from kube-state-metrics or other programmatic forms to simplify associations.

From the new prometheus metric container_fs_device_info, other users can associate volume to pvc associations if the device is a valid csi mount point.

Related issues:

@tiemma tiemma force-pushed the add-host-container-mountpoint branch from 01b3c37 to 3aec924 Compare February 21, 2026 22:24
tiemma added a commit to baselinehq/costgraph-charts that referenced this pull request Mar 5, 2026
tiemma added a commit to baselinehq/costgraph-charts that referenced this pull request Mar 5, 2026
…ing (#18)

* fix: deploy custom cadvisor image with pvc container device_info mapping

The hope is to return to the base image once google/cadvisor#3844 is merged

* update Helm documentation

* fix: bump version for release

* update Helm documentation

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
@tiemma tiemma force-pushed the add-host-container-mountpoint branch from d6e0af7 to 3364ac9 Compare March 15, 2026 22:11
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