IMPALA-13235: [Patch 3 of 5] - Consume OpenTelemetry C++ SDK

Adds the OpenTelemetry C++ SDK version 1.20.0 from the toolchain into
the cmake files for consumption during builds.

Testing was accomplished by building locally and in Jenkins.

Generated-by: Github Copilot (GPT-4.1)
Change-Id: Ib30123f79270e3f11233e28a2a34725e7d455f5e
Reviewed-on: http://gerrit.cloudera.org:8080/23101
Reviewed-by: Jason Fehr <jfehr@cloudera.com>
Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>
This commit is contained in:
jasonmfehr
2025-06-27 12:39:07 -07:00
committed by Impala Public Jenkins
parent ec6585fa7e
commit fe1a78d16e
5 changed files with 89 additions and 2 deletions

View File

@@ -145,6 +145,7 @@ set_dep_root(CCTZ)
set_dep_root(CURL)
set_dep_root(CALLONCEHACK)
set_dep_root(CLOUDFLAREZLIB)
set_dep_root(OPENTELEMETRY_CPP)
# The boost-cmake project hasn't been maintained for years. Let's make sure we
# don't accidentally use it if it can be found.
@@ -424,6 +425,11 @@ find_package(CallOnceHack REQUIRED)
IMPALA_ADD_THIRDPARTY_LIB(calloncehack ${CALLONCEHACK_INCLUDE_DIR} ""
${CALLONCEHACK_SHARED_LIB})
# find opentelemetry-cpp sdk
find_package(OpentelemetryCpp REQUIRED)
add_compile_definitions(ENABLE_THREAD_INSTRUMENTATION_PREVIEW)
include_directories(${OPENTELEMETRY_CPP_INCLUDE_DIR})
# Tests that run any security related tests need to link this in to override the
# krb5_realm_override() implementation in krb5.
# See be/src/kudu/security/krb5_realm_override.cc for more information.

View File

@@ -450,6 +450,7 @@ set(CLANG_INCLUDE_FLAGS
"-I${PROTOBUF_INCLUDE_DIR}"
"-I${CCTZ_INCLUDE_DIR}"
"-I${CURL_INCLUDE_DIR}"
"-I${OPENTELEMETRY_CPP_INCLUDE_DIR}"
)
# allow linking of static libs into dynamic lib
@@ -658,6 +659,7 @@ set (IMPALA_DEPENDENCIES
ThriftSaslTransport
openssl_ssl
openssl_crypto
${OPENTELEMETRY_CPP_LIBS}
crcutil
gutil
glog

View File

@@ -475,8 +475,8 @@ def get_toolchain_downloads():
["avro", "binutils", "boost", "breakpad", "bzip2", "calloncehack", "cctz",
"cloudflarezlib", "cmake", "crcutil", "curl", "flatbuffers", "gdb", "gflags",
"glog", "gperftools", "jwt-cpp", "libev", "libunwind", "lz4", "mold",
"openldap", "orc", "protobuf", "python", "rapidjson", "re2", "snappy", "tpc-h",
"tpc-ds", "zlib", "zstd"]]
"openldap", "opentelemetry-cpp", "orc", "protobuf", "python", "rapidjson", "re2",
"snappy", "tpc-h", "tpc-ds", "zlib", "zstd"]]
python3_package = ToolchainPackage(
"python", explicit_version=os.environ.get("IMPALA_PYTHON3_VERSION"))
gtest_package = ToolchainPackage(

View File

@@ -149,6 +149,8 @@ export IMPALA_LLVM_VERSION=5.0.1-p8
unset IMPALA_LLVM_URL
export IMPALA_LLVM_ASAN_VERSION=5.0.1-p8
unset IMPALA_LLVM_ASAN_URL
export IMPALA_OPENTELEMETRY_CPP_VERSION=1.20.0
unset IMPALA_OPENTELEMTRY_CPP_URL
# To limit maximum memory available for the mini-cluster and CDH cluster, add the
# following in $IMPALA_HOME/bin/impala-config-local.sh

View File

@@ -0,0 +1,77 @@
##############################################################################
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
##############################################################################
# - Find OpentelemetryCpp static libraries for the OpenTelemetry C++ SDK.
# OPENTELEMETRY_CPP_ROOT hints the location
#
# This module defines
# OPENTELEMETRY_CPP_INCLUDE_DIR, directory containing headers
#
# See https://github.com/open-telemetry/opentelemetry-cpp/blob/main/INSTALL.md for
# documentation on the OpenTelemetry C++ SDK installation.
set(OPENTELEMETRY_CPP_SEARCH_HEADER_PATHS ${OPENTELEMETRY_CPP_ROOT}/include)
set(OPENTELEMETRY_CPP_SEARCH_LIB_PATH ${OPENTELEMETRY_CPP_ROOT}/lib)
find_path(OPENTELEMETRY_CPP_INCLUDE_DIR
NAMES opentelemetry/sdk/resource/resource.h
PATHS ${OPENTELEMETRY_CPP_SEARCH_HEADER_PATHS}
NO_DEFAULT_PATH)
# The following libraries are the minimum set of libraries required to use the OTLP HTTP
# and file exporters. Order is important, as some libraries depend on others.
set(LIB_LIST
libopentelemetry_exporter_otlp_file
libopentelemetry_exporter_otlp_file_client
libopentelemetry_exporter_otlp_http
libopentelemetry_exporter_otlp_http_client
libopentelemetry_http_client_curl
libopentelemetry_otlp_recordable
libopentelemetry_logs
libopentelemetry_proto
libopentelemetry_resources
libopentelemetry_trace
libopentelemetry_version
libopentelemetry_common
)
set(OPENTELEMETRY_CPP_LIBS "")
set(OPENTELEMETRY_CPP_FOUND TRUE)
foreach(LIB ${LIB_LIST})
find_library(OPENTELEMETRY_CPP_${LIB} ${LIB}.a
PATHS ${OPENTELEMETRY_CPP_SEARCH_LIB_PATH}
NO_DEFAULT_PATH
DOC "OpenTelemetry ${LIB}"
)
if (NOT OPENTELEMETRY_CPP_${LIB})
message(FATAL_ERROR "OpenTelemetry includes and libraries NOT found.")
set(OPENTELEMETRY_CPP_FOUND FALSE)
endif()
set(OPENTELEMETRY_CPP_LIBS ${OPENTELEMETRY_CPP_LIBS} "${OPENTELEMETRY_CPP_${LIB}}")
endforeach(LIB)
message(STATUS "OpenTelemetry libs: ${OPENTELEMETRY_CPP_LIBS}")
mark_as_advanced(
OPENTELEMETRY_CPP_LIBS
OPENTELEMETRY_CPP_INCLUDE_DIR
)