feat(server): Add rejection counters and structured logging for all rejection mechanisms#364
Open
feat(server): Add rejection counters and structured logging for all rejection mechanisms#364
Conversation
…ejection mechanisms Before this change, only web and service concurrency rejections emitted a metric counter. Killswitches and throughput rate limits logged at DEBUG. Bandwidth rate limit rejections were completely silent. Every rejection mechanism now emits a `tracing::warn!` and a metric counter: - Killswitches: `server.request.killswitched` counter; warn includes the full killswitch config (usecase, scopes, service pattern) via Debug formatting - Rate limits: `server.request.rate_limited` counter tagged with `reason` (one of bandwidth_global/usecase/scope, throughput_global/usecase/scope/rule); warn includes the reason field - Web concurrency: existing `web.concurrency.rejected` counter + new warn - Service concurrency: existing `service.concurrency.rejected` counter + new warn The observability logic is colocated with the check itself — `Killswitches::matches` and `RateLimiter::check` emit their own counters and logs, keeping call sites clean. A new `Killswitches::find` method returns the matching `&Killswitch` for callers that need to inspect it directly. Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this change, only web and service concurrency rejections emitted a metric counter on rejection. Killswitches and throughput rate limits logged at
DEBUG. Bandwidth rate limit rejections were completely silent.Every rejection mechanism now emits a
tracing::warn!and a metric counter on every rejected request:server.request.killswitchedcounter; warn includes the full killswitch config via Debug formatting (usecase,scopes,servicepattern)server.request.rate_limitedcounter tagged withreason(one ofbandwidth_global,bandwidth_usecase,bandwidth_scope,throughput_global,throughput_usecase,throughput_scope,throughput_rule); warn includes the reason fieldweb.concurrency.rejectedcounter gains atracing::warn!service.concurrency.rejectedcounter gains atracing::warn!The observability logic is colocated with the check itself —
Killswitches::matchesandRateLimiter::checkemit their own counters and logs, keeping all call sites clean. A newKillswitches::findmethod returns the matching&Killswitchfor callers that need to inspect it directly.Closes #350
Closes FS-275