-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Ensure prometheus metrics have same set of labels #2857
Conversation
Not sure if this is a reasonable fix, as it could still be problematic in some cases. Would be great if some of the If mixed tags are in a single call to write it will work:
If they are across calls, you will still get the original error:
|
@mmariani Can you test this as well and let me know if it fixes #2868? Here is an amd64 linux build |
Thanks. I have tried but had the same issue. Also tried cleaning up the prometheus data between runs. I am not sure what you mean by "not allowed for labels to differ" - all the containers must have the same set of labels? That might be due to my environment, then
|
@mmariani The new version of the prometheus library we are using enforces that all metrics have the same label names. We expire old metrics after the You might be able to work around this by ensuring that the labels never change over time, maybe you can whitelist a smaller set of labels using taginclude/tagexclude? Just to test you could do: [[inputs.docker]]
# ... snip ...
taginclude = ["host"] |
@danielnelson Confirm this works for me. Please merge. |
I've had some reports of this not being sufficient, so I'm working on a better fix. |
It is not allowed for labels to differ within a metric, this patch ensures that they are consistent within a single Write operation. However, it does not address cases where the label varies across calls to Write.
26055d5
to
a2c7cdd
Compare
@e271828- @mmariani @sbadia @freesearcher I rewrote the fix to handle additional edge cases. If you have time it would be great if everyone could test again, hoping to get this into a 1.3.2 release this week. Here is the amd64 linux build. |
My use case is metric collection across a swarm cluster. Some containers belong to services (and have labels like service_name), some don't. For now I could only make it work with docker_label_exclude = ["*"], same as setting taginclude I suppose. I'm going to test this version now, thanks. |
The last version seems to work as I expect. Thanks a lot! |
Although the data is now exposed correctly on :9126, the label names contain dots and dashes (i.e. com.docker.swarm.node.id, com.docker.swarm.task.name, build-date), which is rejected by Prometheus. Is this a regression wrt https://github.com/influxdata/telegraf/pull/909/files or am I missing something? Thanks |
Thanks for catching that! I updated the branch and here is the build. |
(cherry picked from commit 949072e)
that's perfect, thanks |
@danielnelson thanks! |
(cherry picked from commit 949072e)
It is not allowed for labels to differ within a metric, this patch
ensures that they are consistent within a single Write operation.
However, it does not address cases where the label varies across calls
to Write.
#2822
Required for all PRs: