An implementation that serializes metrics to a protocol buffer. This is a merge from wvgerrit/28440. I intend to submit 2048751, 2048750, and 2048509 together. Bug: 36217927 Bug: 36220975 Test: Added unit tests to cover modified code. Change-Id: Ie8b9d8b91d2602b015f5568890a16c0419c126df