influxdata / influxdata/influxdb
Create an Array Variable and use this to filter
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 31.7k
- Forks
- 3.7k
- Avg merge
- 13h 37m
- Merged PRs (30d)
- 8
Description
Hi,
i'm using influxdb v2.6.0
I create an array to use it after in the main query:
```
volname= from(bucket: v.bucket)
|> range(start: -365d)
|> filter(fn: (r) => r._measurement == "vol_cnf" )
|> filter(fn: (r) => r.poolid == "${pool}")
|> keep(columns: ["_value","poolid"])
|> group()
|> keep(columns: ["_value"])
|> findColumn(fn: (key) => true, column: "_value")
```
Exported values are composed of:
00:00:00
00:00:01
00:10:00
etc with 1000 others items ~
The main query is composed as follow, but it was very long/slow, but the query works
Some time i got timeout in grafana.
```
from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "VOL" and r._field == "VOL_IOPS" )
|> filter(fn: (r) => contains(value: r.volID, set: volname))
```
So i read that i can use another faster method with regex , but it don't work:
```
from(bucket: v.bucket)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "VOL" and r._field == "VOL_IOPS" )
|> filter(fn: (r) => r["ldevID"] =~ /^${volname:regex}$/)
// or this one |> filter(fn: (r) => r["ldevID"] =~ /$volname$/ )
// or this one |> filter(fn: (r) => r["ldevID"] =~ /^${volname}$/ ) with the same error:
```
invalid: compilation failed: error @17:37-17:58: regex parse error: ${volname:regex}$ error: repetition quantifier expects a valid decimal
Any idea ?
Many thanks,
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No repository file, test, or entry point is mentioned. Start by reproducing the reported Flux queries on InfluxDB v2.6.0, compare the working contains filter with the regex variants, and verify the expected behavior and compilation error before identifying an appropriate project area.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- grafana
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100