Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kube_persistentvolume_* and kube_persistentvolumeclaim_* should expose the volume name under the same label #2288

Open
multani opened this issue Dec 18, 2023 · 5 comments · May be fixed by #2303
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@multani
Copy link

multani commented Dec 18, 2023

What would you like to be added:

kube_persistentvolume_* metrics and kube_persistentvolumeclaim_* metrics should expose the "name of the volume" inside the same metric label.

Why is this needed:

It's a bit difficult at the moment to combine the Persistent Volume and Persistent Volume Claim metrics together to get, for instance, the "size" of the PVC in a specific namespace:

It's then difficult to combine both metrics together, and bring the PVC labels into the PV metric (or vice-versa) (see prometheus/prometheus#2204)

Describe the solution you'd like

Rename one of the two label to have the same label as the other metric.

Additional context

I was trying to get the "size" of the PVCs with a query like this, but it doesn't work because it's not possible to join on different labels:

avg(kube_persistentvolume_capacity_bytes) by (persistentvolume)
* on (volumename) group_left (namespace, persistentvolumeclaim)
avg(kube_persistentvolumeclaim_info) by (namespace, persistentvolumeclaim, volumename)
@multani multani added the kind/feature Categorizes issue or PR as related to a new feature. label Dec 18, 2023
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Dec 18, 2023
@dashpole
Copy link

/assign @CatherineF-dev
/traige accepted

@multani
Copy link
Author

multani commented Jan 12, 2024

/traige accepted

@dashpole there's a typo here ;)

Also, I'm happy to help on this feature, if needed 👍

@dashpole
Copy link

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Jan 12, 2024
@CatherineF-dev
Copy link
Contributor

CatherineF-dev commented Jan 12, 2024

You can rename a metric label, as long as this metric is not marked as STABLE.

# HELP kube_persistentvolume_status_phase [STABLE] The phase indicates if a volume is available, bound to a claim,…
46

# HELP kube_persistentvolumeclaim_created Unix creation timestamp

Free feel to open a PR @multani, I can help review

multani added a commit to multani/kube-state-metrics that referenced this issue Jan 13, 2024
This changes the name of the volume name label, reported by the
`kube_persistentvolumeclaim_*` metrics, to be the same label as the one
in the `kube_persistentvolume_*` metrics.

This makes it easier to combine the 2 related set of metrics together to
being labels and values from one metric into another.

Closes: kubernetes#2288
multani added a commit to multani/kube-state-metrics that referenced this issue Jan 13, 2024
This changes the name of the volume name label, reported by the
`kube_persistentvolumeclaim_*` metrics, to be the same label as the one
in the `kube_persistentvolume_*` metrics.

This makes it easier to combine the 2 related set of metrics together to
being labels and values from one metric into another.

Closes: kubernetes#2288
@multani
Copy link
Author

multani commented Jan 13, 2024

I created #2303 to fix the issue.

Looking at the code base, it seems the volumeattachment-related metrics may have the same issue.

multani added a commit to multani/kube-state-metrics that referenced this issue Jan 13, 2024
This changes the name of the volume name label, reported by the
`kube_persistentvolumeclaim_*` metrics, to be the same label as the one
in the `kube_persistentvolume_*` metrics.

This makes it easier to combine the 2 related set of metrics together to
being labels and values from one metric into another.

Closes: kubernetes#2288
multani added a commit to multani/kube-state-metrics that referenced this issue Jan 13, 2024
This changes the name of the volume name label, reported by the
`kube_persistentvolumeclaim_*` metrics, to be the same label as the one
in the `kube_persistentvolume_*` metrics.

This makes it easier to combine the 2 related set of metrics together to
being labels and values from one metric into another.

Closes: kubernetes#2288
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants