Skip to content
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

Query Builder: Add ability to group by columns #15984

Closed
hoorayimhelping opened this issue Nov 19, 2019 · 3 comments · Fixed by #16226
Closed

Query Builder: Add ability to group by columns #15984

hoorayimhelping opened this issue Nov 19, 2019 · 3 comments · Fixed by #16226
Assignees
Labels
difficulty/high This issue needs to be broken down into smaller units of work. pm/review team/ui

Comments

@hoorayimhelping
Copy link
Contributor

Related: #15563

It is currently only possible to generate queries of the form

from(bucket: "telegraf")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(<filter>)
  |> aggregateWindow(every: v.windowPeriod, fn: <agg>)

Since flux does a default group by *, it is not possible to apply a different grouping of data before aggregating.

  1. Aggregate all series over time into a single series

group-none-before-agg

More of less the query we'll want to be able to express is

from(bucket: "telegraf")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "cpu")
  |> filter(fn: (r) => r._field == "usage_user")
  |> group()
  |> aggregateWindow(every: v.windowPeriod, fn: mean)
  |> yield(name: "mean")
@hoorayimhelping hoorayimhelping self-assigned this Nov 19, 2019
@hoorayimhelping hoorayimhelping added difficulty/high This issue needs to be broken down into smaller units of work. team/ui labels Nov 19, 2019
@hoorayimhelping
Copy link
Contributor Author

POC I whipped up:
in

Chatted with Alex Pax about this on Slack. We both think there needs to be more affordance for switching between Filters and Groups so I'm going to make the Filter / Group a dropdown and allow selecting it.

@hoorayimhelping
Copy link
Contributor Author

Chatted with @mavarius about the design and UX of this. For the first initial pass (what I'm calling Group By 0.5) we're going to add a dropdown to select between filter and group. Adding a new BuilderCard will select filter by default, initially.
Screen Shot 2019-11-27 at 10 49 35 AM

After the initial 0.5 functionality lands, we'll evaluate the best way to change the function with fewer clicks. Some initial thoughts are to have a list of functions to add in place of the single + icon, or a dropdown above Aggregate Functions with a list of functions to add.
Screen Shot 2019-11-27 at 10 50 18 AM

@hoorayimhelping
Copy link
Contributor Author

Related: #16076

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty/high This issue needs to be broken down into smaller units of work. pm/review team/ui
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants