separate metrics from logging and make injectable