feat(metrics): project bounded rate-limit aggregates - #52
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
[code]smith (@codesmith-bot) Implement the remaining P3 integration on existing branch The pure boundary already exists in
Run typecheck and focused projection/metrics/server tests before pushing one coherent commit. Keep PR draft. |
OnlineChef
left a comment
There was a problem hiding this comment.
The pure projection is typecheck-green; connect it to the existing registry without adding a parallel metrics state store.
|
greptile-apps Review current head |
Register an optional aggregate-only admission collector on RuntimeMetrics: snapshot() invokes it at most once inside a fail-closed try/catch and projects a detached copy through the existing projection boundary, while prometheus() appends the bounded series from that same snapshot without a second collection. startServer registers the collector right after createServerAdmissionControl when admission is enabled and explicitly clears any stale collector on default-off starts. reset() drops the collector for test/server isolation. Docs list the new bounded series and their enabled-only, process-local, read-only semantics. Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
P3 integration is complete on the existing branch, pushed as f1c2602 to PR #52 (kept draft): #52
Validation: |
Co-authored-by: Codesmith <codesmith-bot@users.noreply.github.com>
|
Pickup status (cloud agent): Implementation complete and CI green. Stale Greptile/Codesmith threads resolved ( Next step: Mark this PR Ready for review (still draft), then merge after #51/#53. Completes the metrics ↔ admission projection lane on top of #42+#45. |
Scope
Projects the merged admission controller's aggregate-only snapshot into the existing metrics registry and both authenticated exports.
rateLimitsubtree only while rate limiting is enabled.surface,source, andresultlabels.The first commits contain the isolated projection/serialization module and focused tests.
RuntimeMetricscollector registration andstartServerwiring follow after the pure boundary passes typecheck.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is enabled.Greptile Summary
This change adds a read-only, bounded projection of aggregate rate-limit state for JSON and Prometheus metrics.
The projection correctly retains current supported surfaces, but adding a future rate-limit surface can silently remove its request decisions from both outputs unless the separate projection whitelist is updated. This affects
src/observability/rate-limit-projection.ts.Merge safety: do not merge until the projection surface list is tied to the authoritative rate-limit surface definition or made exhaustively checked.
Confidence Score: 4/5
What T-Rex did
Comments Outside Diff (1)
General comment
RateLimitSurfaceis authoritative atsrc/ratelimit/token-bucket.ts:3-12, but the observability projection independently hard-codes its accepted surfaces atsrc/observability/rate-limit-projection.ts:34-44.isSurfaceat:59-60only accepts values in that array, andnormalizedRequestsfilters all other request rows at:71-73. Therefore, after a valid union member is added without also changing this projection list, its aggregate row vanishes from the JSON metrics DTO and is consequently absent from Prometheus output emitted at:139-145.RateLimitSurfacegains a member. Add a regression test covering exact union/list parity and projection of every supported surface.Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "fix(metrics): preserve bounded WebSocket..." | Re-trigger Greptile