Repository navigation
feat(observability): expose Prometheus /metrics for the API and grading pipeline (#488) - #491
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
ArthurCRodrigues
previously approved these changes
Nov 21, 2026
Member
|
Merged
🤖 Generated with Claude Code |
…ng pipeline (#488) GET /metrics on autograder-api and autograder-sandbox-manager (public like /health, private network only): HTTP golden signals by route template, grading throughput/failures/duration, the database queue backlog, SQLAlchemy pool gauges and connect timing, and sandbox pool/budget gauges.
…oaden metrics tests (#488) Concurrent scrapes share one queue read reused for 5 s, with a PostgreSQL statement_timeout and the database clock; queue gauges come from one snapshot; one 'other' label spelling; 499 for client disconnects; derived error categories; docs, CHANGELOG and tests for review round 1.
…eue up/down tracking (#488)
…tage recovery logging (#488)
Share the <unmatched> route label with logs and spans, log successful /metrics scrapes at DEBUG, and exclude /metrics from the control-API client route-template check (the API never calls it).
…pes log at DEBUG (#488)
ArthurCRodrigues
approved these changes
Nov 22, 2026
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.
Closes #488
Part of webtech-network/prisma-infrastructure#92
What
GET /metrics(Prometheus text format) on autograder-api and autograder-sandbox-manager. Both are public like/healthand must stay on the private network. They carry counts and durations with closed-set labels only: no IDs, paths, tokens or student data. Full reference:docs/operate/metrics.md.http_server_requests_total{method,route,status},http_server_request_duration_seconds{method,route},http_server_requests_in_progress{method};routeis the matched template orunmatched; a client disconnect counts as499autograder_submissions_total{status,language,error_category}once per final outcome,autograder_grading_failures_total{category,code,retryable}per failed attempt,autograder_grading_duration_seconds{language,status}(0.5–600 s),autograder_grading_in_progressautograder_queue_submissions{state=pending,processing,retry_wait},autograder_queue_oldest_age_seconds,autograder_queue_upautograder_db_pool_{size,checked_out,checked_in,overflow,max_overflow},autograder_db_pool_connections_created_total,autograder_db_pool_connect_duration_secondsautograder_sandboxes{language,state},autograder_sandbox_pool_target{language},autograder_sandbox_budget_{limit,held,waiting}Design notes
prometheus_clientonly, added to thesandboxextra. Each app has its ownCollectorRegistry; there is no global registry.sandbox_manager/metrics.py, serves both apps and follows the existing dependency direction. It is registered outermost, so rejections by other middleware (413, 401) are counted.SET LOCAL statement_timeoutbound the query.autograder_queue_up 0and logs a warning once per outage./metricsstays out of OpenAPI. The auth contract test classifies it as public.checked_out / (size + max_overflow).sandbox_manager/api.py,web/main.pyandweb/service/worker.pyonly add the route, the middleware and the metric calls. Logging setup is untouched (AG-1 [Observability][AG-1] Sanitize Logs & Emit Structured JSON Logs fromautograder-sandbox-manager#487 also edits those files).Deployment (for INF-5)
api:8000/metricsandsandbox-manager:8001/metrics.apimust not forward/metrics. Seedocs/operate/deployment.md.Verification
make test: 1676 passed.make test-web: 512 passed.make contracts docs: OK.🤖 Generated with Claude Code