Add pushgateway support to the simpleclient.

Refactor production of the text format into a separate module.
A test would be nice here. If the TextFormat had an interface and didn't have static methods it could be mocked