Refactor metric output parsing.