GoogleCloudPlatform / GoogleCloudPlatform/prometheus-engine
Add project_id, location, and cluster labels via relabeling to kubelet metrics
- Dominant language
- Go
- Stars
- 232
- Forks
- 109
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 27
Description
The hardcoded `scrape_config` for the kubelet and does [not include](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/f1923f31bfc1c75457198674d865b45630938afc/pkg/operator/collection.go#L558-L563) `project_id`, `location`, or `cluster`, which is in contrast to the `scrape_config` [relabeling](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/f1923f31bfc1c75457198674d865b45630938afc/pkg/operator/apis/monitoring/v1/types.go#L626-L642) from `PodMonitoring`.
In practice, this isn't a big deal as those labels are [injected](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/f1923f31bfc1c75457198674d865b45630938afc/pkg/export/export.go#L394-L408) in-memory by the export logic in the collectors from the `--export.labels.*` [flags](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/f1923f31bfc1c75457198674d865b45630938afc/pkg/export/setup/setup.go#L134-L147), which are [upserted](https://github.com/GoogleCloudPlatform/prometheus-engine/blob/f1923f31bfc1c75457198674d865b45630938afc/pkg/operator/collection.go#L245-L279) by the operator at runtime.
But to avoid relying on that behavior, and for consistency with `PodMonitoring`, we should relabel before ingesting to the collector.
Contributor guide
Assessment
This issue has not been assessed yet.