Is this a BUG REPORT or FEATURE REQUEST?:
/kind bug
What happened:
I created a pod with label in camelCase, marketplace.operatorSource which was then translated by kube-state-metrics into a Prometheus label part of the kube_pod_labels metrics.
To my surprise, promlint then flagged the kube_pod_labels metric as a metric not following the best practices with an error saying that label names should be written in snake_case and not camelCase. After looking into it, I found the following metrics exposed by ksm:
kube_pod_labels{label_marketplace_operatorSource=""}
What you expected to happen:
I expected kube_state_metrics to transform the Kubernetes label into the following valid Prometheus label:
kube_pod_labels{label_marketplace_operator_source=""}
How to reproduce it (as minimally and precisely as possible):
Create a pod with a label in camelCase.
Anything else we need to know?:
AFAIK, there is nothing in the Kubernetes label syntax that is preventing to have a label in camelCase so I would expect kube-state-metrics to transform it in snake_case.
Environment:
kube-state-metrics: v1.9.7
Changing label name from user-provided value to something else can cause potential conflicts. What if one pod had marketplace.operatorSource and the second one marketplace.operator_source?
In this case, I think we can make use of the "_confictN" renaming mechanism that was recently introduced in #1156.
Most helpful comment
In this case, I think we can make use of the "_confictN" renaming mechanism that was recently introduced in #1156.