Revert "Revert^2 "[metrics] Add file output support""

This reverts commit 8ef84f233a55972eb3a3d84c11c1617531af8e92.

Bug: 175025360
Bug: 170149255

Reason for revert: test failing on target

Change-Id: I8d82462f6fb853ece4a4b295de17ab13b1f1b6f1
17 files changed