Squashed commit of the following:
commit 8b18f78098953c5aba744dd16a215b6ed4cd5143
Author: Luke Morris <lukevmorris@gmail.com>
Date: Wed Feb 28 20:44:46 2018 -0800
Revert "Merge pull request #2663 from influxdata/feature/migrate-time-interval"
This reverts commit 8cd9d1890c, reversing
changes made to c1fcd18430.
commit 8f17059d24cc1a1bb4b8675be70fb9adb3f3a3e3
Author: Luke Morris <lukevmorris@gmail.com>
Date: Wed Feb 28 20:44:23 2018 -0800
Revert "Merge pull request #2890 from influxdata/fix/time-interval"
This reverts commit 0a1997d7f1, reversing
changes made to afbcfc3c0d.
Previously users specify `resolution` and `pixelsPerPoint`. This has
been change and the front end will now need to specify `points` which is
the number of points it'd like to get back from the query.
This naming is more consistent with user's expectations from other
similar visualization tools.
Also, the usage of the variable now requires the words "GROUP BY" to be
present. e.g. `GROUP BY :interval:`
In order for :autoGroupBy: and :dashboardTime: to co-exist in a query,
it's necessary to introduce template variable precedence to the backend.
This is done by adding a `Precedence()` method to the TemplateVariable
interface that returns an ordinal indicating the precedence level of the
template variable. Precedence starts from 0 (highest) proceeding to the
maximum that a `uint` can represent.
A template variable at a given precedence level can expect that all
template variables with higher precedence will have already been
replaced in the query that is passed to its `Exec` call.
For example, :autoGroupBy: has lower precedence than :dashboardTime:
because it needs to know the selected time range for the query. When the
`Exec` method of `GroupByVar` is invoked, it will see the query after
:dashboardTime: has already been replaced, allowing it to extract the
duration successfully.
In order for automatic group by to be remotely useful, we need to parse
out the selected duration of time from the query itself. The problem
with doing this is that using the existing machinery for parsing
InfluxQL requires having valid InfluxQL, which InfluxQL+Template
Variables is not. To break this chicken-and-egg problem, the duration is
directly extracted from the query using regular string processing.