Skip to content

Commit

Permalink
[improvement](opentelemetry) upgrade opentelemetry jar to v1.26.0 and…
Browse files Browse the repository at this point in the history
… opentelemetry-cpp to v1.8.3 (#19733)


why upgrade? anything wrong?

Try to fix the problem about opentelemetry::v1::ext::http::client::curl::HttpOperation::Send(), I have updated the pr info.
  • Loading branch information
luozenglin committed May 18, 2023
1 parent ed85a10 commit f68d3a6
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 44 deletions.
2 changes: 1 addition & 1 deletion fe/fe-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ under the License.
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp-http-trace</artifactId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
</dependency>
<dependency>
<groupId>io.opentelemetry</groupId>
Expand Down
5 changes: 2 additions & 3 deletions fe/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ under the License.
<zookeeper.version>3.4.14</zookeeper.version>
<velocity-engine-core.version>2.3</velocity-engine-core.version>
<ojdbc6.version>11.2.0.4</ojdbc6.version>
<opentelemetry.version>1.14.0</opentelemetry.version>
<opentelemetry.version>1.26.0</opentelemetry.version>
<ranger-plugins-common.version>2.4.0</ranger-plugins-common.version>
<bcprov-jdk15on.version>1.70</bcprov-jdk15on.version>
<woodstox.version>6.5.1</woodstox.version>
Expand Down Expand Up @@ -352,10 +352,9 @@ under the License.
<version>${opentelemetry.version}</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.opentelemetry/opentelemetry-exporter-otlp-http-trace -->
<dependency>
<groupId>io.opentelemetry</groupId>
<artifactId>opentelemetry-exporter-otlp-http-trace</artifactId>
<artifactId>opentelemetry-exporter-otlp</artifactId>
<version>${opentelemetry.version}</version>
</dependency>
<dependency>
Expand Down
4 changes: 4 additions & 0 deletions thirdparty/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

This file contains version of the third-party dependency libraries in the build-env image. The docker build-env image is apache/doris, and the tag is `build-env-${version}`
## v20230517
- Modified: opentelemetry-proto 0.18 -> 0.19
- Modified: opentelemetry-cpp 1.4.0 -> 1.8.3

## v20230425
- Modified: clucene 2.4.9 -> 2.4.11

Expand Down
4 changes: 2 additions & 2 deletions thirdparty/download-thirdparty.sh
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,14 @@ echo "Finished patching ${ROCKSDB_SOURCE}"

# opentelemetry patch is used to solve the problem that threadlocal depends on GLIBC_2.18
# see: https://github.com/apache/doris/pull/7911
if [[ "${OPENTELEMETRY_SOURCE}" == "opentelemetry-cpp-1.4.0" ]]; then
if [[ "${OPENTELEMETRY_SOURCE}" == "opentelemetry-cpp-1.8.3" ]]; then
rm -rf "${TP_SOURCE_DIR}/${OPENTELEMETRY_SOURCE}/third_party/opentelemetry-proto"/*
cp -r "${TP_SOURCE_DIR}/${OPENTELEMETRY_PROTO_SOURCE}"/* "${TP_SOURCE_DIR}/${OPENTELEMETRY_SOURCE}/third_party/opentelemetry-proto"
mkdir -p "${TP_SOURCE_DIR}/${OPENTELEMETRY_SOURCE}/third_party/opentelemetry-proto/.git"

cd "${TP_SOURCE_DIR}/${OPENTELEMETRY_SOURCE}"
if [[ ! -f "${PATCHED_MARK}" ]]; then
patch -p1 <"${TP_PATCH_DIR}/opentelemetry-cpp-1.4.0.patch"
patch -p1 <"${TP_PATCH_DIR}/opentelemetry-cpp-1.8.3.patch"
touch "${PATCHED_MARK}"
fi
cd -
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4fa0649..a64e74bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -118,9 +118,8 @@ option(WITH_GSL

option(WITH_ABSEIL "Whether to use Abseil for C++latest features" OFF)

+set(OPENTELEMETRY_INSTALL_default ON)
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
- set(OPENTELEMETRY_INSTALL_default ON)
-else()
set(OPENTELEMETRY_INSTALL_default OFF)
endif()
option(OPENTELEMETRY_INSTALL "Whether to install opentelemetry targets"
diff --git a/api/include/opentelemetry/common/threadlocal.h b/api/include/opentelemetry/common/threadlocal.h
new file mode 100644
index 00000000..23a39e14
Expand Down Expand Up @@ -129,18 +144,18 @@ index 00000000..23a39e14
+OPENTELEMETRY_END_NAMESPACE
\ No newline at end of file
diff --git a/api/include/opentelemetry/context/runtime_context.h b/api/include/opentelemetry/context/runtime_context.h
index 167a928f..608b6dac 100644
index bec96a9a..2349a29c 100644
--- a/api/include/opentelemetry/context/runtime_context.h
+++ b/api/include/opentelemetry/context/runtime_context.h
@@ -4,6 +4,7 @@
#pragma once
@@ -5,6 +5,7 @@

#include "opentelemetry/common/macros.h"
#include "opentelemetry/context/context.h"
+#include "opentelemetry/common/threadlocal.h"

OPENTELEMETRY_BEGIN_NAMESPACE
namespace context
@@ -188,7 +189,7 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
@@ -189,7 +190,7 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
ThreadLocalContextStorage() noexcept = default;

// Return the current context.
Expand All @@ -149,7 +164,7 @@ index 167a928f..608b6dac 100644

// Resets the context to the value previous to the passed in token. This will
// also detach all child contexts of the passed in token.
@@ -196,23 +197,23 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
@@ -197,23 +198,23 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
bool Detach(Token &token) noexcept override
{
// In most cases, the context to be detached is on the top of the stack.
Expand Down Expand Up @@ -179,7 +194,7 @@ index 167a928f..608b6dac 100644

return true;
}
@@ -221,14 +222,14 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
@@ -222,14 +223,14 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
// that can be used to reset to the previous Context.
nostd::unique_ptr<Token> Attach(const Context &context) noexcept override
{
Expand All @@ -195,51 +210,43 @@ index 167a928f..608b6dac 100644
+ public:
friend class ThreadLocalContextStorage;

Stack() noexcept : size_(0), capacity_(0), base_(nullptr){};
@@ -315,9 +316,10 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
Stack() noexcept : size_(0), capacity_(0), base_(nullptr) {}
@@ -316,9 +317,10 @@ class ThreadLocalContextStorage : public RuntimeContextStorage
Context *base_;
};

- Stack &GetStack()
+ Stack *GetStack()
- OPENTELEMETRY_API_SINGLETON Stack &GetStack()
+ OPENTELEMETRY_API_SINGLETON Stack *GetStack()
{
- static thread_local Stack stack_ = Stack();
+ // static thread_local Stack stack_ = Stack();
+ BLOCK_STATIC_THREAD_LOCAL_TELEMTRY(ThreadLocalContextStorage::Stack, stack_);
return stack_;
}
};
diff --git a/api/include/opentelemetry/nostd/shared_ptr.h b/api/include/opentelemetry/nostd/shared_ptr.h
index e1eac615..7afc30f9 100644
--- a/api/include/opentelemetry/nostd/shared_ptr.h
+++ b/api/include/opentelemetry/nostd/shared_ptr.h
@@ -56,7 +56,8 @@ class shared_ptr
typename std::enable_if<std::is_convertible<pointer, U *>::value>::type * = nullptr>
void MoveTo(typename shared_ptr<U>::PlacementBuffer &buffer) noexcept
{
- new (buffer.data) shared_ptr_wrapper{std::move(this->ptr_)};
+ using other_shared_ptr_wrapper = typename shared_ptr<U>::shared_ptr_wrapper;
+ new (buffer.data) other_shared_ptr_wrapper{std::move(this->ptr_)};
}

virtual pointer Get() const noexcept { return ptr_.get(); }
diff --git a/sdk/CMakeLists.txt b/sdk/CMakeLists.txt
index 1a824fe0..91d4b5c8 100644
index 2e8f3bb6..224e6463 100644
--- a/sdk/CMakeLists.txt
+++ b/sdk/CMakeLists.txt
@@ -1,4 +1,4 @@
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

-add_library(opentelemetry_sdk INTERFACE)
+add_library(opentelemetry_sdk INTERFACE ../api/include/opentelemetry/common/threadlocal.h)
target_include_directories(
opentelemetry_sdk
INTERFACE "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
diff --git a/sdk/src/common/CMakeLists.txt b/sdk/src/common/CMakeLists.txt
index debffef4..b4fc875a 100644
index b23a93e8..1cc0e0f2 100644
--- a/sdk/src/common/CMakeLists.txt
+++ b/sdk/src/common/CMakeLists.txt
@@ -1,4 +1,4 @@
-set(COMMON_SRCS random.cc core.cc)
+set(COMMON_SRCS random.cc core.cc threadlocal.cc)
@@ -1,7 +1,7 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

-set(COMMON_SRCS random.cc core.cc global_log_handler.cc env_variables.cc)
+set(COMMON_SRCS random.cc core.cc global_log_handler.cc env_variables.cc threadlocal.cc)
if(WIN32)
list(APPEND COMMON_SRCS platform/fork_windows.cc)
else()
Expand Down
16 changes: 8 additions & 8 deletions thirdparty/vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -417,16 +417,16 @@ NLOHMANN_JSON_SOURCE=json-3.10.1
NLOHMANN_JSON_MD5SUM="7b369d567afc0dffdcf5800fd9abb836"

# opentelemetry-proto
OPENTELEMETRY_PROTO_DOWNLOAD="https://github.com/open-telemetry/opentelemetry-proto/archive/refs/tags/v0.18.0.tar.gz"
OPENTELEMETRY_PROTO_NAME=opentelemetry-proto-0.18.0.tar.gz
OPENTELEMETRY_PROTO_SOURCE=opentelemetry-proto-0.18.0
OPENTELEMETRY_PROTO_MD5SUM="5179f58bb4edbd805590bffd2cf4df85"
OPENTELEMETRY_PROTO_DOWNLOAD="https://github.com/open-telemetry/opentelemetry-proto/archive/refs/tags/v0.19.0.tar.gz"
OPENTELEMETRY_PROTO_NAME=opentelemetry-proto-0.19.0.tar.gz
OPENTELEMETRY_PROTO_SOURCE=opentelemetry-proto-0.19.0
OPENTELEMETRY_PROTO_MD5SUM="8a5fb1ba721341994a5e7cae8b38bcc6"

# opentelemetry
OPENTELEMETRY_DOWNLOAD="https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.4.0.tar.gz"
OPENTELEMETRY_NAME=opentelemetry-cpp-1.4.0.tar.gz
OPENTELEMETRY_SOURCE=opentelemetry-cpp-1.4.0
OPENTELEMETRY_MD5SUM="511b670dd1abb596da53684d23742c5f"
OPENTELEMETRY_DOWNLOAD="https://github.com/open-telemetry/opentelemetry-cpp/archive/refs/tags/v1.8.3.tar.gz"
OPENTELEMETRY_NAME=opentelemetry-cpp-1.8.3.tar.gz
OPENTELEMETRY_SOURCE=opentelemetry-cpp-1.8.3
OPENTELEMETRY_MD5SUM="a051dbbced2b7eb7a7227bdf5b3b9a10"

# libbacktrace
LIBBACKTRACE_DOWNLOAD="https://codeload.github.com/ianlancetaylor/libbacktrace/zip/2446c66076480ce07a6bd868badcbceb3eeecc2e"
Expand Down

0 comments on commit f68d3a6

Please sign in to comment.