Simplify logic within getMetrics()

A proposal for simplifying the code within `getMetrics()`.