Fix metrics reporting

Also reduced nesting and indentation to help with the readability and changed some names and comments for consistency.
Removing the same type of checks in `lib/proxy.js`, we get `unexpected close` warning regularly when browsing, the check reduces them to a view cases, mostly connected to actual error-state connections.
We could remove the checks and investigate the warnings more to get the ground of this?