Skip to content

Add an option to allow adding Kubernetes Labels as Prometheus Metric Labels per metric-series #1980

@kostz

Description

@kostz

What would you like to be added:
Add an option to tag metrics with kubernetes labels

Why is this needed:
The case I'm working on involves otel-collector scraping prometheus metrics from KSM and exporting them into the commercial backend. The thing is that commercial backend charges for metric cardinality, so reporting metrics with such labels as pod_name and then do joins would cost a lot.

One of the possibility to avoid this excessive costs is to shrink cardinality by aggregating before exporting metrics (well, with acceptable loosing of visibility of keeping data for each pod) and it looks very promising to have this labelling on KSM and then remove extra labels (like pod_name, uid, etc) on otel-collector's processor.

Describe the solution you'd like
Have a feature toggle similar to metric-allowlist which will not add labels to kube-pod-labels metrics, but add labels for related metric timeseries, like kube_pod_container_resource_requests

Additional context
Follow up for #1758

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.triage/acceptedIndicates an issue or PR is ready to be actively worked on.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions