metrics api refactored