grafana/pkg/tsdb/influxdb
Jonathan A. Sternberg bdfbc2453f Use parenthesis to surround the selected tags for influxdb queries (#9131)
The generated queries when selecting multiple tags are incorrect. In
InfluxQL, `AND` has a higher precedence than `OR` so the condition:

    WHERE "hostname" = 'server1' OR "hostname" = 'server2' AND time > now() - 5m

This is parsed as if it were:

    WHERE "hostname" = 'server1' OR ("hostname" = 'server2' AND time > now() - 5m)

But the intention is to write a query like this:

    WHERE ("hostname" = 'server1' OR "hostname" = 'server2') AND time > now() - 5m

This change modifies the generated query so it surrounds a query with
multiple conditions in parenthesis so it doesn't conflict with the time
expression in an unexpected way.

This is currently not an issue because InfluxDB doesn't actually
evaluate the condition for the time expression correctly. It just looks
through the AST for anything that looks like a time expression and then
assumes the proper format of `AND` was used rather than validating that
it was used correctly.
2017-08-31 09:33:03 +02:00
..
influxdb.go Use cache for http.client in tsdb package. (#6833) 2016-12-07 11:10:42 +01:00
model_parser_test.go Use cache for http.client in tsdb package. (#6833) 2016-12-07 11:10:42 +01:00
model_parser.go Use cache for http.client in tsdb package. (#6833) 2016-12-07 11:10:42 +01:00
models.go fix(influxdb): fixes broken raw query usage 2016-11-10 14:18:10 +01:00
query_part_test.go feat(templating): completed work on built in template variables and , closes #7190, refactors #7170 2017-01-11 12:10:26 +01:00
query_part.go influxdb: holt winters edits 2017-04-11 14:40:08 +02:00
query_test.go Use parenthesis to surround the selected tags for influxdb queries (#9131) 2017-08-31 09:33:03 +02:00
query.go Use parenthesis to surround the selected tags for influxdb queries (#9131) 2017-08-31 09:33:03 +02:00
response_parser_test.go style: go fmt with simplify 2017-01-27 15:21:02 +01:00
response_parser.go fix(alerting): fixed evaluation for no_value condition, fixes #7244 (#7247) 2017-01-13 12:32:30 +01:00