1.3 KiB
1.3 KiB
| title | description | menu | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Introduction to Flux | Flux is InfluxData's functional data scripting language designed for querying, analyzing, and acting on data. |
|
Flux is InfluxData's functional data scripting language designed for querying, analyzing, and acting on data.
Flux design principles
Flux is designed to be usable, readable, flexible, composable, testable, contributable, and shareable. Its syntax is largely inspired by 2018's most popular scripting language, Javascript, and takes a functional approach to data exploration and processing.
The following example illustrates querying data stored from the last five minutes,
filtering by the cpu measurement and the cpu=cpu-usage tag, windowing the data in 1 minute intervals,
and calculating the average of each window:
from(bucket:"example-bucket")
|> range(start:-1h)
|> filter(fn:(r) =>
r._measurement == "cpu" and
r.cpu == "cpu-total"
)
|> aggregateWindow(every: 1m, fn: mean)
Get started with Flux
The best way to familiarize yourself with Flux is to walk through creating a simple Flux query.