kube-eagle
kube-eagle copied to clipboard
feat(kube-eagle): Add pod labels to metrics
- Add label information for each pod-related metrics
This PR adds a single label with the concatenated labels from the scraped pods.
I'm not entirely sure if and how it's possible but the feature request and my personal preference is having separated labels instead, see: https://github.com/cloudworkz/kube-eagle/issues/7
When all nodes in your Kubernetes cluster have a label: nodepool = default this should also be part of the exposed node metrics from Kube eagle. Likewise for pods.
I understand what you mean, separate labels are indeed more beautiful and more readable. However, if there is a duplicate label (the same key but different value) in the extra label that is exposed by kube-eagle itself, then one label will be overwritten. So I think it’s more practical to aggregate labels into "labels"
This is a valid concern, we could prefix the label_names though (e.g. with eagle_) to guarantee they will be unique and are not going to be overwritten. What do you think?
I think your idea is very good, but I encountered another problem during the coding process: the key of each pod label is different, but prometheus seems unable to define dynamic labels. So I think it is more feasible to use the "labels" key to solidify all indicators. When extracting the label, you only need to cut according to the space to get the required data without too much extra work.
Any updates?