Add support for parsing duration (time.ParseDuration
) on custom resource state metrics
#2625
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.
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
into3600
.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 as250m
(i.e. 1/4 of a CPU), which is indistinguishable from the duration250m
(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).The text was updated successfully, but these errors were encountered: