Refactred and extended metric api client