[Feature Request]: Support the Flux query interface for InfluxDB
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
### What would you like to happen?
Unfortunately InfluxQL is very limited. Many, rather basic types of queries can only be done using the [Flux query interface](https://docs.influxdata.com/influxdb/v1.8/flux/). E.g. extracting parts from a string for readability or also grouping by a dynamic set of columns as required to handle Java microbenchmark (JMH) params.
> Grafana supports Flux running on InfluxDB 1.8+. See [1.8 compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility) for more information and connection details.
https://grafana.com/docs/grafana/v8.1/datasources/influxdb/influxdb-flux/
For 1.8 it has to be enabled using `INFLUXDB_HTTP_FLUX_ENABLED=true`
Though, it looks like the versions are incompatible. I wasn't able to successfully test it without upgrading InfluxDB to 2.x. But it might have been misconfiguration:
```
panic: column retentionPeriod:int is not of type string
```
Here's an example:
```
import "regexp"
from(bucket: "beam_test_metrics/a_year")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> truncateTimeColumn(unit: 1w)
|> filter(fn: (r) => r["_measurement"] == "java_jmh_thrpt" and r["benchmark"] =~ /ByteStringOutputStreamBenchmark/ and r["_field"] == "score")
|> map(fn: (r) => ({r with name: regexp.findString(v: r.benchmark, r:/\w+\.\w+$/)}))
|> drop(columns: ["benchmark", "scoreUnit", "_field", "_measurement"])
|> group(columns: ["_time", "_value"], mode: "except")
|> aggregateWindow(every: 1w, fn: mean, createEmpty: true)
|> fill(value:0.0)
```

### Issue Priority
Priority: 2
### Issue Component
Component: community-metrics
Contributor guide
Assessment
This issue has not been assessed yet.