Use a time.Ticker instead of the time.Sleep

This also prevents writing the metrics immediately after calling `WriteJSON`, which would likely be an empty registry in the beginning.