Integrate metrics support and refactor the code.

Two things really:
- Provide ability to emit metrics for API calls.
- Nicer code organization.
More name trimming :) How about `HandlerFunc` and `RawHandlerFunc`?