Skip to content

Add support for parsing duration (time.ParseDuration) on custom resource state metrics #2625

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

Open
solidDoWant opened this issue Mar 6, 2025 · 1 comment
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

@solidDoWant
Copy link

What would you like to be added:

I would like custom state metrics to be able to parse resource duration fields into metric value. For example, they should be able to parse duration: 1h into 3600.

Why is this needed:

Some resources (like cert-manager certificates) store valuable information, such as how long a certificate is valid for, as a duration string.

Describe the solution you'd like

I would like KSM to support parsing these values, similarly to other values, as described here.

Additional context

This is not as trivial as adding a three line if this can be parsed; set the metric to the time.ParseDuration value. Custom resources already support parsing resource quantities such as 250m (i.e. 1/4 of a CPU), which is indistinguishable from the duration 250m (i.e. four hours and ten minutes). The config likely would need to support explicitly stating how a metric should be converted (which is probably desirable anyway).

@solidDoWant solidDoWant added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 6, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Mar 6, 2025
@richabanker
Copy link
Contributor

/assign @rexagod
/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 Mar 20, 2025
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

No branches or pull requests

4 participants