From f68d3a660e9be87fe4e2621da1536b91f22c16c9 Mon Sep 17 00:00:00 2001 From: luozenglin Date: Thu, 18 May 2023 18:46:20 +0800 Subject: [PATCH] [improvement](opentelemetry) upgrade opentelemetry jar to v1.26.0 and 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. --- fe/fe-core/pom.xml | 2 +- fe/pom.xml | 5 +- thirdparty/CHANGELOG.md | 4 ++ thirdparty/download-thirdparty.sh | 4 +- ....0.patch => opentelemetry-cpp-1.8.3.patch} | 67 ++++++++++--------- thirdparty/vars.sh | 16 ++--- 6 files changed, 54 insertions(+), 44 deletions(-) rename thirdparty/patches/{opentelemetry-cpp-1.4.0.patch => opentelemetry-cpp-1.8.3.patch} (90%) diff --git a/fe/fe-core/pom.xml b/fe/fe-core/pom.xml index 643ef1c7f4..eb06ef86f3 100644 --- a/fe/fe-core/pom.xml +++ b/fe/fe-core/pom.xml @@ -514,7 +514,7 @@ under the License. io.opentelemetry - opentelemetry-exporter-otlp-http-trace + opentelemetry-exporter-otlp io.opentelemetry diff --git a/fe/pom.xml b/fe/pom.xml index 30ca2f9c88..2cccf1064c 100644 --- a/fe/pom.xml +++ b/fe/pom.xml @@ -292,7 +292,7 @@ under the License. 3.4.14 2.3 11.2.0.4 - 1.14.0 + 1.26.0 2.4.0 1.70 6.5.1 @@ -352,10 +352,9 @@ under the License. ${opentelemetry.version} - io.opentelemetry - opentelemetry-exporter-otlp-http-trace + opentelemetry-exporter-otlp ${opentelemetry.version} diff --git a/thirdparty/CHANGELOG.md b/thirdparty/CHANGELOG.md index e992fca727..64b91d576b 100644 --- a/thirdparty/CHANGELOG.md +++ b/thirdparty/CHANGELOG.md @@ -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 diff --git a/thirdparty/download-thirdparty.sh b/thirdparty/download-thirdparty.sh index 0107959200..f77868dd8d 100755 --- a/thirdparty/download-thirdparty.sh +++ b/thirdparty/download-thirdparty.sh @@ -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 - diff --git a/thirdparty/patches/opentelemetry-cpp-1.4.0.patch b/thirdparty/patches/opentelemetry-cpp-1.8.3.patch similarity index 90% rename from thirdparty/patches/opentelemetry-cpp-1.4.0.patch rename to thirdparty/patches/opentelemetry-cpp-1.8.3.patch index 8c1478170c..534d6056f6 100644 --- a/thirdparty/patches/opentelemetry-cpp-1.4.0.patch +++ b/thirdparty/patches/opentelemetry-cpp-1.8.3.patch @@ -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 @@ -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. @@ -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. @@ -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 Attach(const Context &context) noexcept override { @@ -195,13 +210,13 @@ 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(); @@ -209,37 +224,29 @@ index 167a928f..608b6dac 100644 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::value>::type * = nullptr> - void MoveTo(typename shared_ptr::PlacementBuffer &buffer) noexcept - { -- new (buffer.data) shared_ptr_wrapper{std::move(this->ptr_)}; -+ using other_shared_ptr_wrapper = typename shared_ptr::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 "$" 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() diff --git a/thirdparty/vars.sh b/thirdparty/vars.sh index fd8540278e..3ced85e07b 100644 --- a/thirdparty/vars.sh +++ b/thirdparty/vars.sh @@ -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"