Document Labkit::RateLimit in repo README and add module README
Summary
The labkit-ruby README does not currently document the Labkit::RateLimit functionality, even though the module is shipped, in use, and being rolled out across GitLab Rails via Gitlab::ApplicationRateLimiter::LabkitAdapter. There is also no README inside lib/labkit/rate_limit/ to explain the rule/identifier/result model and the Redis-backed evaluator, which would help onboarding for consumers and maintainers.
This issue tracks adding both pieces of documentation.
Scope
- Add a
Labkit::RateLimitentry to the Functionality list in the rootREADME.md, with a pointer to the module README (same pattern asLabkit::Metrics,Labkit::UserExperienceSli,Labkit::RSpec). - Create
lib/labkit/rate_limit/README.mdcovering:- What the module does and how it differs from a divmod-window limiter
- Configuration (global
Labkit::RateLimit.configure, Redis connection pool requirement) - Constructing a
Limiterand thecheck/peekAPI Identifierand the characteristic / match modelRulesemantics:limit,period,action(:block/:log/:allow),match,characteristics, and the first-match-wins evaluation order (with the special non-terminating behavior of:log)ResultAPI includingto_response_headers- Emitted Prometheus metrics (names and labels)
- Fail-open behavior on Redis error
Acceptance criteria
- Root
README.mdlistsLabkit::RateLimitwith a link to the module README -
lib/labkit/rate_limit/README.mdexists and covers the items above - MR linked to this issue and to the parent epic
Related
- Parent epic: gitlab-com/gl-infra&2021