Repository navigation
feat: Make FastAPI the primary entry point for all deployments (#13986) - #14109
Closed
Sravan1011 wants to merge 2 commits into
Closed
Sravan1011 wants to merge 2 commits into
Sravan1011 wants to merge 2 commits into
Conversation
…netarchive#13986) Enable the fallback proxy in production so that new FastAPI endpoints are automatically reachable without maintaining path patterns in olsystem's nginx config. Changes: - asgi_app.py: Remove the LOCAL_DEV/testing deployment gate from the catch-all fallback route. FastAPI now proxies unmatched requests to web.py in all deployments. - proxy.py: Harden for production use: - Add finite PROXY_TIMEOUT (5s connect, 300s read/write) to prevent hung web.py responses from blocking FastAPI workers forever - Catch httpx.TimeoutException and return 504 Gateway Timeout - Tag proxied requests with sentry_sdk.set_tag('proxied', True) for observability - Add structured logging for timeout events - prometheus.py: Exclude the catch-all /{path:path} handler from FastAPI's Prometheus metrics to prevent it dominating per-route latency buckets. Web.py's own metrics (server=webpy) still provide per-route breakdown. - test_proxy.py: Add tests for timeout handling (ReadTimeout, ConnectTimeout → 504), PROXY_TIMEOUT finite values, and Sentry tagging of proxied requests. Refs: internetarchive#13986, internetarchive#13423, internetarchive#13516
for more information, see https://pre-commit.ci
Collaborator
|
Thanks for the PR, @Sravan1011! 🤖 A reviewer has been assigned for an initial pass. PR triage checklist (maintainers / Pierre)
Note This comment was automatically generated by Pierre, Open Library's PR first-touch assistant, on behalf of @mekarpeles. This is NOT a code review or sign-off. |
Contributor
Author
Contributor
Author
|
@RayBB can you review this pr |
Collaborator
|
Please follow our contributing guidelines and work on issues that are ready to be worked on |
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.
Enable the fallback proxy in production so that new FastAPI endpoints are automatically reachable without maintaining path patterns in olsystem's nginx config.
Changes:
Refs: #13986, #13423, #13516
Closes ##13986