Query InfluxDB with the Flux language

interface Query {
    dialect?: Dialect;
    extern?: File;
    now?: string;
    params?: any;
    query: string;
    type?: "flux";
}

Properties

dialect?: Dialect
extern?: File
now?: string

Specifies the time that should be reported as now in the query. Default is the server now time.

params?: any

Key-value pairs passed as parameters during query execution.

To use parameters in your query, pass a query with params references (in dot notation)--for example:

  query: "from(bucket: params.mybucket) |> range(start: params.rangeStart) |> limit(n:1)"

and pass params with the key-value pairs--for example:

  params: {
"mybucket": "environment",
"rangeStart": "-30d"
}

During query execution, InfluxDB passes params to your script and substitutes the values.

  • If you use params, you can't use extern.
query: string

The query script to execute.

type?: "flux"

The type of query. Must be "flux".

MMNEPVFCICPMFPCPTTAAATR