Integrate metrics support and refactor the code.
Log emit metrics errors.
Fix.
Fixed code review comments.
Merge pull request #3 from mailgun/roman/metrics

Integrate metrics support and refactor the code.