How to extract metrics at function Level