Webserver: expose concurrency-cap rejections and in-flight count in RequestStats; rate-limited WARN
Unit 2. Make the per-CUD concurrency cap from unit 1 observable without a new API. Full design: agent-plans PLAN-015.
src/main/java/io/supertokens/webserver/RequestStats.java (per app,
already scraped by the SaaS via /requests/stats): add
"concurrentRequestsRejected" (count since process start, incremented
on each 429 from ConcurrencyLimiter for the request's app) and
"concurrentRequestsInFlight" (current inFlight() of the app's CUD
limiter) to getStats().
ConcurrencyLimiter.onRejected(main, tenantIdentifier): increment the
app's rejected counter, add the test process state, and log ONE
Logging.warn(main, tenantIdentifier, "Concurrent request cap (N) reached for <cud>; rejecting with 429") at most once per CUD per 60 s
(keep a volatile long lastWarnAtMillis on the limiter) — never per
request, a saturated tenant would flood the log.
Tests: the rejected counter and in-flight count appear in
/requests/stats after a rejection; two rejections within a minute
produce one WARN line.
BASE BRANCH: cut from the head of origin/12.3 once unit 1 (#1439) is
merged there, PR --base 12.3, "Base: 12.3" in the PR body. One
CHANGELOG line under the same unreleased section unit 1 used; no
version bump.
Depends-on: #1439 Plan: PLAN-015
Source: supertokens/supertokens-core