Print out cache hit ratio on provider-proxy shutdown#7524
Conversation
This will make it easier to debug any issues that show up when using provider-proxy in external projects
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 0c532c5. Configure here.
| async fn shutdown_signal() { | ||
| let ctrl_c = async { | ||
| let _ = tokio::signal::ctrl_c().await; | ||
| }; |
There was a problem hiding this comment.
ctrl_c error causes immediate proxy shutdown
Medium Severity
The ctrl_c async block discards the Result from tokio::signal::ctrl_c().await with let _ =, causing the block to complete immediately if signal registration fails. This makes shutdown_signal() resolve right away, shutting down the proxy on startup. The SIGTERM handler correctly avoids this by calling std::future::pending::<()>().await on error, but the ctrl_c handler lacks the same safeguard.
Reviewed by Cursor Bugbot for commit 0c532c5. Configure here.


This will make it easier to debug any issues that show up when using provider-proxy in external projects
Note
Low Risk
Observability and graceful shutdown wiring only; request caching and forwarding logic are unchanged aside from counters.
Overview
Adds lifetime cache hit tracking for
provider-proxyand logs a summary when the process exits.A new
CacheStatstype counts total proxied cache lookups and hits (atomics, relaxed ordering).check_cacherecords each completed lookup—including early ReadOnlyRequireHit misses—before returning.Shutdown is now driven by
tokio::select!: the MITM server runs until it finishes or until Ctrl-C / SIGTERM (Unix). On exit, an info log prints hits, total requests, and the hit percentage.This does not change cache keys, storage, or proxy behavior beyond counting and graceful signal handling for the stats line.
Reviewed by Cursor Bugbot for commit 0c532c5. Configure here.