Flux function types and categories
Flux functions share a set of behaviors or traits that define how the function works. This types and categories lists below are not all-inclusive, but covers distinct and important function behaviors.
The icon indicates the function is experimental.
Function types
Inputs
Flux input functions return data from data sources. The following input functions are available:
- array.from()
- bigtable.from()
- clickhouse.query()
- csv.from()
- from()
- from()
- generate.from()
- http.get() – (deprecated)
- influxdb.select()
- iox.from()
- iox.sql()
- logql.query_range()
- monitor.logs()
- prometheus.scrape()
- query.inBucket()
- requests.do()
- requests.do() – (deprecated)
- requests.get()
- requests.get() – (deprecated)
- requests.post()
- requests.post() – (deprecated)
- socket.from()
- usage.from()
- v1.json()
Outputs
Flux output functions yield results or send data to a specified output destination. The following output functions are are available:
Transformations
Flux transformations take a stream of tables as input, transform the data in some way, and output a stream of tables. Transformations cover a broad range of functions, but the following categorizations highlight important behaviors associated with specific transformation functions.
aggregateWindow helper function
The aggregateWindow()
function
windows or groups data by time and applies an aggregate or selector function
to input tables.
All aggregate and selector functions work with aggregateWindow()
.
Aggregates
Flux aggregate functions are transformations aggregate values from input tables in some way. Output tables contain a single row with the aggregated value. Aggregate transformations output a table for every input table they receive.
Each output table from an aggregate function will:
- Contain a single record.
- Have the same group key as the input table.
- Contain the an aggregated column.
The column label will be the same as the input table.
The column data type depends on the specific aggregate operation.
The value of the column will be
null
if the input table is empty or the input column has onlynull
values. - Drop all columns that are:
- not in the group key
- not the aggregated column
The following aggregate functions are available:
- aggregate.rate()
- aggregateWindow()
- count()
- cov()
- covariance()
- experimental.count()
- experimental.histogramQuantile()
- experimental.integral()
- experimental.mean()
- experimental.mode()
- experimental.quantile()
- experimental.skew()
- experimental.spread()
- experimental.stddev()
- experimental.sum()
- geo.ST_LineString()
- geo.totalDistance()
- integral()
- mean()
- median()
- mode()
- pearsonr()
- prometheus.histogramQuantile()
- quantile()
- reduce()
- skew()
- spread()
- stddev()
- sum()
- timeWeightedAvg()
Aggregate selectors
The following functions are both aggregates and selectors.
Each returns n
values after performing an aggregate operation.
They are categorized as selector functions in this documentation:
Selectors
Flux selector functions are transformations that return one or more record per input table.
Each output table from a selector function will:
- Contain one or more unmodified records.
- Have the same group key as the input table.
The following selector functions are available:
- aggregateWindow()
- bottom()
- distinct()
- experimental.distinct()
- experimental.first()
- experimental.last()
- experimental.max()
- experimental.min()
- experimental.quantile()
- experimental.unique()
- first()
- highestAverage()
- highestCurrent()
- highestMax()
- last()
- limit()
- lowestAverage()
- lowestCurrent()
- lowestMin()
- max()
- median()
- min()
- quantile()
- sample()
- top()
- unique()
Selectors and aggregates
The following functions can be used as both selectors or aggregates, but they are categorized as aggregate functions in this documentation:
Dynamic queries
Flux dynamic query functions extract a table from a stream of tables and access its columns and records. For recommended usage, see Extract scalar values.
Function categories
The following categories represent high-level function behaviors.
Filters
Filter functions iterate over and evaluate each input row to see if it matches specified conditions. Rows that do not match the specified conditions are dropped from the output. The following filter functions are available:
- filter()
- geo.filterRows()
- geo.gridFilter()
- geo.strictFilter()
- hourSelection()
- query.filterFields()
- query.filterMeasurement()
- query.fromRange()
- range()
Type conversions
Flux type conversion functions convert scalar values or columns to a specific data type. The following type conversion functions are available:
- array.toBool()
- array.toDuration()
- array.toFloat()
- array.toInt()
- array.toString()
- array.toTime()
- array.toUInt()
- bool()
- bytes()
- duration()
- dynamic.asArray()
- dynamic.dynamic()
- dynamic.jsonEncode()
- dynamic.jsonParse()
- float()
- int()
- iox.sqlInterval()
- json.encode()
- json.parse()
- regexp.compile()
- string()
- time()
- toBool()
- toFloat()
- toInt()
- toString()
- toTime()
- toUInt()
- uint()
Tests
Flux testing functions test various aspects of data.
Tests return either true
or false
, a transformed stream of tables, or, upon failure, an error.
The following testing functions are available:
- dynamic.isType()
- testing.assertEmpty()
- testing.assertEquals()
- testing.assertEqualValues()
- testing.assertMatches()
- testing.diff()
- testing.shouldError()
- testing.shouldErrorWithCode()
- types.isNumeric()
- types.isType()
Date/time
Flux date/time functions return or operate on time or duration values. The following data/time functions are available:
- boundaries.friday() – (deprecated)
- boundaries.friday()
- boundaries.monday() – (deprecated)
- boundaries.monday()
- boundaries.month() – (deprecated)
- boundaries.month()
- boundaries.saturday() – (deprecated)
- boundaries.saturday()
- boundaries.sunday() – (deprecated)
- boundaries.sunday()
- boundaries.thursday() – (deprecated)
- boundaries.thursday()
- boundaries.tuesday() – (deprecated)
- boundaries.tuesday()
- boundaries.wednesday() – (deprecated)
- boundaries.wednesday()
- boundaries.week() – (deprecated)
- boundaries.week()
- boundaries.yesterday() – (deprecated)
- boundaries.yesterday()
- date.add()
- date.hour()
- date.microsecond()
- date.millisecond()
- date.minute()
- date.month()
- date.monthDay()
- date.nanosecond()
- date.quarter()
- date.scale()
- date.second()
- date.sub()
- date.time()
- date.truncate()
- date.week()
- date.weekDay()
- date.year()
- date.yearDay()
- experimental.addDuration() – (deprecated)
- experimental.alignTime()
- experimental.subDuration() – (deprecated)
- experimental.window()
- hourSelection()
- now()
- system.time()
- timeShift()
- timezone.fixed()
- timezone.location()
- today()
- truncateTimeColumn()
Metadata
Flux metadata functions return metadata from the input stream or from an underlying data source. The following metadata functions are available:
- buckets()
- influxdb.cardinality()
- schema.fieldKeys()
- schema.measurementFieldKeys()
- schema.measurements()
- schema.measurementTagKeys()
- schema.measurementTagValues()
- schema.tagKeys()
- schema.tagValues()
- v1.databases()
- v1.fieldKeys() – (deprecated)
- v1.measurementFieldKeys() – (deprecated)
- v1.measurements() – (deprecated)
- v1.measurementTagKeys() – (deprecated)
- v1.measurementTagValues() – (deprecated)
- v1.tagKeys() – (deprecated)
- v1.tagValues() – (deprecated)
Notification endpoints
Flux notification endpoint functions send notifications to external endpoints or services. The following notification endpoint functions are available:
- alerta.endpoint()
- bigpanda.endpoint()
- discord.endpoint()
- http.endpoint()
- opsgenie.endpoint()
- pagerduty.endpoint()
- pushbullet.endpoint()
- sensu.endpoint()
- servicenow.endpoint()
- slack.endpoint()
- teams.endpoint()
- telegram.endpoint()
- victorops.endpoint()
- webexteams.endpoint()
- zenoss.endpoint()
Geotemporal
Flux geotemporal functions are designed to work with geotemporal data (geographic location over time). The following geotemporal functions are available:
- geo.asTracks()
- geo.filterRows()
- geo.getGrid()
- geo.getLevel()
- geo.gridFilter()
- geo.groupByArea()
- geo.s2CellIDToken()
- geo.s2CellLatLon()
- geo.shapeData()
- geo.ST_Contains()
- geo.ST_Distance()
- geo.ST_DWithin()
- geo.ST_Intersects()
- geo.ST_Length()
- geo.ST_LineString()
- geo.stContains()
- geo.stDistance()
- geo.stLength()
- geo.strictFilter()
- geo.toRows()
- geo.totalDistance()
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for Flux and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.