Skip to content

[Feature Request]: Support the Flux query interface for InfluxDB #23691

Open
@mosche

Description

@mosche

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. 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 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)

Screenshot 2022-10-18 at 09 40 30

Issue Priority

Priority: 2

Issue Component

Component: community-metrics

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions