Add more examples to usage.limits (#3519)
* added more examples to usage.limits, closes #3502 * remove search.html modificationspull/3524/head
parent
e34213e6db
commit
f0f9361fe4
|
@ -17,6 +17,8 @@ weight: 301
|
||||||
flux/v0.x/tags: [functions, usage, package]
|
flux/v0.x/tags: [functions, usage, package]
|
||||||
cascade:
|
cascade:
|
||||||
introduced: 0.114.0
|
introduced: 0.114.0
|
||||||
|
related:
|
||||||
|
- https://www.influxdata.com/influxdb-templates/influxdb-cloud-usage-dashboard/, InfluxDB Cloud Usage – Community Template
|
||||||
---
|
---
|
||||||
|
|
||||||
The Flux experimental usage package provides tools for collecting usage and usage
|
The Flux experimental usage package provides tools for collecting usage and usage
|
||||||
|
|
|
@ -80,6 +80,11 @@ Default is `""`.
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
|
- [Get rate limits for your InfluxDB Cloud organization](#get-rate-limits-for-your-influxdb-cloud-organization)
|
||||||
|
- [Get rate limits for a different InfluxDB Cloud organization](#get-rate-limits-for-a-different-influxdb-cloud-organization)
|
||||||
|
- [Output organization limits in a table](#output-organization-limits-in-a-table)
|
||||||
|
- [Output current cardinality with your cardinality limit](#output-current-cardinality-with-your-cardinality-limit)
|
||||||
|
|
||||||
##### Get rate limits for your InfluxDB Cloud organization
|
##### Get rate limits for your InfluxDB Cloud organization
|
||||||
```js
|
```js
|
||||||
import "experimental/usage"
|
import "experimental/usage"
|
||||||
|
@ -94,9 +99,50 @@ import "influxdata/influxdb/secrets"
|
||||||
|
|
||||||
token = secrets.get(key: "INFLUX_TOKEN")
|
token = secrets.get(key: "INFLUX_TOKEN")
|
||||||
|
|
||||||
usage.limits(
|
usage.limits(host: "https://cloud2.influxdata.com", orgID: "x000X0x0xx0X00x0", token: token)
|
||||||
host: "https://cloud2.influxdata.com",
|
```
|
||||||
orgID: "x000X0x0xx0X00x0",
|
|
||||||
token: token
|
##### Output organization limits in a table
|
||||||
|
```js
|
||||||
|
import "experimental/usage"
|
||||||
|
import "influxdata/influxdb/secrets"
|
||||||
|
|
||||||
|
token = secrets.get(key: "INFLUX_TOKEN")
|
||||||
|
|
||||||
|
limits = usage.limits(host: "https://cloud2.influxdata.com", orgID: "x000X0x0xx0X00x0", token: token)
|
||||||
|
|
||||||
|
array.from(
|
||||||
|
rows: [
|
||||||
|
{orgID: limits.orgID, limitGroup: "rate", limitName: "Read (kb/s)", limit: limits.rate.readKBs},
|
||||||
|
{orgID: limits.orgID, limitGroup: "rate", limitName: "Concurrent Read Requests", limit: limits.rate.concurrentReadRequests},
|
||||||
|
{orgID: limits.orgID, limitGroup: "rate", limitName: "Write (kb/s)", limit: limits.rate.writeKBs},
|
||||||
|
{orgID: limits.orgID, limitGroup: "rate", limitName: "Concurrent Write Requests", limit: limits.rate.concurrentWriteRequests},
|
||||||
|
{orgID: limits.orgID, limitGroup: "rate", limitName: "Cardinality", limit: limits.rate.cardinality},
|
||||||
|
{orgID: limits.orgID, limitGroup: "bucket", limitName: "Max Buckets", limit: limits.bucket.maxBuckets},
|
||||||
|
{orgID: limits.orgID, limitGroup: "bucket", limitName: "Max Retention Period (ns)", limit: limits.bucket.maxRetentionDuration},
|
||||||
|
{orgID: limits.orgID, limitGroup: "task", limitName: "Max Tasks", limit: limits.task.maxTasks},
|
||||||
|
{orgID: limits.orgID, limitGroup: "dashboard", limitName: "Max Dashboards", limit: limits.dashboard.maxDashboards},
|
||||||
|
{orgID: limits.orgID, limitGroup: "check", limitName: "Max Checks", limit: limits.check.maxChecks},
|
||||||
|
{orgID: limits.orgID, limitGroup: "notificationRule", limitName: "Max Notification Rules", limit: limits.notificationRule.maxNotifications},
|
||||||
|
],
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
|
##### Output current cardinality with your cardinality limit
|
||||||
|
```js
|
||||||
|
import "array"
|
||||||
|
import "experimental/usage"
|
||||||
|
import "influxdata/influxdb"
|
||||||
|
import "influxdata/influxdb/secrets"
|
||||||
|
|
||||||
|
host = "https://cloud2.influxdata.com"
|
||||||
|
orgID = "x000X0x0xx0X00x0"
|
||||||
|
token = secrets.get(key: "INFLUX_TOKEN")
|
||||||
|
|
||||||
|
cardinality = (influxdb.cardinality(bucket: "example-bucket", orgID: orgID, host: host, token: token)
|
||||||
|
|> findColumn(fn: (key) => true, column: "_value"))[0]
|
||||||
|
|
||||||
|
limits = usage.limits(host: host, orgID: orgID, token: token)
|
||||||
|
|
||||||
|
array.from(rows: [{cardinality: cardinality, cardinalityLimit: limits.rate.cardinality}])
|
||||||
```
|
```
|
|
@ -72,6 +72,7 @@ exports.handler = (event, context, callback) => {
|
||||||
'.eot': true,
|
'.eot': true,
|
||||||
'.ttf': true,
|
'.ttf': true,
|
||||||
'.woff': true,
|
'.woff': true,
|
||||||
|
'.woff2': true,
|
||||||
'.otf': true,
|
'.otf': true,
|
||||||
'.gz': true,
|
'.gz': true,
|
||||||
'.tar': true,
|
'.tar': true,
|
||||||
|
|
Loading…
Reference in New Issue