Skip to content

Variables should support selecting all values or just one #18666

Open
@samhld

Description

@samhld

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: [<tag>] 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions