grafana / influxdb-flux-datasource

Grafana datasource plugin for Flux (InfluxDB)
Apache License 2.0
51 stars 21 forks source link

"Metric request error" when displaying InfluxDB data using FLUX query language in grafana #127

Open lchtbruno opened 3 years ago

lchtbruno commented 3 years ago

I want to join tables, but I get a metric request error. The data consists of two measurements, with a time and value column.

data_1 = from(bucket:"telegraf/autogen")
  |> range(start:-1h)
  |> filter(fn: (r) =>
    r._measurement == "Dev502_Room6_Temp_ME_AI20" and
    r._field == "value")

data_2 = from(bucket:"telegraf/autogen")
  |> range(start:-1h)
  |> filter(fn: (r) =>
    r._measurement == "Dev502_Room6_Hum_ME_AI21" and
    r._field == "value")

join(tables: {key1: data_1, key2: data_2}, on: ["_time", "_field"], method: "inner")
ryantxu commented 3 years ago

Do each queries work independently? and you only get the error when the join query? If so, can you post the full error?

If the data is not sensitive, can you post the CSV results you see when executing the same query directly against influx?

ryantxu commented 3 years ago

What version are you using? Flux is now supported in grafana core -- try 7.2beta for best results :)

lkathke commented 3 years ago

I am getting the same error, I'm testing it with two equal querys:

left = from(bucket: "har/autogen") |> range(start: -12h) |> filter(fn: (r) => r._measurement == "BezugPV" )

right = from(bucket: "har/autogen") |> range(start: -12h) |> filter(fn: (r) => r._measurement == "BezugPV" )

join( tables: {l:left, r:right}, on: ["_time"] )

When I run one query alone, I get the data: expected I was also wondering, if the column name "value ee40c9..." is expected behavior?

On running the join, I get: err

Am I missing something or does join not work? I am using Grafana v7.2.2 and influxdb 1.8.3