We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
labelFromKey does not work when I use the config below
labelFromKey
kube-state-metrics --port=8880 --telemetry-port=8881 --kubeconfig=/config --custom-resource-state-config-file=/crsm.yaml
crsm.yaml
kind: CustomResourceStateMetrics spec: resources: - groupVersionKind: group: bbb kind: "xxx" version: "v1alpha1" labelsFromPath: name: [metadata, name] metrics: - name: "np" help: "xxx" each: type: Gauge gauge: path: [status, nodeProgress] # does not work labelFromKey: type
CR looks like:
apiVersion: bbb/v1alpha1 kind: xxx ... ... ... status: np: key1: 100 key2: 100
I got :
kube_bbb_v1alpha1_xxx_np{name="aaa"} 100 kube_bbb_v1alpha1_xxx_np{name="aaa"} 100
instead of
kube_bbb_v1alpha1_xxx_np{name="aaa",type="key1"} 100 kube_bbb_v1alpha1_xxx_np{name="aaa",type="key2"} 100
After checking the source code and changing
kube-state-metrics/pkg/customresourcestate/registry_factory.go
Lines 156 to 160 in a3a509a
to
return &compiledGauge{ compiledCommon: *cc, ValueFrom: valueFromPath, NilIsZero: m.Gauge.NilIsZero, LabelFromKey: m.Gauge.LabelFromKey, }, nil
I get the result I want.
I wonder whether this is intentional or there are other solutions that do not need to modify the source code.
The text was updated successfully, but these errors were encountered:
/assign I don't think this was intentional. This makes sense to me. #1871 is more or less similar to this as well.
Sorry, something went wrong.
Allow labelFromKey field for all types
70f2e4b
Allow `labelFromKey` field for all types: * Gauge: Done. * Info, StateSets: Pending. Fixes: kubernetes#1871 and kubernetes#1868.
v2.7.0 has been released, feel free to reopen if this is not resolved.
rexagod
No branches or pull requests
labelFromKey
does not work when I use the config belowkube-state-metrics --port=8880 --telemetry-port=8881 --kubeconfig=/config --custom-resource-state-config-file=/crsm.yaml
crsm.yaml
CR looks like:
I got :
instead of
After checking the source code and changing
kube-state-metrics/pkg/customresourcestate/registry_factory.go
Lines 156 to 160 in a3a509a
to
I get the result I want.
I wonder whether this is intentional or there are other solutions that do not need to modify the source code.
The text was updated successfully, but these errors were encountered: