Documentation

Query the Flux version

InfluxDB Cloud includes specific version of Flux that may or may not support documented Flux functionality. It’s important to know what version of Flux you’re currently using and what functions are supported in that specific version.

To query the version of Flux installed with InfluxDB, use array.from() to create an ad hoc stream of tables and runtime.version() to populate a column with the Flux version.

Because the InfluxDB /api/v2/query endpoint can only return a stream of tables and not single scalar values, you must use array.from() to create a stream of tables.

Run the following query in the InfluxDB user interface, with the influx CLI, or InfluxDB API:

import "array"
import "runtime"

array.from(rows: [{version: runtime.version()}])
  • Copy
  • Fill window

To return the version of Flux installed with InfluxDB using the InfluxDB UI:

  1. Click Data Explorer in the left navigation bar.
  1. Click Script Editor to manually create and edit a Flux query.

  2. Enable the View Raw Data toggle or select one of the following visualization types:

  3. Enter and run the following query:

    import "array"
    import "runtime"
    
    array.from(rows: [{version: runtime.version()}])
    
    • Copy
    • Fill window

To return the version of Flux installed with InfluxDB using the influx CLI, use the influx query command. Provide the following:

  • InfluxDB host, organization, and API token
    (the example below assumes that a CLI configuration is set up and active)
  • Query to execute
$ influx query \
  'import "array"
   import "runtime"

   array.from(rows: [{version: runtime.version()}])'

# Output
Result: _result
Table: keys: []
        version:string
----------------------
              v0.161.0
  • Copy
  • Fill window

To return the version of Flux installed with InfluxDB using the InfluxDB API, use the /api/v2/query endpoint.

Provide the following:

  • InfluxDB Cloud host
  • InfluxDB organization name or ID as a query parameter
  • Authorization header with the Token scheme and your API token
  • Accept: application/csv header
  • Content-type: application/vnd.flux header
  • Query to execute as the request body
curl --request POST \
  http://localhost:8086/api/v2/query?orgID=INFLUX_ORG_ID \
  --header 'Authorization: Token INFLUX_TOKEN' \
  --header 'Accept: application/csv' \
  --header 'Content-type: application/vnd.flux' \
  --data 'import "array"
    import "runtime"

    array.from(rows: [{version: runtime.version()}])'

# Output
,result,table,version
,_result,0,v0.161.0
  • Copy
  • Fill window

Flux version in the Flux REPL

When you run runtime.version() in the Flux REPL, the function returns the version of Flux the REPL was built with, not the version of Flux installed in the instance of InfluxDB you’re querying.


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

InfluxDB 3 Core and Enterprise are now in Beta

InfluxDB 3 Core and Enterprise are now available for beta testing, available under MIT or Apache 2 license.

InfluxDB 3 Core is a high-speed, recent-data engine that collects and processes data in real-time, while persisting it to local disk or object storage. InfluxDB 3 Enterprise is a commercial product that builds on Core’s foundation, adding high availability, read replicas, enhanced security, and data compaction for faster queries. A free tier of InfluxDB 3 Enterprise will also be available for at-home, non-commercial use for hobbyists to get the full historical time series database set of capabilities.

For more information, check out:

InfluxDB Cloud powered by TSM