Fix 500 server error when metric name does not exist

Change-Id: I20d381d1f2c11f0f9495b3aec18a970aa78f83ce