sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!
https://www.sozu.io/
GNU Affero General Public License v3.0
3.12k stars 193 forks source link

proper logging of RouterError::RouteNotFound #1021

Closed Keksoj closed 1 year ago

Keksoj commented 1 year ago

Oftentimes, we meet this error in production, which is too verbose and not explicit enough:

... WRK-00 ERROR       Error connecting to backend: failed to retrieve the cluster: failed to retrieve the frontend for the request: no cluster found

This PR changes the signature of Router::lookup() to return a Result<Route, RouterError instead of Option<Route>. The RouterError::NoRouteFound is logged in an explicit manner: METHOD uri path . On top of that, I shortened the redundant parts of the log for better readability:

... WRK-00 ERROR    Error connecting to backend: failed to retrieve the cluster: no cluster: GET localhost /

this will make debugging easier in production.