-
Notifications
You must be signed in to change notification settings - Fork 120
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
adhoc filters #34
Comments
Hi @snatch2013
For now, I see a lot of problems with it. Could you plz provide us with some scenarios for AdHoc filters? |
Adhoc filters are applied automatically to all queries that target the given datasource. |
But CH is not a key-value storage. You can't just fetch tags and values, as it required by Grafana API, without defining table and interval. If we will try to get uniq IPs from our table, the browser will just hang because of billions of results. For our datasource it is possible to define regular variables, and make them dependent on each other to achieve desired filtering. |
Roman, |
Grafana requires to implement next funcs for AdHoc:
It means that tags and values must be queried from datasource
Yes
But no guarantees that every table will have the same list of columns, like I see that AdHoc is supported only by ElasticSearch and InfluxDB. I am not familiar with those databases and might mistaken in such questions. |
They collect tag keys and values just to provide the ability to choose from the list. But, you can also type manually any field name, it shouldn't be the tag name. Also, it is possible to type any value, not only to choose from the list. So in case of clickhouse, it seems like it possible to fetch the list of columns and show this list, but of cause there is no need to fetch all values. So, according to your answer, it's not possible to use variables to achieve the same goal. Every time you want to change some filtering field, you need to reconfigure all graphs and tables. Of cause there are cases when you cannot use this filters, but it's the same for influxdb and elastic. But it's ok, nobody make you use this feature if you don't need it. |
Good point. I can try to fetch all columns and their types from system.columns. And after each change parse all queries into AST and add conditions into Thx for your patience! |
Thanks, Roman |
/long negative post deleted/ Never mind. Adhoc filters implementation for initial filtering on the $table could be useful, definitely. |
We have a use case where we have a drop-down list of ad-hoc filters that we commonly use (e.g. filtering for HTTP request code 200). Using the SqlDB plugin, it's possible to use ad-hoc filters by adding
This technique does not work with the Vertamedia plugin because it seems that
...which prevent this technique from working. Maybe this could be a simple way to implement this feature? |
Maybe it would be easier to transform the $table to a subquery with this filters applied? It wouldn't require any AST hustle and $timeFilter should be applied in this subquery (the additional point here - it is now easy to produce the excessive load on Clickhouse server by accidently running several full-range queries if one miss the $timeFilter while writing the query). |
Hi @mattbostock
Plugin automatically quotes string arguments in variables. I did it to simplify query building: |
@snatch2013 Some info about adhocs:
|
@snatch2013 up |
Roman, sorry for late answer. I will check it today. |
I have downloaded the branch adhoc-filters, restarted the grafana-server, but wasn't able to make it work.
Could you please suggest what to check? Can it be a problem for grafana version 5.0.0? I will check the version 4.6 tomorrow. Regards, |
Hi @snatch2013
Probably it's browsers cache? Try to create new dashboard in browser's incognito mode |
Yes, sorry, it was my mistake. I missed that the name of the variable should be adhoc. Now it works. Regards, |
Ok, I'll merge it |
Hello,
is it possible to add AdHoc filters similar to InfluxDB plugin?
Regards,
Vladimir
The text was updated successfully, but these errors were encountered: