Documentation

usage.limits() function

usage.limits() is experimental and subject to change at any time.

usage.limits() returns a record containing usage limits for an InfluxDB Cloud organization.

Example output record

{
    orgID: "123",
    rate: {
        readKBs: 1000,
        concurrentReadRequests: 0,
        writeKBs: 17,
        concurrentWriteRequests: 0,
        cardinality: 10000,
    },
    bucket: {maxBuckets: 2, maxRetentionDuration: 2592000000000000},
    task: {maxTasks: 5},
    dashboard: {maxDashboards: 5},
    check: {maxChecks: 2},
    notificationRule: {maxNotifications: 2, blockedNotificationRules: "comma, delimited, list"},
    notificationEndpoint: {blockedNotificationEndpoints: "comma, delimited, list"},
}
Function type signature
(?host: string, ?orgID: string, ?token: string) => A
For more information, see Function type signatures.

Parameters

host

InfluxDB Cloud region URL. Default is "".

(Required if executed outside of your InfluxDB Cloud organization or region).

orgID

InfluxDB Cloud organization ID. Default is "".

(Required if executed outside of your InfluxDB Cloud organization or region).

token

InfluxDB Cloud API token. Default is "".

(Required if executed outside of your InfluxDB Cloud organization or region).

Examples

Get rate limits for your InfluxDB Cloud organization

import "experimental/usage"

usage.limits()

Get rate limits for a different InfluxDB Cloud organization

import "experimental/usage"
import "influxdata/influxdb/secrets"

token = secrets.get(key: "INFLUX_TOKEN")

usage.limits(
    host: "https://us-west-2-1.aws.cloud2.influxdata.com",
    orgID: "x000X0x0xx0X00x0",
    token: token,
)

Output organization limits in a table

import "array"
import "experimental/usage"

limits = usage.limits()

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

import "experimental/usage"
import "influxdata/influxdb"

limits = usage.limits()
bucketCardinality = (bucket) =>
    (influxdb.cardinality(bucket: bucket, start: time(v: 0))
        |> findColumn(fn: (key) => true, column: "_value"))[0]

buckets()
    |> filter(fn: (r) => not r.name =~ /^_/)
    |> map(fn: (r) => ({bucket: r.name, Cardinality: bucketCardinality(bucket: r.name)}))
    |> sum(column: "Cardinality")
    |> map(fn: (r) => ({r with "Cardinality Limit": limits.rate.cardinality}))

Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB Clustered

A highly available InfluxDB 3.0 cluster on your own infrastructure.

InfluxDB Clustered is a highly available InfluxDB 3.0 cluster built for high write and query workloads on your own infrastructure.

InfluxDB Clustered is currently in limited availability and is only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Learn more
Contact InfluxData Sales

The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: