From 4c23d2580e2b0ec439747ec6fdbbdaa38cb9ecb2 Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Thu, 20 Mar 2025 21:37:20 -0600 Subject: [PATCH 1/3] fix build issue with elasticsearch exporter and older versions of nlohmann-json --- exporters/elasticsearch/src/es_log_recordable.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/exporters/elasticsearch/src/es_log_recordable.cc b/exporters/elasticsearch/src/es_log_recordable.cc index 39979a26fd..c0ba3953e5 100644 --- a/exporters/elasticsearch/src/es_log_recordable.cc +++ b/exporters/elasticsearch/src/es_log_recordable.cc @@ -23,17 +23,27 @@ namespace nlohmann { -template +template struct json_assign_visitor { T *j_; json_assign_visitor(T &j) : j_(&j) {} - template + template void operator()(const U &u) { *j_ = u; } + + template + void operator()(const opentelemetry::nostd::span &span) + { + *j_ = nlohmann::json::array(); + for (const auto &elem : span) + { + j_->push_back(elem); + } + } }; template <> From cfba48c17dbf5b7e89b8a80e2e8981dd4452ec5f Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Fri, 21 Mar 2025 17:58:26 -0600 Subject: [PATCH 2/3] run the cmake.test on 22.04 to verify compatibility with the older json package --- .github/workflows/ci.yml | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d17ae2ca2..99f6ec22c7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -41,23 +41,19 @@ jobs: # ./ci/do_ci.sh cmake.exporter.otprotocol.test cmake_test: - name: CMake test (without otlp-exporter) - runs-on: ubuntu-latest + name: CMake test (prometheus, elasticsearch, zipkin) + runs-on: ubuntu-22.04 + env: + CXX_STANDARD: '17' steps: - uses: actions/checkout@v4 with: submodules: 'recursive' - name: setup - env: - CC: /usr/bin/gcc-12 - CXX: /usr/bin/g++-12 run: | sudo -E ./ci/setup_googletest.sh sudo -E ./ci/setup_ci_environment.sh - - name: run cmake tests (without otlp-exporter) - env: - CC: /usr/bin/gcc-12 - CXX: /usr/bin/g++-12 + - name: run cmake tests run: | ./ci/do_ci.sh cmake.test From 8309565f50642d1d965105f52ed38331dd2bb1ae Mon Sep 17 00:00:00 2001 From: Douglas Barker Date: Mon, 24 Mar 2025 11:16:30 -0600 Subject: [PATCH 3/3] use class instead of typename in template args --- exporters/elasticsearch/src/es_log_recordable.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/exporters/elasticsearch/src/es_log_recordable.cc b/exporters/elasticsearch/src/es_log_recordable.cc index c0ba3953e5..f98474d2f4 100644 --- a/exporters/elasticsearch/src/es_log_recordable.cc +++ b/exporters/elasticsearch/src/es_log_recordable.cc @@ -23,19 +23,19 @@ namespace nlohmann { -template +template struct json_assign_visitor { T *j_; json_assign_visitor(T &j) : j_(&j) {} - template + template void operator()(const U &u) { *j_ = u; } - template + template void operator()(const opentelemetry::nostd::span &span) { *j_ = nlohmann::json::array();