GoogleCloudPlatform / GoogleCloudPlatform/prometheus-engine

Documentation or examples could demonstrate TargetLabels FromPod

Open
#875 1 comment 2 reactions 0 assignees View on GitHub
help wanted
Dominant language
Go
Stars
232
Forks
109
Avg merge
1d 3h
Merged PRs (30d)
27

Description

None of the examples or documentation beyond the API reference demonstrate how to scrape the pod labels as metric labels. This makes it harder than necessary to get going.

For my future reference, and the reference of anyone else:

```yaml
spec:
endpoints:
- interval: 1m
port: my-port
selector:
matchLabels:
app.kubernetes.io/name: my-app
targetLabels:
fromPod:
- from: foo
- from: foo/bar
to: foo_bar
metadata:
- pod
- container
```

Specify `from` as the name of the pod label you wish to have added to the metric labels. You may also need to specify `to` to provide the name the label should be on the metric - this is necessary if the pod label is not compatible with the metric labels (e.g contains characters such as /)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.