Change the use of atomic operations in favor of mutexes, testing with Go 1.9 there's almost no different anymore, definitely good improvements have been made to the mutex implementation, so I'd rather have an implementation that's easier to read and reason about.
Don't spawn new goroutines to flush the measures. This was actually causing pretty high contention on the goroutine scheduler on a very high traffic service that was producing a lot of metrics.
This PR makes to main changes: