-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Promtail default scrape configuration labels should match Kubernetes conventions #2070
Comments
Also worth discussing, if any of these changes are to be adopted, how is it handled?
I think adding new labels, deprecating redudant old ones is probably the "correct" path, but I'm unsure of updating existing label values, eg: |
I think this is pretty well-reasoned and ecosystem parity is a nice benefit. @slim-bean @cyriltovena @rfratto WDYT? We may need to find a contributor willing to shepherd these changes. |
This would be a huge breaking change for us and would require a lot of cooperation to update everything. The reason the Loki k8s labels are the way they are is because they're copied from our Prometheus Ksonnet which all of the mixins we've produced depend on. I'm open for being more consistent with the overall ecosystem, but if we blindly change this without changing our other uses of the label names, we're going to lose the ability to switch between metrics and logs on the fly, so we should be very careful here. |
FWIW: this isn't true; |
I understand that Grafana (labs) configures prometheus one way, but it's still not following the conventions that upstream Kubernetes sets, and is the odd one out. I guarantee you most people using Prometheus with Kubernetes are using the prometheus/prometheus-operator helm chart, or https://github.com/kubernetes-monitoring/kubernetes-mixin or something generated from it. This means with the out of the box promtail configs provided, people have different labels for logs and metrics. Additionally this applies to people not using these, as the built-in metrics from the Kubernetes API server, controller manager, and scheduler emit metrics with labels different from what promtail's example configurations use.
I agree this would need to be done carefully, however without these changes, basically anyone using Loki on K8s with one of the production install methods is already losing the ability to switch between metrics and logs on the fly because the Loki labels do not match the metrics coming from Kubernetes.
I get that, but it's still redundant information, which explicitly is an anti-pattern with Prometheus. Any queries using I understand Grafana has it's own mixins for your jsonnet based configuration, but I don't know that it's the best example to follow since it's not compatible with the labels upstream Kubernetes metrics use. |
Yeah, like I said, I'm totally in support of this idea, but I was trying to make it clear that it's: a) something we should do ourselves and not have someone external contribute (since we're most aware of our own usage of Jsonnet across the board) |
That makes sense. I suggested some ideas on how to go about it in my 2nd comment. If you're concerned about breakage, it would be best to start with just adding new labels (pod, container), while keeping existing labels as-is. And at a later point the old labels can be removed, or changed. This is what I've been doing. |
Is your feature request related to a problem? Please describe.
Currently the default configurations provided by the ksonnet/tanka and helm charts for promtail use different label conventions from Kubernetes. The labels mostly follow the pre Kubernetes 1.15/1.16 metrics overhaul conventions, or simply omit some labels entirely. See kubernetes/enhancements#1206 and https://github.com/kubernetes/enhancements/blob/master/keps/sig-instrumentation/20181106-kubernetes-metrics-overhaul.md for when Kubernetes began moving to an "official" way to do labels and naming for metrics. Here's the Kubernetes instrumentation guidelines that came out of that https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/instrumentation.md which includes conventions for label names.
You can see the "semi-standard" configuration that's used for Prometheus here: https://github.com/kubernetes-monitoring/kubernetes-mixin
This may not be exhaustive, but here's the issues I've noticed these labels being inconsistent so far:
container_name
should becontainer
pod
label is missing, butinstance
has the value of the pod.instance
is currently thepod
, but if apod
label was added theninstance
likely should be the source file name (eg__path__
) or something besides the pod name, to avoid duplicating label values.job
label is currentnamespace/pod_name
, but in Prometheus, thejob
label is roughly the exporter/collector of the metric. Eg:job="prometheus"
if it's a prometheus metric, orjob="kube-state-metrics"
if it came from KSM, andjob="node-exporter"
if it came from the node metrics. Similarly, it almost feels like logs collected by promtail should havejob="promtail"
, so we can distinguish logs collected by promtail and other log collectors that send to Loki. As it is, the information in thejob
label is just redundant and provides no additional information that doesn't already exist in other labels. This comparison isn't perfect, but I think my point stands.Describe the solution you'd like
I've provided suggestions in the description of the problematic metrics.
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: