Same remark as for the Instance class: this code should be moved to the TransactionManagerServices in a new method called getMetricsFactory() or something like that.

By the way, this code also isn't thread-safe, you should consider using Atomic Refs.