Lightweight framework for capturing metrics