Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
lalitb committed Oct 19, 2023
1 parent 80634bd commit eaeca30
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions sdk/test/metrics/sum_aggregation_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -128,24 +128,25 @@ TEST_P(UpDownCounterToSumFixture, Double)
{
bool is_matching_view = GetParam();
MeterProvider mp;
auto m = mp.GetMeter("meter1", "version1", "schema1");
std::string instrument_name = "updowncounter1";
std::string instrument_name_nonmatching = "updowncounter1_nonmatching";
std::string instrument_desc = "updowncounter desc";
std::string instrument_unit = "ms";
auto m = mp.GetMeter("meter1", "version1", "schema1");
std::string instrument_name = "updowncounter1";
std::string instrument_desc = "updowncounter desc";
std::string instrument_unit = "ms";

std::unique_ptr<MockMetricExporter> exporter(new MockMetricExporter());
std::shared_ptr<MetricReader> reader{new MockMetricReader(std::move(exporter))};
mp.AddMetricReader(reader);

std::unique_ptr<View> view{
new View("view1", "view1_description", instrument_unit, AggregationType::kSum)};
std::unique_ptr<InstrumentSelector> instrument_selector{new InstrumentSelector(
InstrumentType::kUpDownCounter,
is_matching_view ? instrument_name : instrument_name_nonmatching, instrument_unit)};
std::unique_ptr<MeterSelector> meter_selector{new MeterSelector("meter1", "version1", "schema1")};
mp.AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view));

if (is_matching_view)
{
std::unique_ptr<View> view{
new View("view1", "view1_description", instrument_unit, AggregationType::kSum)};
std::unique_ptr<InstrumentSelector> instrument_selector{
new InstrumentSelector(InstrumentType::kUpDownCounter, instrument_name, instrument_unit)};
std::unique_ptr<MeterSelector> meter_selector{
new MeterSelector("meter1", "version1", "schema1")};
mp.AddView(std::move(instrument_selector), std::move(meter_selector), std::move(view));
}
auto h = m->CreateDoubleUpDownCounter(instrument_name, instrument_desc, instrument_unit);

h->Add(5, {});
Expand Down

0 comments on commit eaeca30

Please sign in to comment.