Isolate metric template code