Refactorings and make the units for the metrics servlet configurable