-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
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
Clean up Prometheus labels scraped from proxy #633
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -384,18 +384,23 @@ data: | |
- source_labels: [__meta_kubernetes_namespace] | ||
action: replace | ||
target_label: namespace | ||
# special case k8s' "job" label, to not interfere with prometheus' "job" | ||
# label | ||
# __meta_kubernetes_pod_label_conduit_io_proxy_job=foo => | ||
# k8s_job=foo | ||
- source_labels: [__meta_kubernetes_pod_label_conduit_io_proxy_job] | ||
action: replace | ||
target_label: k8s_job | ||
# __meta_kubernetes_pod_label_conduit_io_proxy_deployment=foo => | ||
# k8s_deployment=foo | ||
# deployment=foo | ||
- action: labelmap | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what does this action do when replacement is not specified? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. per https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config,
|
||
regex: __meta_kubernetes_pod_label_conduit_io_proxy_(.+) | ||
replacement: k8s_$1 | ||
# drop all labels that we just made copies of in the previous labelmap | ||
- action: labeldrop | ||
regex: __meta_kubernetes_pod_label_conduit_io_proxy_(.+) | ||
# __meta_kubernetes_pod_label_foo=bar => k8s_foo=bar | ||
# __meta_kubernetes_pod_label_foo=bar => foo=bar | ||
- action: labelmap | ||
regex: __meta_kubernetes_pod_label_(.+) | ||
replacement: k8s_$1 | ||
|
||
### Grafana ### | ||
--- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been on both sides of the fence on this, but the fact that we have to prefix
job
to avoid conflicts makes me kinda think we should go back to prefixing all resources for consistency...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree it's unfortunate that
k8s_job
ends up being a special case. I think in general it will make our code slightly more readable. An example I just ran into:#627 (comment)
...where we're referring to
pod-template-hash
when talking to Kubernetes and thenk8s_pod_template_hash
immediately after when querying Prometheus.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I'll note that Googling around yields a direct k8s->prom label mapping to be pretty standard, and what folks would naturally expect when querying Prometheus for Kubernetes data:
https://github.com/prometheus/prometheus/blob/master/documentation/examples/prometheus-kubernetes.yml#L266-L267