Refactoring based on metrics-jersey implementation