Integrate metrics support and refactor the code.

Two things really:
- Provide ability to emit metrics for API calls.
- Nicer code organization.
This function name seems a little long. How about `getResponseAndStatusFor(err error)` or `responseAndStatusFor(err error)`.