From 8948cd5486cd37f3d1bd8fc13def787e318215a9 Mon Sep 17 00:00:00 2001 From: B Tasker <88340935+btasker@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:28:29 +0100 Subject: [PATCH 1/7] docs: make description less ambiguous about what the function does --- .../stdlib/influxdata/influxdb/cardinality.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md index 0a1d5672f..40429d941 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md @@ -1,7 +1,7 @@ --- title: influxdb.cardinality() function description: > - `influxdb.cardinality()` returns the series cardinality of data stored in InfluxDB. + `influxdb.cardinality()` returns the series cardinality of data retrieved from InfluxDB. menu: flux_v0_ref: name: influxdb.cardinality @@ -28,9 +28,16 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md -------------------------------------------------------------------------------> -`influxdb.cardinality()` returns the series cardinality of data stored in InfluxDB. +`influxdb.cardinality()` returns the series cardinality of data retrieved from InfluxDB. +{{% note %}} +Although this function is similar to InfluxQL's [`SHOW SERIES CARDINALITY`](/influxdb/v1/query_language/spec/#show-series-cardinality), +it works in a slightly different manner. + +`influxdb.cardinality()` is time bounded and reports the cardinality of the data that's passed into it rather than the cardinality of the bucket as a whole. +{{% /note %}} + ##### Function type signature @@ -107,6 +114,12 @@ The cardinality calculation excludes points that match the specified start time. Use a relative duration or absolute time. For example, `-1h` or `2019-08-28T22:00:00Z`. Durations are relative to `now()`. Default is `now()`. +{{% note %}} +The default value is `now()`, so any points that have been written into the future will +not be counted unless a future `stop` date is provided. +{{% /note %}} + + ### predicate Predicate function that filters records. From 9549bacbb8529a7abf80244b717a1f61465a0c6b Mon Sep 17 00:00:00 2001 From: B Tasker <88340935+btasker@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:29:21 +0100 Subject: [PATCH 2/7] fix: adjust examples to do what the headers suggest --- content/flux/v0/stdlib/influxdata/influxdb/cardinality.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md index 40429d941..20461bd58 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md @@ -139,9 +139,10 @@ Default is `(r) => true`. ```js import "influxdata/influxdb" -influxdb.cardinality(bucket: "example-bucket", start: -1y) +influxdb.cardinality(bucket: "example-bucket", start: 1) ``` +Note: if points have been written into the future, you will need to add an appropriate `stop` date ### Query series cardinality in a measurement// @@ -151,7 +152,7 @@ import "influxdata/influxdb" influxdb.cardinality( bucket: "example-bucket", - start: -1y, + start: 1, predicate: (r) => r._measurement == "example-measurement", ) @@ -163,7 +164,7 @@ influxdb.cardinality( ```js import "influxdata/influxdb" -influxdb.cardinality(bucket: "example-bucket", start: -1y, predicate: (r) => r.exampleTag == "foo") +influxdb.cardinality(bucket: "example-bucket", start: 1, predicate: (r) => r.exampleTag == "foo") ``` From 71c36d7a74301f489d4751368a049ad3779277a5 Mon Sep 17 00:00:00 2001 From: B Tasker <88340935+btasker@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:33:06 +0100 Subject: [PATCH 3/7] fix: use correct closing tag --- content/influxdb/v2/reference/faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/influxdb/v2/reference/faq.md b/content/influxdb/v2/reference/faq.md index 5e134a7bc..a0e692d5c 100644 --- a/content/influxdb/v2/reference/faq.md +++ b/content/influxdb/v2/reference/faq.md @@ -1088,7 +1088,7 @@ Each InfluxDB Cloud organization has a series cardinality limit to prevent runaway cardinality. For information about adjusting cardinality limits, see [How do I increase my organization’s rate limits and quotas?](#how-do-i-increase-my-organizations-rate-limits-and-quotas). -{{% /oss-only %}} +{{% /cloud-only %}} Use [`influxdb.cardinality()`](/flux/v0/stdlib/influxdata/influxdb/cardinality/) in Flux or [`SHOW SERIES CARDINALITY`](/influxdb/v1/query_language/spec/#show-series-cardinality) From a5e499219535988e81cc0836ec310f6a10194255 Mon Sep 17 00:00:00 2001 From: B Tasker <88340935+btasker@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:19:51 +0100 Subject: [PATCH 4/7] docs: tweak wording --- content/flux/v0/stdlib/influxdata/influxdb/cardinality.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md index 20461bd58..3beb80893 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md @@ -35,7 +35,7 @@ Fluxdoc syntax: https://github.com/influxdata/flux/blob/master/docs/fluxdoc.md Although this function is similar to InfluxQL's [`SHOW SERIES CARDINALITY`](/influxdb/v1/query_language/spec/#show-series-cardinality), it works in a slightly different manner. -`influxdb.cardinality()` is time bounded and reports the cardinality of the data that's passed into it rather than the cardinality of the bucket as a whole. +`influxdb.cardinality()` is time bounded and reports the cardinality of data that matches the conditions passed into it rather than that of the bucket as a whole. {{% /note %}} From 531afe7b6b88d29a15a0823eb8662d8ad0a67f4a Mon Sep 17 00:00:00 2001 From: B Tasker <88340935+btasker@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:27:21 +0100 Subject: [PATCH 5/7] fix: influxdb.cardinality() can't accept an integer as start --- content/flux/v0/stdlib/influxdata/influxdb/cardinality.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md index 3beb80893..70e68c66f 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md @@ -139,7 +139,7 @@ Default is `(r) => true`. ```js import "influxdata/influxdb" -influxdb.cardinality(bucket: "example-bucket", start: 1) +influxdb.cardinality(bucket: "example-bucket", start: time(v: 1)) ``` Note: if points have been written into the future, you will need to add an appropriate `stop` date @@ -152,7 +152,7 @@ import "influxdata/influxdb" influxdb.cardinality( bucket: "example-bucket", - start: 1, + start: time(v: 1), predicate: (r) => r._measurement == "example-measurement", ) @@ -164,7 +164,7 @@ influxdb.cardinality( ```js import "influxdata/influxdb" -influxdb.cardinality(bucket: "example-bucket", start: 1, predicate: (r) => r.exampleTag == "foo") +influxdb.cardinality(bucket: "example-bucket", start: time(v: 1), predicate: (r) => r.exampleTag == "foo") ``` From 92b95a94954aed17187cb99f96425feb9a47b892 Mon Sep 17 00:00:00 2001 From: B Tasker <88340935+btasker@users.noreply.github.com> Date: Wed, 2 Oct 2024 15:28:26 +0100 Subject: [PATCH 6/7] feat: add example --- .../flux/v0/stdlib/influxdata/influxdb/cardinality.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md index 70e68c66f..c6c845c08 100644 --- a/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md +++ b/content/flux/v0/stdlib/influxdata/influxdb/cardinality.md @@ -133,6 +133,7 @@ Default is `(r) => true`. - [Query series cardinality in a bucket](#query-series-cardinality-in-a-bucket) - [Query series cardinality in a measurement//](#query-series-cardinality-in-a-measurement) - [Query series cardinality for a specific tag](#query-series-cardinality-for-a-specific-tag) +- [Query series cardinality of Data Written In the Last 4 Hours](#query-series-cardinality-of-data-written-in-the-last-4-hours) ### Query series cardinality in a bucket @@ -168,3 +169,12 @@ influxdb.cardinality(bucket: "example-bucket", start: time(v: 1), predicate: (r) ``` + +### Query Cardinality of Data Written In the Last 4 hours +```js +import "influxdata/influxdb" + +influxdb.cardinality(bucket: "example-bucket", start: -4h) + +``` + From 44ce6e9d69eb353ae3438b9df5093b3c49189ef1 Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Fri, 4 Oct 2024 14:02:30 -0600 Subject: [PATCH 7/7] Note removal of Flux MQTT package support OSS 2.7+ (#5634) * WIP added prepend to mqtt package frontmatter * WIP excluded mqtt package from oss 2.7+ * WIP add nightly version exclude * add nightly exclude to flux function support modal, closes influxdata/DAR#437 * updated mqtt warn message and version exclude pattern * Apply suggestions from code review Co-authored-by: Jason Stirnaman * exclude mqtt package from all oss versions * exclude mqtt package from everything but cloud --------- Co-authored-by: Jason Stirnaman --- data/flux_stdlib_frontmatter.yml | 38 +++++++++++++++++++ .../footer/modals/flux-influxdb-versions.html | 3 +- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/data/flux_stdlib_frontmatter.yml b/data/flux_stdlib_frontmatter.yml index 200c2e545..4b92702e4 100644 --- a/data/flux_stdlib_frontmatter.yml +++ b/data/flux_stdlib_frontmatter.yml @@ -920,11 +920,49 @@ aliases: - /influxdb/v2/reference/flux/stdlib/experimental/mqtt/ - /influxdb/cloud/reference/flux/stdlib/experimental/mqtt/ + prepend: + block: warn + content: | + #### Only supported in InfluxDB Cloud (TSM) + + The `experimental/mqtt` package only supported in InfluxDB Cloud (TSM). + It is still available to import in InfluxDB OSS and Enterprise, but + functions will not successfully publish to an MQTT broker. + exclude_from: + nightly: true + oss: ^* + enterprise: ^* /flux/v0/stdlib/experimental/mqtt/to.md: | aliases: - /influxdb/v2/reference/flux/stdlib/experimental/mqtt/to/ - /influxdb/cloud/reference/flux/stdlib/experimental/mqtt/to/ + prepend: + block: warn + content: | + #### Only supported in InfluxDB Cloud (TSM) + + The `experimental/mqtt` package only supported in InfluxDB Cloud (TSM). + It is still available to import in InfluxDB OSS and Enterprise, but + functions will not successfully publish to an MQTT broker. + exclude_from: + nightly: true + oss: ^* + enterprise: ^* + +/flux/v0/stdlib/experimental/mqtt/publish.md: | + prepend: + block: warn + content: | + #### Only supported in InfluxDB Cloud (TSM) + + The `experimental/mqtt` package only supported in InfluxDB Cloud (TSM). + It is still available to import in InfluxDB OSS and Enterprise, but + functions will not successfully publish to an MQTT broker. + exclude_from: + nightly: true + oss: ^* + enterprise: ^* /flux/v0/stdlib/experimental/oee/_index.md: | aliases: diff --git a/layouts/partials/footer/modals/flux-influxdb-versions.html b/layouts/partials/footer/modals/flux-influxdb-versions.html index 722bfd019..cc69dd83a 100644 --- a/layouts/partials/footer/modals/flux-influxdb-versions.html +++ b/layouts/partials/footer/modals/flux-influxdb-versions.html @@ -45,7 +45,8 @@ {{ $versionSemVer := split $value "." }} {{ $supported := cond (ge (index $versionSemVer 0) (index $introducedSemVer 0)) (cond (ge (index $versionSemVer 1) (index $introducedSemVer 1)) (cond (ge (index $versionSemVer 2) (index $introducedSemVer 2)) true false) false) false }} {{ $deprecated := and (isset $.Page.Params "deprecated") (cond (ge (index $versionSemVer 0) (index $deprecatedSemVer 0)) (cond (ge (index $versionSemVer 1) (index $deprecatedSemVer 1)) (cond (ge (index $versionSemVer 2) (index $deprecatedSemVer 2)) true false) false) false) }} - {{ $excluded := gt (len (findRE (string $excludePatternOSS) $key)) 0 }} + {{ $nightlyExcluded := and (eq $key "nightly") $.Page.Params.exclude_from.nightly }} + {{ $excluded := or (gt (len (findRE (string $excludePatternOSS) $key)) 0) $nightlyExcluded }}

InfluxDB {{ $key }}