added helper function to create and prune metrics