Repository navigation
Conversation
b776114 to
9c6c7a4
Compare
|
Rebased onto
The Local verification on this rebase: |
|
All four checks are green on the rebase: |
9c6c7a4 to
effa7cf
Compare
effa7cf to
9ee04e5
Compare
|
Rebased |
|
Update: the commit messages on this branch no longer contain any |
9ee04e5 to
2b0bb7f
Compare
The counters and Mark helpers now live on main (via syncronix-labs#50/syncronix-labs#52). These tests cover their zero value, increments, independent accounting, and concurrent use in the metrics, queue and shedding packages. Signed-off-by: CJstate <142857225+CJstate@users.noreply.github.com>
2b0bb7f to
3317758
Compare
|
Hi, following up on this PR. The current head no longer carries any Co-Authored-By or AI attribution trailer, and CI is green. If there is anything else blocking the merge, please let me know; otherwise could you re-submit the review? Thanks. |
|
Thanks for the review. The commit on this PR has been rewritten and no longer carries any |
Closes #17.
What
Two new counters, both registered in
internal/metricsalongside the existing RED collectors:aegora_shed_total{route}鈥?requests rejected by the AIMD controlleraegora_queue_dropped_total{route}鈥?requests dropped by the admission queue (full depth, CoDel, or shutdown)How the counters get wired
The shedding controller and the admission queue do not import
internal/metricsand do not receive a registry. When they reject a request they set anX-Aegora-Dropresponse header (shedding/queue), and the metrics middleware 鈥?which already wraps everything downstream and already computes the route label 鈥?increments the matching counter when the request completes.Why this shape instead of passing counters into
NewController/NewQueue:aegora_requests_totalfor the same request, which is what makesrate(shed_total)/rate(requests_total)ratios work in one PromQL query.writeOverloadedJSONis shared by all three queue drop sites (not running, full depth, dropped ticket), so the increment is consistent by construction.The header is written only on the 503 responses the gateway generates itself and is observable like the existing
X-RateLimit-*headers; clients that ignore it are unaffected.Kept independent of #50
An earlier revision of this branch also reused
httperr.Writefrom #50 to render the 503 body. That made this branch fail to compile on its own (no required module provides package .../internal/httperr). The drop counters do not depend on how the body is rendered, so the branch keeps the original inline JSON body and the two PRs can land in either order.Tests
internal/metrics/drop_metrics_test.go鈥?marker 鈫?counter mapping, route label consistency, and a plain 503 leaving both counters untouched.internal/shedding/shed_metrics_test.go鈥?end-to-end: shedding under the metrics middleware, deterministic shed viaadmitRateforced near zero (same technique asTestController_RejectsOverload), assertsaegora_shed_totalincrements and the handler is never reached.internal/queue/queue_metrics_test.go鈥?end-to-end: full queue rejects the next request, assertsaegora_queue_dropped_totalincrements.Verification
All pass locally, and CI (
build,test,lint,docker) is green onb776114.