This will prefix the auto-generated GVK labels for CustomResources with
customresource_ to make it a bit more clear that these labels got generated.
Signed-off-by: Mario Constanti <mario@constanti.de>
Allow `labelFromKey` field for the following types:
* Gauge: Done.
* Info: Done.
* StateSet: N/A (redundant use case, see doc changes for more info).
Signed-off-by: Pranshu Srivastava <rexagod@gmail.com>
Represent GVK information as labels in the metrics, instead of appending
them to the metric name itself. This would allow users to aggregate
varying GVKs of a CR under the same metric, making operations much more
easier.
* Adds detection of booleans in string format to getNum.
* Refactors configuration file to allow definition of different metric types
having different configuration variables.
* Refactor order of types and funcs in pkg/customersourcestate.
* Allows info and stateSet metrics to iterate over arrays.
* Adds `nilIsZero` config variable to gauge to indicate non-existing values to tread as 0 value instead of returning an error.
* Skip adding a label instead of setting value to `<nil>`.
* Replace namespace and subsystem by metricsNamePrefix
* Adjust docs for customresourcestate metrics to align with new configuration file
This is more flexible than the env variable, as a configuration can still set an env variable and use substitution in the args. e.g.,
```yaml
args:
- --custom-resource-state.config
- $(KSM_CUSTOM_RESOURCE_STATE_CONFIG)
env:
...
```