Refactor creation of metrics data frame.