Add support for recording metrics