-
Notifications
You must be signed in to change notification settings - Fork 133
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
Q: filter results by label #698
Comments
Upd:
(with proper Regex generation -
I'm getting
I.e. it's keeping empty metrics with no labels for some reason... |
OK, nvm, I implemented it in a quite crude way - just removing empty metrics after. I did it in https://github.com/deniszh/promxy/tree/metric-filtering, if someone curious, but I understand that my use case is quite uncommon, not sure if we should port that to upstream. |
If I'm understanding this correctly its actually pretty close. The issue here is that metrics_relabel_configs are a bit confusing. These are used to filter the I believe that should cover your use-case; if not I might need a bit more explanation to understand it better :) |
Thanks, @jacksontj , but it's not. Let me add something here, maybe for some poor souls who need the same. So, bit more context first.
So, two data sources in Grafana, for 2 separate instances of Prometheus serving data for some clusters and have corresponding "cluster" label. (in reality it can be not 2 but 10, 20 or 100).
But. Your users already expected that DS A contain only data from A, and DS B contain only data from B, and they already built 1000000 dashboards and alerts around that fact. :) So, that's exactly was my problem. I tried
But then I relaize that some queries DO NOT CONTAIN cluster label in results, and my patch just cut all result and return nothing. And I just need to inject "cluster=A" label to all outgoing requests instead! I was running out of time, so, I just picked prom-label-proxy for injection, but it doesn't support any auth, so, I did ugly setup like
real setup is bit more complex, because I'm doing merging with many Prometheuses. And I share Auth Promxys and prom-label-proxy installation between many DS. So, in theory I can just add injectproxy support to promxy and greatly simplify this, but was distracted by other stuff. |
Oh, so your explanation of PrometheusAB makes a LOT of sense. I'm a bit unsure as to why the
I'll start out by saying -- I haven't heard of anyone solving this problem yet; so we are in somewhat uncharted territory :) So if my understanding above is correct what you need is more-or-less half of |
Yes, you described that perfectly. Name can be eg inject_matchers or what you proposed. |
Hello,
I have quite unorthodox setup and wondering could promxy help me with it.
I'm wondering why metrics_relabel_configs do not support other actions, like "keep". Let me describe my use case in a bit more details.
We have prometheuses which contain data for many clusters, hence metric have "cluster" label applied. I want to have ability to filter results by this label, so, something like:
Then, results from url1 will contain only metrics with {cluster="cluster1"} and results from url2 will contain only metrics with {cluster="cluster2"}.
As far as I understand it's not possible in current implementation. But I'm wondering is it possible to implement this in theory and what's needed for this. I'm interested in implementing this by myself even, just need a hint where to go. I tried to add "relabel.Keep" to metric_relabel.go but it's not working properly.
Thanks!
The text was updated successfully, but these errors were encountered: