Skip to content

Commit 70ed9bc

Browse files
authored
[BUILD] Remove std::make_unique (open-telemetry#3098)
1 parent f69963f commit 70ed9bc

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

exporters/memory/src/in_memory_metric_exporter_factory.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter
4949
OTEL_INTERNAL_LOG_ERROR("[In Memory Metric Exporter] Exporting failed, exporter is shutdown");
5050
return ExportResult::kFailure;
5151
}
52-
data_->Add(std::make_unique<ResourceMetrics>(data));
52+
data_->Add(std::unique_ptr<ResourceMetrics>(new ResourceMetrics{data}));
5353
return ExportResult::kSuccess;
5454
}
5555

@@ -85,7 +85,7 @@ std::unique_ptr<PushMetricExporter> InMemoryMetricExporterFactory::Create(
8585
const std::shared_ptr<InMemoryMetricData> &data,
8686
const AggregationTemporalitySelector &temporality)
8787
{
88-
return std::make_unique<InMemoryMetricExporter>(data, temporality);
88+
return std::unique_ptr<InMemoryMetricExporter>(new InMemoryMetricExporter{data, temporality});
8989
}
9090

9191
} // namespace memory

exporters/memory/test/in_memory_metric_data_test.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ TEST(InMemoryMetricDataTest, CircularBuffer)
2323
{
2424
CircularBufferInMemoryMetricData buf(10);
2525
Resource resource = Resource::GetEmpty();
26-
buf.Add(std::make_unique<ResourceMetrics>(
27-
&resource, std::vector<ScopeMetrics>{{nullptr, std::vector<MetricData>{}}}));
26+
buf.Add(std::unique_ptr<ResourceMetrics>(new ResourceMetrics{
27+
&resource, std::vector<ScopeMetrics>{{nullptr, std::vector<MetricData>{}}}}));
2828
EXPECT_EQ((*buf.Get().begin())->resource_, &resource);
2929
}
3030

@@ -45,8 +45,8 @@ TEST(InMemoryMetricDataTest, SimpleAggregate)
4545
md.instrument_descriptor.name_ = "my-metric";
4646
md.point_data_attr_.push_back(pda);
4747

48-
agg.Add(std::make_unique<ResourceMetrics>(
49-
&resource, std::vector<ScopeMetrics>{{scope.get(), std::vector<MetricData>{md}}}));
48+
agg.Add(std::unique_ptr<ResourceMetrics>(new ResourceMetrics{
49+
&resource, std::vector<ScopeMetrics>{{scope.get(), std::vector<MetricData>{md}}}}));
5050
auto it = agg.Get("my-scope", "my-metric").begin();
5151

5252
auto saved_point = opentelemetry::nostd::get<SumPointData>(it->second);

0 commit comments

Comments
 (0)