influxdata / influxdata/influxdb
Variables couldn't be exported to Dashboard
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
Hello, InfluxDB community.
I need help with getting variables by query and their use in the dashboard.
## Environment
InfluxDb v2.1.1
## Metrics
I have metrics with name: `http_client_requests`
Tags: "method", "status", "uri", "myCustomTag"
## Variable `myCustomVar`
```
from(bucket: "mymetrics")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "http_client_requests")
|> keyValues(keyColumns: ["id"])
|> group()
|> keep(columns: ["id"])
|> distinct(column: "id")
|> keep(columns: ["_value"])
|> yield()
```
### Result
I see the result of the variable query. But I can't get the same result in the metrics dashboard.

> I'd like to see `_value` in the metrics dashboard.
## Metrics Dashboard
There I'm using the var `myCustomVar`.
```
from(bucket: "mymetrics")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "http_client_requests")
|> filter(fn: (r) => r["_field"] == "count")
|> filter(fn: (r) => r["status"] == "200")
|> filter(fn: (r) => r["id"] == v.myCustomVar)
|> count()
```
Then I open the dashboard in the same time range but it couldn't get the var values.
Contributor guide
Research direction
Reproduce the issue using the `myCustomVar` variable query and the metrics dashboard query shown in the report on InfluxDB v2.1.1. Start by comparing the variable query result with how the dashboard substitutes `v.myCustomVar`; done means the dashboard receives the variable values and applies the `id` filter as expected.
Written by the indexing model from the issue text.
Assessment
- Domain
- databases, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 28/100