influxdata / influxdata/influxdb

Variables should support selecting all values or just one

Open
#18,666 2 comments 3 reactions 0 assignees View on GitHub
area/flux area/templates area/ui team/ui wontfix
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Proposal:__
Variables should allow for selecting a specific value as well as *all* values.

__Case:__
User creates a dashboard and wants the dashboard to show data for all values of a certain Tag (say, `host`) so that any grouping queries can visualize each Tag in the same context, distinguished from one another. However, they may also want to view a dashboard for a single Tag value.

__Current behavior:__
The above case only works in the following two ways:
* create two dashboards -- one with queries that contain `group(columns: []` and one with queries that contain a `filter()` on the variable's selected value. Creating two dashboards for this, alone, is a pain.
* hack a `*` option into each variable you define. This is currently a hack that requires defining a variable with a join operation on two datasets; one that generates a table with a single `*` value and one that generates the independent values you want. This makes the variable, itself, non-performant. It also adds to user costs. And is an incredibly difficult solution for a user to come by on their own volition. An example of the variable query that is required to achieve this:
```
import "influxdata/influxdb/v1"
all_data = buckets() |> limit(n:1) |> set(key: "_value", value: "*") |> keep(columns:["_value"])
hosts = v1.measurementTagValues(bucket: "sam's Bucket", measurement: "cpu", tag: "host")
union(tables: [all_data, hosts]) |> sort()
```

__Desired behavior:__
A query that filters by a variable value AND groups by the Tag would take either the "all" or "individual" cases into account.

I'm also told that adding a grouping operation onto a single value is negligible extra query overhead.

Contributor guide

Open the contributing guide

Research direction

The issue describes dashboard variables and Flux queries but names no files or tests. Start by tracing how variable selections are represented in dashboard query handling, then define the behavior for both all values and one value. Done means users can switch between those cases without duplicate dashboards or a custom '*' variable query.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-visualization, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.