-
-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get metrics even a request fails #336
Comments
Thanks for filing an issue! It is not currently possible to get access to a
There may or may not be a remote address depending on whether we actually managed to connect to a server or not. Though, the remote address isn't part of the metrics API but a different method. This seems pretty useful to add though to the What if we added a method to impl Error {
/// Get the remote socket address of the last-used connection involved in
/// this error, if known.
///
/// If the request that caused this error failed to connect to any server,
/// then this will be `None`.
pub fn remote_addr(&self) -> Option<SocketAddr>;
} |
That would be really nice in my scenario! However, like you said, this implementation might bloat the |
Are you just looking to have a more descriptive error message? Or do you need to actually extract the remote address for something? Because trying to scrape it from the error message or error context sounds risky from a stability perspective if the error message format changes (which isn't part of the API stability guarantee). |
I have a branch that adds |
Add `local_addr` and `remote_addr` to `Error` which expose the local and remote network addresses of the last used connection for a request before the error occurred, if known. Fixes #336.
This is now exposed in the 1.5.0 release! |
Hi, thanks for this great lib!
I'm using it to implement a network debugging tool for our client, utilizing it's great metrics interface. In this context, error is expected and I want to extract metrics from the request. Is this currently possible? The phase throwing the error can be observed from the error's Kind, so specifically I need remote_addr of this failed request.
The text was updated successfully, but these errors were encountered: