Open ElieLiabeuf opened 4 years ago
In the example above, what is the template varable? In 7.0 the queries should still expand template variables: https://github.com/grafana/influxdb-flux-datasource/blob/master/src/DataSource.ts#L27
In my case, the problem (compared to the previous release) is related to repeating panels using multiple-value variables.
E.g. I have a temperature that I display for each $room
selected, so I used to have a repeated panel along the $room
variable and a query like:
from(bucket: "edited")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "sensors")
|> filter(fn: (r) => r.room == "$room")
|> filter(fn: (r) => r._field == "temperature")
Grafana used to to render each panel, substituting the $room
variable with a single value (different one for each repeated panel). Now, it is doing this instead:
from(bucket: "edited")
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == "sensors")
|> filter(fn: (r) => r.room == "{bathroom,bedroom}")
|> filter(fn: (r) => r._field == "temperature")
However, the panel title displays the variable correctly.
I have noticed a similar issue in Grafana here, but it's been fixed in 6.1.0.
Ahh -- the case you mention here should be fixed for this panel in 7.1. Strangely, it will be fixed by: https://github.com/grafana/grafana/pull/25123
The real issue is using the panel tenplate vars not just the dashboard vars: https://github.com/grafana/grafana/pull/25123/files#diff-a3eb83e5943c7013877015636bfef622R130
Thank you @ryantxu - I'm looking forward to the release!
@ryantxu There is no template variable in my query. The query is used to populate a multi-value variable named "hostname".
Here is the configuation:
And the preview is empty:
The exact same thing used to work in 6.7.
The query itself works fine:
Having the same issue mentioned on the last comment.
Having the same issue with @ElieLiabeuf The query has return from flux query in influx UI but not Grafana variable query
Can you try using the 7.1 beta release, and the built-in Influx datasource there?
If it is still an issue, let me know
It's still not working. It's not even possible to add a template variable.
InfluxDB logs:
(using grafana 7.1.0 and the latest release from influxDB 2.0.0 beta)
@hugodlg it seems like you didn't add a proper token..?
I have another problem with the built-in influxDB 2.0 datasource: when using a template variable with this datasource in a dashboard - this error appears:
Template variables could not be initialized: Cannot create property 'executedQueryString' on string '<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>InfluxDB 2.0</title><base href="/"><link rel="shortcut icon" href="/favicon.ico"></head><body><div id="react-root" data-basepath=""></div><script src="/f051064740.js"></script></body></html>'
Maybe the datasource proxy proxies the query to influxDB the wrong way? It doesn't matter what the input query is, of course - this is always the result.
Testing with Grafana 7.1.0 & InfluxDB 2.0.0 (beta12).
@poldown you mean the token from influxdb? i used it on the datasource configuration. The error only happens when adding template variables. The queries are working fine on the dashboard panels.
I think it's proxying the wrong way too. Let's wait..
this is the request that happens when focusing out the query field:
POST /api/v2/query?epoch=ms HTTP/1.1
Host: influxdb:9999
User-Agent: Grafana/7.1.0
Content-Length: 5
Accept: application/json, text/plain, /
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.5
Authorization: Basic Og==
Content-Type: application/x-www-form-urlencoded
X-Forwarded-For: _
Verified - I have the same error as @hugodlg Testing with Grafana 7.1.0 & InfluxDB 2.0.0 (beta12).
Hi, I'm facing the same issue. Is there any fix or workaround for ? I'm using the version of Grafana 7.1.4 & InfluxDB 1.8.1
I‘ve given up on Geafana and switched to Cronograf :/
This is my workaround for this issue. I'm replacing the string from the filter and as it's a string, I'm transforming the string into a regex using regexp.compile.
`import "strings" import "regexp"
// Workaround to Replace invalid filter characters from Grafana in order // to build a valid Regex to be used on Flux Filter V_EID = strings.replace(v: "$EID", t: "{", u: "^(", i: -1) V_EID_2 = strings.replace(v: V_EID, t: ",", u: ")|(", i: -1) V_EID_3 = strings.replace(v: V_EID_2, t: "}", u: ")", i: -1)
from(bucket: "database") |> range(start: -600d) |> filter(fn: (r) => r._measurement == "ptable" and (r._field == "ETX_P+L")) |> filter(fn: (r) => r["EID"] =~ regexp.compile(v: V_EID_3)) `
After upgrading to Grafana 7.0 and using the version 7.0.0, dasboard variable seems to be broken.
With Grafana 6.7 and plugin v5.4.1 I was able to run query like so
in the dashboard settings > variables and using the text input "Query".
In the last release it seems that the query is not even executed, no error and no log.