Repository navigation
feat(alerts): add email labels, bulk actions and threshold editing - #52139
Conversation
5219bd6 to
bd06973
Compare
|
@greptileai @veria-ai |
|
bugbot run |
[Medium impact] The changes affect alert management and future performance checks within a deployment. Attach the required before/after screenshots before merging. Findings
SummaryAdds email-first user labels, category-wide alert actions, and Enterprise threshold editing.
Reviews (2) · Last reviewed commit: "fix(alerts): accept fractional multiplie..." · Reviewed by Greptile |
|
@greptileai @veria-ai |
|
bugbot run |
| <AlertThresholds | ||
| thresholds={data.thresholds} | ||
| enterprise={data.alert_limit === null} | ||
| readOnly={readOnly} | ||
| pending={mutation.isPending} | ||
| save={(thresholds) => mutation.mutateAsync({ thresholds })} | ||
| /> |
There was a problem hiding this comment.
Required screenshots are missing
The new threshold editor lacks embedded before/after screenshots. Upload is pending. The repository’s UI QA requirement must be satisfied before merging.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 6bdbf92. Configure here.
Merging this PR will not alter performance1 warning
Comparing Footnotes |
…ges (#53940) Brings nine tests in line with behavior that intentionally changed: - SSO client removal: /sso/key/generate without SSO now redirects to /ui/login (#53205) - budget partial update: /budget/info returns the app relation keys (#52477, #52787, #53232) - performance alerts opt-out: /alerts/monitoring returns thresholds (#52139) - cost margin rejection: the error names 'customer' as a valid key (#52406) - regional two-image generation: Gemini gets n single-image requests (#52103) - customer app budget key rotation: the rotated key's cleanup tolerates /key/regenerate - DeepSeek 401: the upstream error type is relayed (#53217) - vLLM rejected predicate: the plain upstream message is relayed (#53217). The case still fails on the non-OpenAI error type that #51809 fixes - /callbacks/list e2e: the Rust spend logger is listed as spend_log (#52182)
Handwritten 1-3 sentence description
use email as user identifier in alerts and let enterprise users edit alert thresholds
Details
TLDR
Problem this solves:
How it solves it:
Intentional product change: Manage alerts shows the four existing rules and explains both conditions. Enterprise admins can edit their thresholds. Users cannot create new rules, and the existing baseline and sample-size safeguards remain fixed.
User Flow
Before, an admin cannot identify users by email or manage these limits from Alerts.
http://127.0.0.1:3019/ui/alertswith the four synthetic user alerts.After, an admin can identify the user, clear a category, and adjust existing thresholds with Enterprise.
http://127.0.0.1:3019/ui/alertswith the same four synthetic user alerts.alex@example.com. Resolve all and Dismiss all include unloaded matching open alerts.3.5.Pre-Submission checklist
The new tests pass. The broader database alert suite has one pre-existing gateway-history failure, reproduced on unchanged main. CI and automated reviews are running on the latest commit.
Screenshots / Proof of Fix
Before and after screenshots were captured at the same local URL using identical synthetic data. Attachment upload is pending. Before is
7363ffd0326e; the after screenshots were captured with the changes in5219bd6a82c. Current tip6bdbf92f909includes main through8c12b992163and preserves this view for the same four metric alerts. After main added prompt-cache advisories, bulk All alerts was updated to cover them too. The updated UI and real-database tests cover this integration. The final validation fix accepts multipliers such as1.005and rejects1before submission. The 39 UI tests pass with this case and fractional percentage round-tripping.Both live proxies used two workers, a dedicated PostgreSQL 16 database, and dedicated shared Redis through the repository's owned-proxy harness. No provider calls are involved. The baseline frontend used a wider Turbopack root to resolve shared dependencies and allowed the loopback development origin. Neither development-only setting is in this PR.
Enterprise entitlement was simulated through the QA dependency hook below. Authentication, HTTP routes, persistence, and bulk writes were real. Community threshold writes returned HTTP 403 without simulated entitlement. License validation itself was not exercised.
Before
11111111-2222-4333-8444-555555555555.After
alex@example.com; View user activity still links by UUID.4and75, traffic to12and1500, latency to4and750, and error rate to4and3.5.The built-in defaults are unchanged.
The prior seven days remain the baseline. Four active baseline days, 100 timed requests for latency, and 500 requests for error rate remain fixed. Changes apply to future checks.
Automated validation
uv run --no-sync pytest tests/unit/models/test_performance_alert.py tests/unit/proxy/alerting_endpoints/test_alerts.py tests/unit/repositories/test_performance_alert_repository.py tests/unit/proxy/spend_tracking/test_performance_alerts.py -qpassed 158 tests.npx vitest run src/components/Alerts/Alerts.integration.test.tsx src/components/Alerts/alertPresentation.test.tspassed 39 tests, including filtered bulk writes, combined retirement/performance/prompt-cache writes, retry, permissions, and fractional percentage round-tripping.The real-database run of
tests/integration/database/test_alerts.pyplustest_enterprise_thresholds_persist_and_change_detection_but_free_uses_defaultspassed 40 tests. The existingtest_daily_history_matches_scope_and_weighted_metrics[gateway]failed on both branch and baseline (baseline result 27 passed, 1 failed). The two email-present regression cases failed on the baseline, while all four fallback cases passed.The full
make checkand production typecheck passed before the final main integration. Both are being rerun on the rebased tip. Gitleaks found no secrets in the outgoing diff or commit message.Reproduce the local browser fixtures
Use a disposable PostgreSQL 16 instance and Redis available to the integration harness. Set
DATABASE_URLto the disposable database,LITELLM_MASTER_KEY,UI_USERNAME, andUI_PASSWORDto local test values. Keep these runtime-only. Save the following launcher outside the checkout and setALERTS_QA_REPOto the checkout andALERTS_QA_WORKto an empty scratch directory. This is the launcher used for both versions, with machine-specific paths replaced by environment variables.Save this hook as
qa_alert_hooks.pyin the scratch directory. Add or remove an emptyenterprise-modefile there to simulate the entitlement for UI checks.Run the launcher with the checkout's Python environment. It starts the owned two-worker proxy and writes its port to
qa-port. The underlying command ispython -m integration._support.proxy --config <generated-config> --host 127.0.0.1 --num_workers 2 --timeout_worker_healthcheck <harness-default> --use_prisma_db_push --port <allocated-port>. The harness applies the schema before serving. Reload is omitted so both worker processes remain active.Start the dashboard from
litellm/ui/litellm-dashboardwithLENS_DEV_PROXY_URL=http://127.0.0.1:<qa-port> NEXT_PUBLIC_USE_REWRITES=true ../../scripts/with_dashboard_node.sh npm run dev -- --port 3019. Sign in with the local test credentials and follow the steps above. Creatingstop-browser-qain the scratch directory closes the owned proxy and services.Type
New Feature and Bug Fix
Caveats
Low
Final Attestation
Note
Medium Risk
Changes alert detection thresholds, bulk SQL status updates, and admin-only Enterprise gating—incorrect thresholds or filters could miss or mislabel alerts at scale.
Overview
Adds bulk resolve/dismiss for saved alerts via
PATCH /alerts, including open rows that are not on the current page, with optional filtering by alert type. The dashboard exposes Resolve all / Dismiss all (with confirmation), coordinates model-deprecation updates when viewing all types, and hides bulk controls for read-only admins.User-facing alert labels prefer trimmed email over alias when enriching user-scoped alerts, while keeping UUID-based activity links.
Enterprise admins can inspect and persist performance alert thresholds (multiplier + minimum increase per spend/traffic/latency/reliability) through
PATCH /alerts/monitoring; detection and sweeps use the configured values instead of fixed constants, with validation and 403 for non-Enterprise. Free tiers still see read-only defaults in Manage alerts.Detection tweaks require traffic and reliability increases to exceed baseline (not only meet multiplier floors). UI, OpenAPI schema, and integration/unit tests cover bulk writes, threshold persistence, permissions, and email fallback.
Reviewed by Cursor Bugbot for commit 6bdbf92. Bugbot is set up for automated code reviews on this repo. Configure here.