Add refactored metrics

This commit uses refactored metrics that improve performance,
implement escaping for statsd and reduce the amount of packets generated in the network.
You can delete the `metric` and `escape` functions now.