diff --git a/content/flux/v0.x/prometheus/metric-types/counter.md b/content/flux/v0.x/prometheus/metric-types/counter.md index 249d95489..c179c51d2 100644 --- a/content/flux/v0.x/prometheus/metric-types/counter.md +++ b/content/flux/v0.x/prometheus/metric-types/counter.md @@ -105,12 +105,13 @@ from(bucket: "example-bucket") #### Example output {id="example-output-2"} | _time | _measurement | _field | _value | | :------------------- | :----------- | :----------------------- | -----: | +| 2021-01-01T00:00:00Z | prometheus | http_query_request_bytes | 0 | | 2021-01-01T00:00:10Z | prometheus | http_query_request_bytes | 542 | | 2021-01-01T00:00:20Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 991 | -| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1538 | -| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1884 | +| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 802 | +| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 1004 | +| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1551 | +| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1897 | {{% /expand %}} {{< /expand-wrapper >}} {{% /tab-content %}} @@ -163,12 +164,14 @@ from(bucket: "example-bucket") #### Example output {id="example-output-1"} | _time | _measurement | _field | _value | | :------------------- | :----------------------- | :------ | -----: | +| 2021-01-01T00:00:00Z | http_query_request_bytes | counter | 0 | | 2021-01-01T00:00:10Z | http_query_request_bytes | counter | 542 | | 2021-01-01T00:00:20Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 991 | -| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1538 | -| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1884 | +| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 802 | +| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 1004 | +| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1551 | +| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1897 | + {{% /expand %}} {{< /expand-wrapper >}} {{% /tab-content %}} @@ -212,18 +215,20 @@ from(bucket: "example-bucket") #### Example normalized counter data {id="example-normalized-counter-data-2"} | _time | _measurement | _field | _value | | :------------------- | :----------- | :----------------------- | -----: | +| 2021-01-01T00:00:00Z | prometheus | http_query_request_bytes | 0 | | 2021-01-01T00:00:10Z | prometheus | http_query_request_bytes | 542 | | 2021-01-01T00:00:20Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 991 | -| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1538 | -| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1884 | +| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 802 | +| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 1004 | +| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1551 | +| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1897 | #### Example difference output {id="example-difference-output-2"} | _time | _measurement | _field | _value | | :------------------- | :----------- | :----------------------- | -----: | +| 2021-01-01T00:00:10Z | prometheus | http_query_request_bytes | 542 | | 2021-01-01T00:00:20Z | prometheus | http_query_request_bytes | 247 | -| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 0 | +| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 13 | | 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 202 | | 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 547 | | 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 346 | @@ -259,18 +264,20 @@ from(bucket: "example-bucket") #### Example normalized counter data {id="example-normalized-counter-data-1"} | _time | _measurement | _field | _value | | :------------------- | :----------------------- | :------ | -----: | +| 2021-01-01T00:00:00Z | http_query_request_bytes | counter | 0 | | 2021-01-01T00:00:10Z | http_query_request_bytes | counter | 542 | | 2021-01-01T00:00:20Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 991 | -| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1538 | -| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1884 | +| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 802 | +| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 1004 | +| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1551 | +| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1897 | #### Example difference output {id="example-difference-output-1"} | _time | _measurement | _field | _value | | :------------------- | :----------------------- | :------ | -----: | +| 2021-01-01T00:00:10Z | http_query_request_bytes | counter | 542 | | 2021-01-01T00:00:20Z | http_query_request_bytes | counter | 247 | -| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 0 | +| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 13 | | 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 202 | | 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 547 | | 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 346 | @@ -320,18 +327,20 @@ from(bucket: "example-bucket") #### Example normalized counter data {id="example-normalized-counter-data-2-1"} | _time | _measurement | _field | _value | | :------------------- | :----------- | :----------------------- | -----: | +| 2021-01-01T00:00:00Z | prometheus | http_query_request_bytes | 0 | | 2021-01-01T00:00:10Z | prometheus | http_query_request_bytes | 542 | | 2021-01-01T00:00:20Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 991 | -| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1538 | -| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1884 | +| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 802 | +| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 1004 | +| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1551 | +| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1897 | #### Example derivative output {id="example-derivative-output-2"} | _time | _measurement | _field | _value | | :------------------- | :----------- | :----------------------- | -----: | +| 2021-01-01T00:00:10Z | prometheus | http_query_request_bytes | 54.2 | | 2021-01-01T00:00:20Z | prometheus | http_query_request_bytes | 24.7 | -| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 0.0 | +| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 1.3 | | 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 20.2 | | 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 54.7 | | 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 34.6 | @@ -367,18 +376,20 @@ from(bucket: "example-bucket") #### Example normalized counter data {id="example-normalized-counter-data-1-1"} | _time | _measurement | _field | _value | | :------------------- | :----------------------- | :------ | -----: | +| 2021-01-01T00:00:00Z | http_query_request_bytes | counter | 0 | | 2021-01-01T00:00:10Z | http_query_request_bytes | counter | 542 | | 2021-01-01T00:00:20Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 991 | -| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1538 | -| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1884 | +| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 802 | +| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 1004 | +| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1551 | +| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1897 | #### Example derivative output {id="example-derivative-output-1"} | _time | _measurement | _field | _value | | :------------------- | :----------------------- | :------ | -----: | +| 2021-01-01T00:00:10Z | http_query_request_bytes | counter | 54.2 | | 2021-01-01T00:00:20Z | http_query_request_bytes | counter | 24.7 | -| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 0.0 | +| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 1.3 | | 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 20.2 | | 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 54.7 | | 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 34.6 | @@ -444,19 +455,20 @@ from(bucket: "example-bucket") #### Example normalized counter data {id="example-normalized-counter-data-2-2"} | _time | _measurement | _field | _value | | :------------------- | :----------- | :----------------------- | -----: | +| 2021-01-01T00:00:00Z | prometheus | http_query_request_bytes | 0 | | 2021-01-01T00:00:10Z | prometheus | http_query_request_bytes | 542 | | 2021-01-01T00:00:20Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 789 | -| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 991 | -| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1538 | -| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1884 | +| 2021-01-01T00:00:30Z | prometheus | http_query_request_bytes | 802 | +| 2021-01-01T00:00:40Z | prometheus | http_query_request_bytes | 1004 | +| 2021-01-01T00:00:50Z | prometheus | http_query_request_bytes | 1551 | +| 2021-01-01T00:01:00Z | prometheus | http_query_request_bytes | 1897 | #### Example aggregate.rate output {id="example-aggregaterate-output-2"} | _time | _value | | :------------------- | -----: | -| 2021-01-01T00:00:15Z | | +| 2021-01-01T00:00:15Z | 54.2 | | 2021-01-01T00:01:30Z | 24.7 | -| 2021-01-01T00:01:45Z | 10.1 | +| 2021-01-01T00:01:45Z | 10.75 | | 2021-01-01T00:01:00Z | 54.7 | {{% /expand %}} @@ -495,19 +507,20 @@ from(bucket: "example-bucket") #### Example normalized counter data {id="example-normalized-counter-data-1-2"} | _time | _measurement | _field | _value | | :------------------- | :----------------------- | :------ | -----: | +| 2021-01-01T00:00:00Z | http_query_request_bytes | counter | 0 | | 2021-01-01T00:00:10Z | http_query_request_bytes | counter | 542 | | 2021-01-01T00:00:20Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 789 | -| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 991 | -| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1538 | -| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1884 | +| 2021-01-01T00:00:30Z | http_query_request_bytes | counter | 802 | +| 2021-01-01T00:00:40Z | http_query_request_bytes | counter | 1004 | +| 2021-01-01T00:00:50Z | http_query_request_bytes | counter | 1551 | +| 2021-01-01T00:01:00Z | http_query_request_bytes | counter | 1897 | #### Example aggregate.rate output {id="example-aggregaterate-output-1"} | _time | _value | | :------------------- | -----: | -| 2021-01-01T00:00:15Z | | +| 2021-01-01T00:00:15Z | 54.2 | | 2021-01-01T00:01:30Z | 24.7 | -| 2021-01-01T00:01:45Z | 10.1 | +| 2021-01-01T00:01:45Z | 10.75 | | 2021-01-01T00:01:00Z | 54.7 | {{% /expand %}} diff --git a/content/flux/v0.x/prometheus/metric-types/gauge.md b/content/flux/v0.x/prometheus/metric-types/gauge.md index 9860d81dd..c83e1237e 100644 --- a/content/flux/v0.x/prometheus/metric-types/gauge.md +++ b/content/flux/v0.x/prometheus/metric-types/gauge.md @@ -70,7 +70,6 @@ from(bucket: "example-bucket") r._measurement == "prometheus" and r._field == "go_goroutines" ) - |> increase() |> derivative(nonNegative: true) ``` @@ -128,7 +127,6 @@ from(bucket: "example-bucket") r._measurement == "go_goroutines" and r._field == "gauge" ) - |> increase() |> derivative(nonNegative: true) ``` diff --git a/content/flux/v0.x/release-notes.md b/content/flux/v0.x/release-notes.md index 17ef4f0ef..238c8c597 100644 --- a/content/flux/v0.x/release-notes.md +++ b/content/flux/v0.x/release-notes.md @@ -10,6 +10,113 @@ aliases: - /influxdb/cloud/reference/release-notes/flux/ --- +## v0.143.1 [2021-11-22] + +### Bug fixes +- Add targets to `rust-toolchain`. + +--- + +## v0.143.0 [2021-11-22] + +### Breaking changes +- Add new parameters to [`difference()`](/flux/v0.x/stdlib/universe/difference/) + to ensure [`increase()`](/flux/v0.x/stdlib/universe/increase/) returns more accurate results on counter reset. + +### Features +- Don't introduce constraints for default arguments. +- Make error messages more consistent. +- Use new versions of `sort()` and `derivative()` by default. +- Add inline documentation to the following packages: + - contrib/anaisdg/anomalydetection + - contrib/anaisdg/statsmodels + - contrib/bonitoo-io/victorops + - contrib/bonitoo-io/zenoss + - contrib/jsternberg/influxdb + - contrib/rhajek/bigpanda + - contrib/sranka/telegram + - experimental + +### Bug fixes +- Validate examples in inline documentation as part of CI linting process. +- Correctly handle trailing dollar signs in string expression. +- Improve `fluxdoc` error messages. +- Fix panic when `length()` is given a stream of tables. +- Fix panic when `json.encode()` is given a stream of tables. + +--- + +## v0.142.0 [2021-11-22] + +### Features +- Default to erroring dependencies + +### Bug fixes +- Fix Queryd panic when using the `experimental/geo` package. + +--- + +## v0.141.0 [2021-11-22] + +### Features +- Add `is_type` to query the runtime type. +- Add ability to read options from the `Context`. +- Ignore documentation for values prefixed with an underscore (`_`). +- Add inline documentation to the following packages: + - contrib/RohanSreerama5/naiveBayesClassifier + - contrib/bonitoo-io/alerta + - contrib/bonitoo-io/hex + - contrib/bonitoo-io/servicenow + - contrib/bonitoo-io/tickscript + - contrib/chobbs/discord + - contrib/jsternberg/rows/ + - contrib/sranka/opsgenie + - contrib/sranka/sensu/ + - contrib/sranka/teams + - contrib/sranka/webexteams + - contrib/tomhollingworth/events + - generate + - http + - influxdata/influxdb + - influxdata/influxdb/monitor + - influxdata/influxdb/sample + - influxdata/influxdb/schema + - influxdata/influxdb/secrets + - influxdata/influxdb/tasks + - influxdata/influxdb/v1 + +### Bug fixes +- Propagate the element type through array constructors. +- Catch unsupported input types in aggregate transformations. +- Support pipe parameters (`<-`) in `fluxdoc`. +- Fix documentation errors when running `cargo doc`. +- Reduce the amount of extra parse errors. + +--- + +## v0.140.0 [2021-11-22] + +### Features +- Support reporting unlimited diagnostics. +- Support type inference running on invalid ASTs. +- Add erroring versions for each dependency. +- Report multiple errors from type inference. +- Add `fluxdoc` formatting documentation. +- Add inline documentation to the following packages: + - array + - csv + - dict + +### Bug fixes +- Handle errors when executing inline examples. +- Convert fixed array to slice. +- Compare sorted join keys. +- Make multiline-formatting consistent. +- Fix invalid syntax formatting. +- Improve error checking for null and invalid types. + +--- + ## v0.139.0 [2021-11-01] ### Features @@ -1882,7 +1989,7 @@ In Flux 0.39.0, `holtWinters()` can cause the query engine to panic. ## v0.37.2 [2019-07-24] -- _General cleanup of internal code._ +- _General cleanup of internal code._ --- diff --git a/content/flux/v0.x/stdlib/universe/difference.md b/content/flux/v0.x/stdlib/universe/difference.md index 0eda5d8db..74136287e 100644 --- a/content/flux/v0.x/stdlib/universe/difference.md +++ b/content/flux/v0.x/stdlib/universe/difference.md @@ -24,9 +24,10 @@ _**Output data type:** Float_ ```js difference( - nonNegative: false, - columns: ["_value"], - keepFirst: false + nonNegative: false, + columns: ["_value"], + keepFirst: false, + initialZero: false, ) ``` @@ -34,7 +35,8 @@ difference( ### nonNegative {data-type="bool"} Indicates if the difference is allowed to be negative. -When set to `true`, if a value is less than the previous value, it is assumed the previous value should have been a zero. +When set to `true`, if a value is less than the previous value, the function +assumes the previous value should have been a zero. Default is `false`. ### columns {data-type="array of strings"} @@ -46,6 +48,12 @@ Indicates the first row should be kept. If `true`, the difference will be `null`. Default is `false`. +### initialZero {data-type="bool"} +Use zero (`0`) as the initial value in the difference calculation when the +subsequent value is less than the previous value and [`nonNegative`](#nonnegative) +is `true`. +Default is `false`. + ### tables {data-type="stream of tables"} Input data. Default is piped-forward data ([`<-`](/flux/v0.x/spec/expressions/#pipe-expressions)). @@ -56,6 +64,9 @@ Default is piped-forward data ([`<-`](/flux/v0.x/spec/expressions/#pipe-expressi - `null` minus some value is always `null`; - Some value `v` minus `null` is `v` minus the last non-null value seen before `v`; or `null` if `v` is the first non-null value seen. +- If `nonNegative` and `initialZero` are set to true, `difference()` returns the + difference between 0 and the subsequent value. If the subsequent value is + less than zero, `difference()` returns _null_. ## Output tables For each input table with `n` rows, `difference()` outputs a table with `n - 1` rows. @@ -71,12 +82,12 @@ For each input table with `n` rows, `difference()` outputs a table with `n - 1` #### Calculate the difference between subsequent values ```js -import "sample" +import "sampledata" -data = sample.int() +data = sampledata.int() data - |> difference() + |> difference() ``` {{< expand-wrapper >}} @@ -119,7 +130,7 @@ import "sampledata" data = sampledata.int() data - |> difference(nonNegative: true): + |> difference(nonNegative: true): ``` {{< expand-wrapper >}} @@ -163,7 +174,7 @@ import "sampledata" data = sampledata.int(includeNull: true) data - |> difference() + |> difference() ``` {{< expand-wrapper >}} @@ -204,7 +215,7 @@ data import "sampledata" sampledata.int() - |> difference(keepFirst: true) + |> difference(keepFirst: true) ``` {{% expand "View input and output" %}} diff --git a/content/flux/v0.x/stdlib/universe/increase.md b/content/flux/v0.x/stdlib/universe/increase.md index ae466fbbb..27c0ed2c1 100644 --- a/content/flux/v0.x/stdlib/universe/increase.md +++ b/content/flux/v0.x/stdlib/universe/increase.md @@ -72,19 +72,21 @@ sampledata.int() | _time | tag | _value | | :------------------- | :-- | -----: | +| 2021-01-01T00:00:00Z | t1 | 0 | | 2021-01-01T00:00:10Z | t1 | 12 | -| 2021-01-01T00:00:20Z | t1 | 12 | -| 2021-01-01T00:00:30Z | t1 | 22 | -| 2021-01-01T00:00:40Z | t1 | 22 | -| 2021-01-01T00:00:50Z | t1 | 22 | +| 2021-01-01T00:00:20Z | t1 | 19 | +| 2021-01-01T00:00:30Z | t1 | 29 | +| 2021-01-01T00:00:40Z | t1 | 44 | +| 2021-01-01T00:00:50Z | t1 | 48 | | _time | tag | _value | | :------------------- | :-- | -----: | -| 2021-01-01T00:00:10Z | t2 | 0 | -| 2021-01-01T00:00:20Z | t2 | 0 | -| 2021-01-01T00:00:30Z | t2 | 22 | -| 2021-01-01T00:00:40Z | t2 | 22 | -| 2021-01-01T00:00:50Z | t2 | 22 | +| 2021-01-01T00:00:00Z | t2 | 0 | +| 2021-01-01T00:00:10Z | t2 | 4 | +| 2021-01-01T00:00:20Z | t2 | 4 | +| 2021-01-01T00:00:30Z | t2 | 26 | +| 2021-01-01T00:00:40Z | t2 | 39 | +| 2021-01-01T00:00:50Z | t2 | 40 | {{% /flex-content %}} {{< /flex >}} @@ -93,8 +95,7 @@ sampledata.int() ## Function definition ```js -increase = (tables=<-, column="_value") => - tables - |> difference(nonNegative: true, column:column) +increase = (tables=<-, columns=["_value"]) => tables + |> difference(nonNegative: true, columns: column, keepFirst: true, initialZero: true) |> cumulativeSum() ```