Skip to content

Commit

Permalink
Merge branch 'main' into migrate_semconv_weaver
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored Oct 19, 2024
2 parents 5fb6486 + 1185405 commit 88c22c8
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

module(
name = "opentelemetry-cpp",
version = "1.16.1",
version = "1.17.0",
compatibility_level = 0,
repo_name = "io_opentelemetry_cpp",
)
Expand Down
7 changes: 5 additions & 2 deletions exporters/memory/src/in_memory_metric_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ void SimpleAggregateInMemoryMetricData::Add(std::unique_ptr<ResourceMetrics> res
const auto &metric = m.instrument_descriptor.name_;
for (const auto &pda : m.point_data_attr_)
{
data_[{scope, metric}].insert({pda.attributes, pda.point_data});
// NOTE: Explicit type conversion added for C++11 (gcc 4.8)
data_[std::tuple<std::string, std::string>{scope, metric}].insert(
{pda.attributes, pda.point_data});
}
}
}
Expand All @@ -41,7 +43,8 @@ const SimpleAggregateInMemoryMetricData::AttributeToPoint &SimpleAggregateInMemo
const std::string &scope,
const std::string &metric)
{
return data_[{scope, metric}];
// NOTE: Explicit type conversion added for C++11 (gcc 4.8)
return data_[std::tuple<std::string, std::string>{scope, metric}];
}

void SimpleAggregateInMemoryMetricData::Clear()
Expand Down
7 changes: 4 additions & 3 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 @@ -78,14 +78,15 @@ class InMemoryMetricExporter final : public sdk::metrics::PushMetricExporter
std::unique_ptr<PushMetricExporter> InMemoryMetricExporterFactory::Create(
const std::shared_ptr<InMemoryMetricData> &data)
{
return Create(data, [](auto) { return AggregationTemporality::kCumulative; });
return Create(data,
[](sdk::metrics::InstrumentType) { return AggregationTemporality::kCumulative; });
}

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
6 changes: 3 additions & 3 deletions ext/test/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(WITH_HTTP_CLIENT_CURL)
set(FILENAME curl_http_test)
add_compile_definitions(WITH_CURL)
add_executable(${FILENAME} ${FILENAME}.cc)
target_link_libraries(${FILENAME} ${GTEST_BOTH_LIBRARIES}
target_link_libraries(${FILENAME} ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT})

if(TARGET CURL::libcurl)
Expand All @@ -24,8 +24,8 @@ endif()

set(URL_PARSER_FILENAME url_parser_test)
add_executable(${URL_PARSER_FILENAME} ${URL_PARSER_FILENAME}.cc)
target_link_libraries(${URL_PARSER_FILENAME} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${URL_PARSER_FILENAME} opentelemetry_api ${GMOCK_LIB}
${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
gtest_add_tests(
TARGET ${URL_PARSER_FILENAME}
TEST_PREFIX ext.http.urlparser.
Expand Down
4 changes: 2 additions & 2 deletions test_common/src/http/client/nosend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ if(${BUILD_TESTING})
endif()

target_link_libraries(
opentelemetry_http_client_nosend ${GTEST_BOTH_LIBRARIES} opentelemetry_ext
opentelemetry_test_common)
opentelemetry_http_client_nosend opentelemetry_ext
opentelemetry_test_common ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES})

endif()

0 comments on commit 88c22c8

Please sign in to comment.