-
Notifications
You must be signed in to change notification settings - Fork 12.8k
[--Dashboard-- data source] Implement AdHoc filtering #108011
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
Conversation
2edc201
to
9199493
Compare
b9aa2e6
to
307fbf3
Compare
Looking good, @samjewell! Left some comments for you. The one blocking change would be applying this to TableNextGen instead of old table. Also, when I pulled the branch down locally to review and test (pulled it down fresh), there were a bunch of changes to sync. Could you double-check that everything’s committed and pushed cleanly on your end? I'd love to test with a clean branch! 😺 |
…ce`" This reverts commit 307fbf3. As per PR feedback from @leeoniya and @alexjonspencer1 #108011 (comment) > these changes should instead go into TableCellActions.tsx of TableNG So removing the changes from here. In fact TableCellActions.tsx already has this change so no further work is needed. It's here: https://github.com/grafana/grafana/blob/main/packages/grafana-ui/src/components/Table/TableNG/Cells/TableCellActions.tsx#L67-L78
As per PR feedback @ #108011 (comment)
Starting with string-fields only
But retain maintainability/extensability
195db46
to
79ac3e8
Compare
|
|
Thanks to @mdvictor for code-review
NICE! I like where this PR is at - awesome adding some tests. They seem great to me. Just two items and I'll be more than happy to ✅ this PR.
|
Done ✅
Also done ✅ . It feels immediate to me, on a table which is 17k rows, 88 columns, 1.5M cells |
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.
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 was also wondering about performance on a large dataset, thanks for bringing that up @alexjonspencer1 and for checking it out @samjewell!
LGTM!
Hey @mdvictor I saw your PRs #107775 and #106756, and specifically your comment in the PR description:
I'm a little curious about how this plays out in practice, so I wanted to ask: Which datasources is this relevant for? I was thinking about Prom and Loki, and my understanding is that ALL filters for Prom or Loki that are valid on one dashboard should remain valid on another dashboard - that validity isn't affected by the dashboard, but only by the data source ID, as it's the datasource which contains the labels and their values. WDYT? Is my understanding correct? I'll just feel more confident implementing this once I know the use-case we are building it for. EDIT: |
Hey @samjewell, This is the continuation PR of this. Because I've renamed the DS method currently there is no UI but it will come after grafana/scenes#1181 gets merged. |
What is this feature?
Implementing AdHoc filtering for the
--Dashboard--
data source, behind an experimental feature toggle.AdHoc.filtering.for.Dashboard.ds_small.mp4
I've kept the scope purposefully small here in order to keep this PR small, and get it in front of our stakeholders as soon as possible. It includes support only for:
=
and!=
For cases other than these we simply reject all rows for now (to clearly indicate to the user that the newly added filter is not supported). We can extend support or add error-messages at a later date, as we find they are needed.
We also haven't implemented
getTagKeys
orgetTagValues
, again to keep scope small. We anticipate these filters being applied primarily by people clicking on data within panels, and not by hand-crafting the filter text in the filter input itself at the top of the dashboard (which is whatgetTagKeys/Values
would enable).Why do we need this feature?
BI dashboarding tools such as Tableau and Looker allow for "Panel to Panel filtering", which is shown here in the video
Tableau-example-small.mp4
So users can click a value in a panel to immediately filter the whole dashboard (and all other panels) to the value they clicked. They can then continue clicking and filtering by clicking on other panels, and other values in those panels, to keep drilling and drilling down to the small set of data that they want to study.
AdHoc filters are a good fit for this because they scale well:
BUT
Until now they've only been implemented for:
Our stakeholder wants Panel-to-Panel filtering to work with their BigQuery data from their data warehouse. But we can't implement AdHoc filtering in BigQuery itself because we can't rely on a column being present in another panel, even if it is powered by the same underlying table. If we try to filter to Customer BBC for example, by landing a
WHERE 'customer' = 'bbc'
clause into our panel query, we expect it to simply fail with a syntax error such ascustomer column not found
for many of the panels on the dashboard, where for example the Customer column will not be present in the outermost query. It may have been aggregated away already, or never even queried, given there are a great many tables in many typical SQL databases encountered in the wild.The dashboards we anticipate in response to this are as follows:
^ This primary query will exist as a table panel that contains the full dataset. At this point we know which columns are present in that dataset, and can rely on them always being present. We won't ever get "column not found" errors. Then we can use the
--Dashboard--
datasource to power every other panel on the dashboard, and then (through this PR) enable Ad-hoc filtering on all of those panels.Who is this feature for?
BI users, building dashboards for other viewer-users, where the viewer-users need to filter and drill the dashboard quickly and easily on a variety of dimensions.
Which issue(s) does this PR fix?:
None
Special notes for your reviewer:
Please check that: