Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Aug 12, 2022
1 parent 3312a3e commit 9eed500
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sdk/test/metrics/meter_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#ifndef ENABLE_METRICS_PREVIEW
# include "opentelemetry/sdk/metrics/meter.h"
# include "opentelemetry/sdk/metrics/data/point_data.h"
# include "opentelemetry/sdk/metrics/meter_context.h"
# include "opentelemetry/sdk/metrics/meter_provider.h"
# include "opentelemetry/sdk/metrics/metric_reader.h"
Expand Down Expand Up @@ -57,8 +58,16 @@ TEST(MeterTest, BasicAsyncTests)

size_t count = 0;
metricReaderPtr->Collect([&count](ResourceMetrics &metric_data) {
count += metric_data.scope_metric_data_.size();
EXPECT_EQ(count, 1);
EXPECT_EQ(metric_data.scope_metric_data_.size(), 1);
if (metric_data.scope_metric_data_.size())
{
EXPECT_EQ(metric_data.scope_metric_data_[0].metric_data_.size(), 1);
if (metric_data.scope_metric_data_.size())
{
count += metric_data.scope_metric_data_[0].metric_data_.size();
EXPECT_EQ(count, 1);
}
}
return true;
});
}
Expand Down

0 comments on commit 9eed500

Please sign in to comment.