Refactor metrics package to improve performance.

There were two problems with this package affecting performance:

* Excessive usage of fmt.Sprintf that was slowing things down
* Packet sent per every metric, what was generating too many system calls

This refactoring adds option for buffered writes as well as uses bytes.Buffer and avoids system calls.