CDM Metrics Protocol buffer serialization.
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
This commit is contained in:
@@ -61,7 +61,7 @@ TEST_F(EventMetricTest, NoFieldsSuccessNullCallback) {
|
||||
TEST_F(EventMetricTest, NoFieldsSuccessWithCallback) {
|
||||
wvcdm::metrics::EventMetric<> metric("no/fields/metric");
|
||||
EXPECT_CALL(*mock_serializer_,
|
||||
SetInt64("no/fields/metric/count", 1.0));
|
||||
SetInt64("no/fields/metric/count", 2));
|
||||
EXPECT_CALL(*mock_serializer_,
|
||||
SetDouble("no/fields/metric/mean", 10.0));
|
||||
EXPECT_CALL(*mock_serializer_,
|
||||
@@ -71,6 +71,23 @@ TEST_F(EventMetricTest, NoFieldsSuccessWithCallback) {
|
||||
EXPECT_CALL(*mock_serializer_,
|
||||
SetDouble("no/fields/metric/max", 10.0));
|
||||
|
||||
metric.Record(10);
|
||||
metric.Record(10);
|
||||
metric.Serialize(mock_serializer_.get());
|
||||
|
||||
std::map<std::string, Distribution*> value_map = GetValueMap(metric);
|
||||
ASSERT_EQ(1u, GetValueMap(metric).size());
|
||||
EXPECT_EQ(2, value_map.begin()->second->Count());
|
||||
EXPECT_EQ("", value_map.begin()->first);
|
||||
}
|
||||
|
||||
TEST_F(EventMetricTest, NoFieldsSuccessSingleRecordWithCallback) {
|
||||
wvcdm::metrics::EventMetric<> metric("no/fields/metric");
|
||||
EXPECT_CALL(*mock_serializer_,
|
||||
SetInt64("no/fields/metric/count", 1.0));
|
||||
EXPECT_CALL(*mock_serializer_,
|
||||
SetDouble("no/fields/metric/mean", 10.0));
|
||||
|
||||
metric.Record(10);
|
||||
metric.Serialize(mock_serializer_.get());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user