Repository navigation
refactor: security and rate limit metrics come from spans, and SecurityMetrics and RateLimitMetrics are gone - #404
Merged
Conversation
…tyMetrics and RateLimitMetrics are gone Each login runs in an auth.login span, and token and CSRF rejections, admin checks, lockouts, weak passwords and password resets leave an auth.* span where the metric used to be recorded. RateLimitService leaves rate_limit.request and rate_limit.decision spans. The collector's signaltometrics connector makes the same 15 series from them, and every label survives as a span attribute (decision 3 on #389). The bypass counter now comes from requests whose algorithm is bypassed. Part of #389.
HardMax71
enabled auto-merge (squash)
October 19, 2026 00:06
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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 |
|
|
Codecov Report❌ Patch coverage is
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
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.



Summary
Part of #389, the security and rate limit area. The 15 instruments in
SecurityMetricsandRateLimitMetricsnow come from spans, and every label survives as a span attribute, as decided for #389 (keep the labels instead of switching to HTTP route metrics).Changes
AuthService.loginruns in anauth.loginspan with method and success. Token and CSRF rejections, admin route checks, lockouts, logins on locked accounts, weak passwords and admin password resets each leave anauth.*span where the metric used to be recorded.RateLimitServiceleaves arate_limit.requestspan per check and arate_limit.decisionspan when a rule applies. The bypass counter comes from requests whose algorithm isbypassed. The collector'ssignaltometricsconnector makes the same 15 series, and the two dashboards use the new label names (auth_reason,rate_limit_endpoint, ...). The services taketrace.Tracer.Type of Change
Test Plan
cd backend && uv run pytest tests/unit)cd frontend && npm run test)docker compose exec -T backend sh -c 'uv sync --group test --no-dev --frozen --no-install-project --no-build && pytest tests/e2e')cd frontend && npm run test:e2e)./deploy.sh openapi, then./deploy.sh types), never edited by handValidation: unit 570 passed, contract 3 passed, e2e 488 passed and 1 skipped. Driving the services from the API container (a bad token, a failed and a good login, a too-short password, five rate limit checks) gave exactly those counts at the collector.
Checklist
pre-commit run --all-filesand all checks passSummary by cubic
Replaces the
SecurityMetricsandRateLimitMetricsinstrument classes with spans, so all 15 security and rate limit metrics are now derived from traces.auth.*span; rate limit checks leaverate_limit.requestandrate_limit.decisionspans.signaltometricsconnector produces the same series, and every label survives as a span attribute.trace.Tracerinstead of the metric classes; the dashboards and metrics reference use the new label names (auth_reason,rate_limit_endpoint, ...); the bypass counter now comes from requests whose algorithm isbypassed.Written for commit 1947c75. Summary will update on new commits.