influxdata / influxdata/influxdb
Dashboard variable: throw an error when query variable contains other variables
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
__Proposal:__
This is a follow up on https://stackoverflow.com/questions/67038206/how-to-get-a-query-variable-on-influxdb-2-0-dashboard
A dashboard will will silently fail or display no data when a query variable contains reference to another variable inside its definition.
For example, this query variable definition will be accepted:
```
from(bucket: "pool")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "minerstat")
|> keep(columns: ["account"])
|> distinct(column: "account")
|> keep(columns: ["_value"])
```
__Current behavior:__
A cell using the corresponding variable will fail to display anything. The dropdown menu of the variable display "no value".
__Desired behavior:__
Detect the inner variable reference and throw an error at variable creation time or variable use time.
__Alternatives considered:__
Initially I saved the query data in a CSV and created a CSV variable.
Then I replaced `start: v.timeRangeStart, stop: v.timeRangeStop` with `start: -1d` to have the desired behavior.
__Use case:__
This was an easy newbie mistake that can generates a lot of frustration and hours to understand the root cause.
Contributor guide
Research direction
No file, test, or entry point is named. Trace dashboard query-variable creation and use paths first, then identify where references to other variables can be detected; done means the invalid definition or use produces an explicit error instead of an empty dropdown or silent failure.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100