improve metrics logging