Changed metric recorder to a simple class with state rather than using a thread-local.