Skip to content

Worker ratelimits binding documentation is ambiguous #25590

@timkelty

Description

@timkelty

Existing documentation URL(s)

What changes are you suggesting?

The configuration for this binding is confusing and ambiguious.

A rate limiting binding has three settings:

namespace_id (number) - a positive integer that uniquely defines this rate limiting configuration - e.g. namespace_id = "999".
limit (number) - the limit (number of requests, number of API calls) to be applied. This is incremented when you call the limit() function in your Worker.
period (seconds) - must be 10 or 60. The period to measure increments to the limit over, in seconds.

  • If namespace_id is a positive integer, why is it a string? Can it be an int?
  • The namespace_id description is worded as if the id just needs to be unique for the given rate limiting configuration
    • This would mean that a ratelimiter in 2 different envs of a worker could share the same namespace_id if they had the same config, but I'm guessing the intention is it needs to be unique per zone/account?
    • If it the case, it would be different from other bindings (e.g. kv_namespaces[].id)
  • There is no mention of the simple key, or what it means.

The Rate Limiting API is backed by the same infrastructure that serves rate limiting rules.

Does this mean that metrics for them would show up in the Cloudflare dashboard somewhere? If not, is there any way to monitor them?

Additional information

No response

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions