Skip to content

Commit

Permalink
Fixes 3096
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Oct 16, 2024
1 parent f69963f commit fd07a0f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions exporters/memory/src/in_memory_metric_exporter_factory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter
OTEL_INTERNAL_LOG_ERROR("[In Memory Metric Exporter] Exporting failed, exporter is shutdown");
return ExportResult::kFailure;
}
data_->Add(std::make_unique<ResourceMetrics>(data));
data_->Add(std::unique_ptr<ResourceMetrics>(new ResourceMetrics{data}));
return ExportResult::kSuccess;
}

Expand Down Expand Up @@ -85,7 +85,7 @@ std::unique_ptr<PushMetricExporter> InMemoryMetricExporterFactory::Create(
const std::shared_ptr<InMemoryMetricData> &data,
const AggregationTemporalitySelector &temporality)
{
return std::make_unique<InMemoryMetricExporter>(data, temporality);
return std::unique_ptr<InMemoryMetricExporter>(new InMemoryMetricExporter{data, temporality});
}

} // namespace memory
Expand Down
8 changes: 4 additions & 4 deletions exporters/memory/test/in_memory_metric_data_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ TEST(InMemoryMetricDataTest, CircularBuffer)
{
CircularBufferInMemoryMetricData buf(10);
Resource resource = Resource::GetEmpty();
buf.Add(std::make_unique<ResourceMetrics>(
&resource, std::vector<ScopeMetrics>{{nullptr, std::vector<MetricData>{}}}));
buf.Add(std::unique_ptr<ResourceMetrics>(new ResourceMetrics{
&resource, std::vector<ScopeMetrics>{{nullptr, std::vector<MetricData>{}}}}));
EXPECT_EQ((*buf.Get().begin())->resource_, &resource);
}

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

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

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

0 comments on commit fd07a0f

Please sign in to comment.