influxdata / influxdata/influxdb

Variables couldn't be exported to Dashboard

Open
#22,902 0 comments 0 reactions 0 assignees View on GitHub
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.

![Screenshot 2021-11-19 at 15 18 10](https://user-images.githubusercontent.com/24732601/142621661-ece75588-a17f-4933-a634-a8007d4208c3.png)

> 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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.