influxdata / influxdb-comparisons

Code for comparison write ups of InfluxDB and other solutions
MIT License
306 stars 112 forks source link

feat: allow for running influxql queries with compatbibility API #186

Closed williamhbaker closed 3 years ago

williamhbaker commented 3 years ago

Adds a new CLI flag to the query_benchmarker_influxdb command -use-compatibility that will allow InfluxQL HTTP queries to be used with a 2.x influxd server via the compatibility /query API endpoint.

To use this endpoint, DBRPs need to be set up, and a -token needs to be provided with the command.

williamhbaker commented 3 years ago

I see that the flag has been added, but where are the changes that specifically manipulate which endpoint the queries target?

The endpoint that the queries target is in the generated queries file itself, so for InfluxQL queries this will use the /query compatibility endpoint in 2.x. This change allows for an auth token to be provided when running influxql queries. The flag is necessary because previously the benchmarker tool would error out if only a token was provided and no org (both of which are required for flux) - for InfluxQL with the compatibility endpoint it only needs a token.

So with this change, to run InfluxQL queries on a 2.x instance, you can generate the InfluxQL queries normally, then run something like query_benchmarker_influxdb -token $TOKEN -use-compatibility .... and the queries will be run, using an endpoint like http://localhost:8086/query?..... As long as the token is present in the headers this will work with 2.x.

codyshepherd commented 3 years ago

Is this related to #187 ?

williamhbaker commented 3 years ago

Is this related to #187 ?

I think it might be the solution to that issue. I'll have to do a little more digging to see if it's possible to send influxql queries to the api/v2/query endpoint, and if so if it makes a difference vs using the compatibility endpoint.