Skip to content

Commit 216f3f7

Browse files
authored
[BUILD] Fix elasticsearch exporter json compatibility (open-telemetry#3313)
* fix build issue with elasticsearch exporter and older versions of nlohmann-json * run the cmake.test on 22.04 to verify compatibility with the older json package * use class instead of typename in template args ---------
1 parent 0fa41f9 commit 216f3f7

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,19 @@ jobs:
4141
# ./ci/do_ci.sh cmake.exporter.otprotocol.test
4242

4343
cmake_test:
44-
name: CMake test (without otlp-exporter)
45-
runs-on: ubuntu-latest
44+
name: CMake test (prometheus, elasticsearch, zipkin)
45+
runs-on: ubuntu-22.04
46+
env:
47+
CXX_STANDARD: '17'
4648
steps:
4749
- uses: actions/checkout@v4
4850
with:
4951
submodules: 'recursive'
5052
- name: setup
51-
env:
52-
CC: /usr/bin/gcc-12
53-
CXX: /usr/bin/g++-12
5453
run: |
5554
sudo -E ./ci/setup_googletest.sh
5655
sudo -E ./ci/setup_ci_environment.sh
57-
- name: run cmake tests (without otlp-exporter)
58-
env:
59-
CC: /usr/bin/gcc-12
60-
CXX: /usr/bin/g++-12
56+
- name: run cmake tests
6157
run: |
6258
./ci/do_ci.sh cmake.test
6359

exporters/elasticsearch/src/es_log_recordable.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ struct json_assign_visitor
3434
{
3535
*j_ = u;
3636
}
37+
38+
template <class U>
39+
void operator()(const opentelemetry::nostd::span<U> &span)
40+
{
41+
*j_ = nlohmann::json::array();
42+
for (const auto &elem : span)
43+
{
44+
j_->push_back(elem);
45+
}
46+
}
3747
};
3848

3949
template <>

0 commit comments

Comments
 (0)