From: Deepika Upadhyay Date: Tue, 13 Oct 2020 06:54:46 +0000 (+0530) Subject: jaeger, build/op: add jaeger and it's dependencies as submodules X-Git-Tag: v16.1.0~250^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4b69d3a1844433845eb7000f56be72fb11f4e737;p=ceph.git jaeger, build/op: add jaeger and it's dependencies as submodules * This commit introduces Jaegertracing library as package libjaeger, pickwhich would be consumed by other ceph pacakges such as ceph-common0 * adds the following dependencies, which would be build from source using ExternalProjectHelper.cmake +IncludeJaeger.cmake + Build.cmake scripts: jaegertracing: v0.6.0 [added as a submodule] opentracing: v1.6.0 [added as a submodule] thrift: 0.13.0 [added as a submodule] yaml-cpp: 0.6.0 json(optional) * updates Boost to be installed instead of being build only, because jaegertracing them during their build process. * ceph.spec.in: introduces a default enabled jaeger packaging option, which could be disabled using --without-jaeger flag during rpmbuild * note: libjaeger package if enabled will be a dependency on ceph-common, ceph-mon, rgw_common and transitively will be a dependency for modules that have them as a dependency. Signed-off-by: Deepika Upadhyay --- diff --git a/.gitmodules b/.gitmodules index 173563ebdfc..0015ac5e29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -65,3 +65,15 @@ [submodule "s3select"] path = src/s3select url = https://github.com/ceph/s3select.git +[submodule "src/jaegertracing/opentracing-cpp"] + path = src/jaegertracing/opentracing-cpp + url = https://github.com/opentracing/opentracing-cpp.git + branch = v1.6.0 +[submodule "src/jaegertracing/jaeger-client-cpp"] + path = src/jaegertracing/jaeger-client-cpp + url = https://github.com/ceph/jaeger-client-cpp.git + branch = hunter-disabled +[submodule "src/jaegertracing/thrift"] + path = src/jaegertracing/thrift + url = https://github.com/apache/thrift.git + branch = 0.13.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index e2da7739c26..d91ba8119e4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,6 +364,11 @@ if(WITH_BLKIN) include_directories(SYSTEM src/blkin/blkin-lib) endif(WITH_BLKIN) +option(WITH_JAEGER "Enable jaegertracing and it's dependent libraries" ON) +if(WITH_JAEGER) + set(HAVE_JAEGER TRUE) +endif() + #option for RGW option(WITH_RADOSGW "Rados Gateway is enabled" ON) option(WITH_RADOSGW_FCGI_FRONTEND "Rados Gateway's FCGI frontend is enabled" OFF) diff --git a/ceph.spec.in b/ceph.spec.in index 8f45c631fa5..9ccbfa7b4f2 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -61,6 +61,7 @@ %endif %endif %bcond_with seastar +%bcond_without jaeger %if 0%{?fedora} || 0%{?suse_version} >= 1500 # distros that ship cmd2 and/or colorama %bcond_without cephfs_shell @@ -202,6 +203,18 @@ BuildRequires: socat %if 0%{with zbd} BuildRequires: libzbd-devel %endif +%if 0%{with jaeger} +BuildRequires: bison +BuildRequires: flex +%if 0%{?fedora} || 0%{?rhel} +BuildRequires: json-devel +%endif +%if 0%{?suse_version} +BuildRequires: nlohmann_json-devel +%endif +BuildRequires: libevent-devel +BuildRequires: yaml-cpp-devel +%endif %if 0%{with seastar} BuildRequires: c-ares-devel BuildRequires: gnutls-devel @@ -409,6 +422,9 @@ Requires: python%{python3_pkgversion}-cephfs = %{_epoch_prefix}%{version}-%{rele Requires: python%{python3_pkgversion}-rgw = %{_epoch_prefix}%{version}-%{release} Requires: python%{python3_pkgversion}-ceph-argparse = %{_epoch_prefix}%{version}-%{release} Requires: python%{python3_pkgversion}-ceph-common = %{_epoch_prefix}%{version}-%{release} +%if 0%{with jaeger} +Requires: libjaeger = %{_epoch_prefix}%{version}-%{release} +%endif %if 0%{?fedora} || 0%{?rhel} Requires: python%{python3_pkgversion}-prettytable %endif @@ -448,6 +464,9 @@ Requires: ceph-base = %{_epoch_prefix}%{version}-%{release} Recommends: nvme-cli Recommends: smartmontools %endif +%if 0%{with jaeger} +Requires: libjaeger = %{_epoch_prefix}%{version}-%{release} +%endif %description mon ceph-mon is the cluster monitor daemon for the Ceph distributed file system. One or more instances of ceph-mon form a Paxos part-time @@ -918,6 +937,19 @@ Obsoletes: libcephfs2-devel < %{_epoch_prefix}%{version}-%{release} This package contains libraries and headers needed to develop programs that use Cephs distributed file system. +%if 0%{with jaeger} +%package -n libjaeger +Summary: Ceph distributed file system tracing library +%if 0%{?suse_version} +Group: System/Libraries +%endif +Provides: libjaegertracing.so.0()(64bit) +Provides: libopentracing.so.1()(64bit) +Provides: libthrift.so.0.13.0()(64bit) +%description -n libjaeger +This package contains libraries needed to provide distributed +tracing for Ceph. + %package -n python%{python3_pkgversion}-cephfs Summary: Python 3 libraries for Ceph distributed file system %if 0%{?suse_version} @@ -2081,6 +2113,15 @@ fi %{_includedir}/cephfs/metrics/Types.h %{_libdir}/libcephfs.so +%if %{with jaeger} +%files -n libjaeger +%{_libdir}/libopentracing.so.* +%{_libdir}/libthrift.so.* +%{_libdir}/libjaegertracing.so.* +%post -n libjaeger -p /sbin/ldconfig +%postun -n libjaeger -p /sbin/ldconfig +%endif + %files -n python%{python3_pkgversion}-cephfs %{python3_sitearch}/cephfs.cpython*.so %{python3_sitearch}/cephfs-*.egg-info diff --git a/cmake/modules/BuildJaeger.cmake b/cmake/modules/BuildJaeger.cmake new file mode 100644 index 00000000000..6a7d41208ad --- /dev/null +++ b/cmake/modules/BuildJaeger.cmake @@ -0,0 +1,65 @@ +# This module builds Jaeger after it's dependencies are installed and discovered +# opentracing: is built using cmake/modules/Buildopentracing.cmake +# Thrift: build using cmake/modules/Buildthrift.cmake +# yaml-cpp, nlhomann-json: are installed locally and then discovered using +# Find.cmake +# Boost Libraries used for building thrift are build and provided by +# cmake/modules/BuildBoost.cmake + +function(build_jaeger) + set(Jaeger_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/jaegertracing/jaeger-client-cpp") + set(Jaeger_INSTALL_DIR "${CMAKE_BINARY_DIR}/external") + set(Jaeger_BINARY_DIR "${Jaeger_INSTALL_DIR}/Jaeger") + + file(MAKE_DIRECTORY "${Jaeger_INSTALL_DIR}") + set(Jaeger_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DBUILD_SHARED_LIBS=ON + -DHUNTER_ENABLED=OFF + -DBUILD_TESTING=OFF + -DJAEGERTRACING_BUILD_EXAMPLES=OFF + -DCMAKE_PREFIX_PATH="${CMAKE_BINARY_DIR}/external;${CMAKE_BINARY_DIR}/boost" + -DCMAKE_INSTALL_RPATH=${CMAKE_BINARY_DIR}/external + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE + -DOpenTracing_DIR=${CMAKE_SOURCE_DIR}/src/jaegertracing/opentracing-cpp + -Dnlohmann_json_DIR=/usr/lib + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/boost\;${CMAKE_BINARY_DIR}/boost/include\;${CMAKE_BINARY_DIR}/external + -DCMAKE_FIND_ROOT_PATH=${CMAKE_BINARY_DIR}/boost\;${CMAKE_BINARY_DIR}/boost/include\;${CMAKE_BINARY_DIR}/external + -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/external/lib + -Dthrift_HOME=${CMAKE_BINARY_DIR}/external + -DOpenTracing_HOME=${CMAKE_BINARY_DIR}/external) + + set(dependencies opentracing thrift) + include(BuildOpenTracing) + build_opentracing() + include(Buildthrift) + build_thrift() + if(NOT yaml-cpp_FOUND) + include(Buildyaml-cpp) + build_yamlcpp() + add_library(yaml-cpp::yaml-cpp SHARED IMPORTED) + add_dependencies(yaml-cpp::yaml-cpp yaml-cpp) + set_library_properties_for_external_project(yaml-cpp::yaml-cpp yaml-cpp) + list(APPEND dependencies "yaml-cpp") + endif() + + if(CMAKE_MAKE_PROGRAM MATCHES "make") + # try to inherit command line arguments passed by parent "make" job + set(make_cmd $(MAKE)) + else() + set(make_cmd ${CMAKE_COMMAND} --build --config $ --target Jaeger) + endif() + set(install_cmd $(MAKE) install DESTDIR=) + + include(ExternalProject) + ExternalProject_Add(Jaeger + SOURCE_DIR ${Jaeger_SOURCE_DIR} + UPDATE_COMMAND "" + INSTALL_DIR "external" + PREFIX ${Jaeger_INSTALL_DIR} + CMAKE_ARGS ${Jaeger_CMAKE_ARGS} + BINARY_DIR ${Jaeger_BINARY_DIR} + BUILD_COMMAND ${make_cmd} + INSTALL_COMMAND ${install_cmd} + DEPENDS "${dependencies}" + ) +endfunction() diff --git a/cmake/modules/BuildOpenTracing.cmake b/cmake/modules/BuildOpenTracing.cmake new file mode 100644 index 00000000000..d9c716a23c4 --- /dev/null +++ b/cmake/modules/BuildOpenTracing.cmake @@ -0,0 +1,35 @@ +function(build_opentracing) + set(opentracing_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/jaegertracing/opentracing-cpp") + set(opentracing_BINARY_DIR "${CMAKE_BINARY_DIR}/external/opentracing-cpp") + + set(opentracing_CMAKE_ARGS -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DBUILD_MOCKTRACER=OFF + -DENABLE_LINTING=OFF + -DBUILD_STATIC_LIBS=OFF + -DBUILD_TESTING=OFF + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external + -DCMAKE_INSTALL_RPATH=${CMAKE_BINARY_DIR}/external + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE + -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/external/lib + -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/external) + + if(CMAKE_MAKE_PROGRAM MATCHES "make") + # try to inherit command line arguments passed by parent "make" job + set(make_cmd $(MAKE) ) + else() + set(make_cmd ${CMAKE_COMMAND} --build --target opentracing) + endif() + set(install_cmd $(MAKE) install DESTDIR=) + + include(ExternalProject) + ExternalProject_Add(opentracing + SOURCE_DIR ${opentracing_SOURCE_DIR} + UPDATE_COMMAND "" + INSTALL_DIR "external" + PREFIX "external/opentracing-cpp" + CMAKE_ARGS ${opentracing_CMAKE_ARGS} + BUILD_IN_SOURCE 1 + BUILD_COMMAND ${make_cmd} + INSTALL_COMMAND ${install_cmd} + ) +endfunction() diff --git a/cmake/modules/Buildthrift.cmake b/cmake/modules/Buildthrift.cmake new file mode 100644 index 00000000000..6601b943a16 --- /dev/null +++ b/cmake/modules/Buildthrift.cmake @@ -0,0 +1,54 @@ +function(build_thrift) + set(thrift_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/jaegertracing/thrift") + set(thrift_BINARY_DIR "${CMAKE_BINARY_DIR}/external/thrift") + + set(thrift_CMAKE_ARGS -DCMAKE_BUILD_TYPE=Release + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DBUILD_JAVA=OFF + -DBUILD_PYTHON=OFF + -DBUILD_TESTING=OFF + -DBUILD_TUTORIALS=OFF + -DBUILD_C_GLIB=OFF + -DBUILD_HASKELL=OFF + -DWITH_LIBEVENT=OFF + -DWITH_ZLIB=OFF + -DBoost_INCLUDE_DIRS=${CMAKE_BINARY_DIR}/boost/include + -DCMAKE_INSTALL_PREFIX="${CMAKE_BINARY_DIR}/boost;${CMAKE_BINARY_DIR}/boost/include;${CMAKE_BINARY_DIR}/external" + -DCMAKE_FIND_ROOT_PATH="${CMAKE_BINARY_DIR}/boost;${CMAKE_BINARY_DIR}/boost/include;${CMAKE_BINARY_DIR}/external" + -DCMAKE_INSTALL_RPATH=${CMAKE_BINARY_DIR}/external/lib + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external + -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/external/lib) + + if(WITH_SYSTEM_BOOST) + message(STATUS "thrift will be using system boost") + set(dependencies "") + list(APPEND thrift_CMAKE_ARGS -DBOOST_ROOT=/opt/ceph) + list(APPEND thrift_CMAKE_ARGS -DCMAKE_FIND_ROOT_PATH=/opt/ceph) + else() + message(STATUS "thrift will be using external build boost") + set(dependencies Boost) + list(APPEND thrift_CMAKE_ARGS -DCMAKE_FIND_ROOT_PATH=${CMAKE_BINARY_DIR}/boost) + list(APPEND thrift_CMAKE_ARGS -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/external) + endif() + + if(CMAKE_MAKE_PROGRAM MATCHES "make") + # try to inherit command line arguments passed by parent "make" job + set(make_cmd $(MAKE)) + else() + set(make_cmd ${CMAKE_COMMAND} --build --target thrift) + endif() + + set(install_cmd $(MAKE) install DESTDIR=) + + include(ExternalProject) + ExternalProject_Add(thrift + SOURCE_DIR ${thrift_SOURCE_DIR} + PREFIX "${CMAKE_BINARY_DIR}/external/thrift" + CMAKE_ARGS ${thrift_CMAKE_ARGS} + BINARY_DIR ${thrift_BINARY_DIR} + BUILD_COMMAND ${make_cmd} + INSTALL_COMMAND ${install_cmd} + DEPENDS ${dependencies} + ) +endfunction() diff --git a/cmake/modules/Buildyaml-cpp.cmake b/cmake/modules/Buildyaml-cpp.cmake new file mode 100644 index 00000000000..f559c4d4dca --- /dev/null +++ b/cmake/modules/Buildyaml-cpp.cmake @@ -0,0 +1,36 @@ +function(build_yamlcpp) + set(yaml-cpp_DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/src/jaegertracing") + set(yaml-cpp_SOURCE_DIR "${CMAKE_SOURCE_DIR}/src/jaegertracing/yaml-cpp") + set(yaml-cpp_BINARY_DIR "${CMAKE_BINARY_DIR}/external/yaml-cpp") + + set(yaml-cpp_CMAKE_ARGS -DBUILD_SHARED_LIBS=ON + -DYAML_CPP_BUILD_TESTS=OFF + -DYAML_CPP_BUILD_CONTRIB=OFF + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/external + -DCMAKE_INSTALL_RPATH=${CMAKE_BINARY_DIR}/external/lib + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=TRUE + -DCMAKE_INSTALL_LIBDIR=${CMAKE_BINARY_DIR}/external/lib + -DCMAKE_PREFIX_PATH=${CMAKE_BINARY_DIR}/external) + + if(CMAKE_MAKE_PROGRAM MATCHES "make") + # try to inherit command line arguments passed by parent "make" job + set(make_cmd "$(MAKE)") + else() + set(make_cmd ${CMAKE_COMMAND} --build --target yaml-cpp) + endif() +set(install_cmd $(MAKE) install DESTDIR=) + + include(ExternalProject) + ExternalProject_Add(yaml-cpp + GIT_REPOSITORY "https://github.com/jbeder/yaml-cpp.git" + GIT_TAG "yaml-cpp-0.6.2" + UPDATE_COMMAND "" + INSTALL_DIR "${CMAKE_BINARY_DIR}/external" + DOWNLOAD_DIR ${yaml-cpp_DOWNLOAD_DIR} + SOURCE_DIR ${yaml-cpp_SOURCE_DIR} + PREFIX "${CMAKE_BINARY_DIR}/external/yaml-cpp" + CMAKE_ARGS ${yaml-cpp_CMAKE_ARGS} + BUILD_COMMAND ${make_cmd} + INSTALL_COMMAND ${install_cmd} + ) +endfunction() diff --git a/cmake/modules/ExternalProjectHelper.cmake b/cmake/modules/ExternalProjectHelper.cmake new file mode 100644 index 00000000000..42beab197de --- /dev/null +++ b/cmake/modules/ExternalProjectHelper.cmake @@ -0,0 +1,17 @@ +function (set_library_properties_for_external_project _target _lib) + # Manually create the directory, it will be created as part of the build, + # but this runs in the configuration phase, and CMake generates an error if + # we add an include directory that does not exist yet. + set(_libfullname "${CMAKE_SHARED_LIBRARY_PREFIX}${_lib}${CMAKE_SHARED_LIBRARY_SUFFIX}") + set(_libpath "${CMAKE_BINARY_DIR}/external/lib/${_libfullname}") + set(_includepath "${CMAKE_BINARY_DIR}/external/include") + message(STATUS "Configuring ${_target} with ${_libpath}") + + file(MAKE_DIRECTORY "${_includepath}") + set_target_properties(${_target} PROPERTIES + INTERFACE_LINK_LIBRARIES "${_libpath}" + IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" + IMPORTED_LOCATION "${_libpath}" + INTERFACE_INCLUDE_DIRECTORIES "${_includepath}") + # set_property(TARGET ${_target} APPEND PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES "CXX") +endfunction () diff --git a/cmake/modules/Findyaml-cpp.cmake b/cmake/modules/Findyaml-cpp.cmake new file mode 100644 index 00000000000..d1e135737d1 --- /dev/null +++ b/cmake/modules/Findyaml-cpp.cmake @@ -0,0 +1,62 @@ +# +# This file is open source software, licensed to you under the terms +# of the Apache License, Version 2.0 (the "License"). See the NOTICE file +# distributed with this work for additional information regarding copyright +# ownership. 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. +# + +# +# Copyright (C) 2018 Scylladb, Ltd. +# + +find_package (PkgConfig REQUIRED) + +pkg_search_module (yaml-cpp_PC yaml-cpp) + +find_library (yaml-cpp_LIBRARY + NAMES yaml-cpp + HINTS + ${yaml-cpp_PC_LIBDIR} + ${yaml-cpp_PC_LIBRARY_DIRS}) + +find_path (yaml-cpp_INCLUDE_DIR + NAMES yaml-cpp/yaml.h + PATH_SUFFIXES yaml-cpp + HINTS + ${yaml-cpp_PC_INCLUDEDIR} + ${yaml-cpp_PC_INCLUDE_DIRS}) + +mark_as_advanced ( + yaml-cpp_LIBRARY + yaml-cpp_INCLUDE_DIR) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args (yaml-cpp + REQUIRED_VARS + yaml-cpp_LIBRARY + yaml-cpp_INCLUDE_DIR + VERSION_VAR yaml-cpp_PC_VERSION) + +set (yaml-cpp_LIBRARIES ${yaml-cpp_LIBRARY}) +set (yaml-cpp_INCLUDE_DIRS ${yaml-cpp_INCLUDE_DIR}) + +if (yaml-cpp_FOUND AND NOT (TARGET yaml-cpp::yaml-cpp)) + add_library (yaml-cpp::yaml-cpp UNKNOWN IMPORTED) + + set_target_properties (yaml-cpp::yaml-cpp + PROPERTIES + IMPORTED_LOCATION ${yaml-cpp_LIBRARY} + INTERFACE_INCLUDE_DIRECTORIES ${yaml-cpp_INCLUDE_DIRS}) +endif () diff --git a/cmake/modules/IncludeJaeger.cmake b/cmake/modules/IncludeJaeger.cmake new file mode 100644 index 00000000000..b62265c9757 --- /dev/null +++ b/cmake/modules/IncludeJaeger.cmake @@ -0,0 +1,21 @@ +include(BuildJaeger) +include(BuildOpenTracing) + +include(ExternalProjectHelper) + +build_jaeger() + +add_library(opentracing::libopentracing SHARED IMPORTED) +add_dependencies(opentracing::libopentracing opentracing) +add_library(jaegertracing::libjaegertracing SHARED IMPORTED) +add_dependencies(jaegertracing::libjaegertracing Jaeger) +add_library(thrift::libthrift SHARED IMPORTED) +add_dependencies(thrift::libthrift thrift) + +#(set_library_properties_for_external_project _target _lib) +set_library_properties_for_external_project(opentracing::libopentracing + opentracing) +set_library_properties_for_external_project(jaegertracing::libjaegertracing + jaegertracing) +set_library_properties_for_external_project(thrift::libthrift + thrift) diff --git a/debian/control b/debian/control index 13471e67c0e..f9e1d502f10 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,9 @@ Vcs-Browser: https://github.com/ceph/ceph Maintainer: Ceph Maintainers Uploaders: Ken Dreyer , Alfredo Deza , -Build-Depends: cmake (>= 3.10.2), +Build-Depends: automake, + bison, + cmake (>= 3.10.2), cpio, cryptsetup-bin | cryptsetup, cython, @@ -17,6 +19,7 @@ Build-Depends: cmake (>= 3.10.2), dh-exec, dh-python, dh-systemd, + flex, git, gperf, g++ (>= 7), @@ -32,6 +35,7 @@ Build-Depends: cmake (>= 3.10.2), libcap-ng-dev, libcunit1-dev, libcurl4-openssl-dev, + libevent-dev, libexpat1-dev, libfuse-dev, libgoogle-perftools-dev [i386 amd64 arm64], @@ -58,7 +62,7 @@ Build-Depends: cmake (>= 3.10.2), libudev-dev, libnl-genl-3-dev, libxml2-dev, -# Crimson libyaml-cpp-dev, + libyaml-cpp-dev, librabbitmq-dev, librdkafka-dev, # Make-Check libxmlsec1, @@ -66,6 +70,7 @@ Build-Depends: cmake (>= 3.10.2), # Make-Check libxmlsec1-openssl, # Make-Check libxmlsec1-dev, lsb-release, + nlohmann-json-dev | nlohmann-json3-dev, parted, patch, pkg-config, @@ -362,6 +367,7 @@ Description: debugging symbols for ceph-mgr Package: ceph-mon Architecture: linux-any Depends: ceph-base (= ${binary:Version}), + libjaeger, ${misc:Depends}, ${shlibs:Depends}, Replaces: ceph (<< 10), ceph-test (<< 12.2.2-14) @@ -594,7 +600,8 @@ Description: debugging symbols for rbd-nbd Package: ceph-common Architecture: linux-any -Depends: librbd1 (= ${binary:Version}), +Depends: libjaeger (= ${binary:Version}), + librbd1 (= ${binary:Version}), python3-cephfs (= ${binary:Version}), python3-ceph-argparse (= ${binary:Version}), python3-ceph-common (= ${binary:Version}), @@ -931,6 +938,13 @@ Description: debugging symbols for radosgw . This package contains debugging symbols for radosgw. +Package: libjaeger +Architecture: linux-any +Section: libs +Depends: ${misc:Depends}, + ${shlibs:Depends}, +Description: This package provides libraries needed for distributed tracing for Ceph. + Package: ceph-test Architecture: linux-any Depends: ceph-common, diff --git a/debian/libjaeger.install b/debian/libjaeger.install new file mode 100644 index 00000000000..e7cb033ac52 --- /dev/null +++ b/debian/libjaeger.install @@ -0,0 +1,3 @@ +usr/lib/libopentracing.so.* +usr/lib/libjaegertracing.so.* +usr/lib/libthrift.so.* diff --git a/install-deps.sh b/install-deps.sh index 146ae7189c6..77c03c10b88 100755 --- a/install-deps.sh +++ b/install-deps.sh @@ -284,9 +284,15 @@ else *Bionic*) ensure_decent_gcc_on_ubuntu 9 bionic [ ! $NO_BOOST_PKGS ] && install_boost_on_ubuntu bionic + $SUDO apt-get install -y nlohmann-json-dev ;; *Disco*) [ ! $NO_BOOST_PKGS ] && apt-get install -y libboost1.67-all-dev + $SUDO apt-get install -y nlohmann-json-dev + ;; + *Focal*) + [ ! $NO_BOOST_PKGS ] && apt-get install -y libboost1.71-all-dev + $SUDO apt-get install -y nlohmann-json3-dev ;; *) $SUDO apt-get install -y gcc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b8110eab621..061b1927bff 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -387,6 +387,38 @@ set_source_files_properties(ceph_ver.c APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/src/include/ceph_ver.h) add_library(common-objs OBJECT ${libcommon_files}) +if(WITH_JAEGER) + find_package(yaml-cpp 0.6.0) + if(NOT yaml-cpp_FOUND) + set(jaeger_libs ${CMAKE_BINARY_DIR}/external/lib/libyaml-cpp.so.0.6.2) + execute_process(COMMAND bash -c "grep -q 'yaml-cpp' debian/libjaeger.install || echo 'usr/lib/libyaml-cpp.so.*' >> debian/libjaeger.install" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) + endif() + include(IncludeJaeger) + add_library(jaeger-base INTERFACE) + add_dependencies(common-objs + yaml-cpp::yaml-cpp + opentracing::libopentracing + thrift::libthrift + jaegertracing::libjaegertracing) + target_link_libraries(jaeger-base INTERFACE + yaml-cpp::yaml-cpp + opentracing::libopentracing + thrift::libthrift + jaegertracing::libjaegertracing) + include_directories(SYSTEM ${CMAKE_BINARY_DIR}/external/include) + #with CMake 3.12+ the following can be replaced by: + #target_link_libraries(common-objs jaeger-base) + list(APPEND jaeger_libs + ${CMAKE_BINARY_DIR}/external/lib/libjaegertracing.so.0 + ${CMAKE_BINARY_DIR}/external/lib/libjaegertracing.so.0.6.1 + ${CMAKE_BINARY_DIR}/external/lib/libopentracing.so.1 + ${CMAKE_BINARY_DIR}/external/lib/libopentracing.so.1.6.0 + ${CMAKE_BINARY_DIR}/external/lib/libthrift.so.0.13.0) + install(FILES ${jaeger_libs} + DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif() + CHECK_C_COMPILER_FLAG("-fvar-tracking-assignments" HAS_VTA) add_subdirectory(auth) add_subdirectory(common) @@ -447,6 +479,10 @@ if(WITH_DPDK) list(APPEND ceph_common_deps common_async_dpdk) endif() +if(WITH_JAEGER) + list(APPEND ceph_common_deps jaeger-base) +endif() + if(WIN32) list(APPEND ceph_common_deps ws2_32 mswsock iphlpapi bcrypt) list(APPEND ceph_common_deps dlfcn_win32) diff --git a/src/crimson/CMakeLists.txt b/src/crimson/CMakeLists.txt index f714aa9fbad..b814fb56a55 100644 --- a/src/crimson/CMakeLists.txt +++ b/src/crimson/CMakeLists.txt @@ -124,7 +124,13 @@ target_compile_definitions(crimson-common PRIVATE set(crimson_common_deps Boost::iostreams - Boost::random) + Boost::random + json_spirit) + +if(WITH_JAEGER) + include_directories(SYSTEM ${CMAKE_BINARY_DIR}/external/include) + list(APPEND crimson_common_deps jaeger-base) +endif() if(NOT WITH_SYSTEM_BOOST) list(APPEND crimson_common_deps ${ZLIB_LIBRARIES}) @@ -132,7 +138,6 @@ endif() target_link_libraries(crimson-common PUBLIC - json_spirit crimson::cflags PRIVATE crc32 diff --git a/src/include/config-h.in.cmake b/src/include/config-h.in.cmake index f3931951322..4e08bbf4e49 100644 --- a/src/include/config-h.in.cmake +++ b/src/include/config-h.in.cmake @@ -166,6 +166,9 @@ /* Define if you want to use LTTng */ #cmakedefine WITH_LTTNG +/* Define if you want to use Jaeger */ +#cmakedefine HAVE_JAEGER + /* Define if you want to use EVENTTRACE */ #cmakedefine WITH_EVENTTRACE diff --git a/src/jaegertracing/jaeger-client-cpp b/src/jaegertracing/jaeger-client-cpp new file mode 160000 index 00000000000..7ad60f7330a --- /dev/null +++ b/src/jaegertracing/jaeger-client-cpp @@ -0,0 +1 @@ +Subproject commit 7ad60f7330a421fe2adcab1a2d3dbf4159af6bc2 diff --git a/src/jaegertracing/opentracing-cpp b/src/jaegertracing/opentracing-cpp new file mode 160000 index 00000000000..4bb431f7728 --- /dev/null +++ b/src/jaegertracing/opentracing-cpp @@ -0,0 +1 @@ +Subproject commit 4bb431f7728eaf383a07e86f9754a5b67575dab0 diff --git a/src/jaegertracing/thrift b/src/jaegertracing/thrift new file mode 160000 index 00000000000..b75e88a33d6 --- /dev/null +++ b/src/jaegertracing/thrift @@ -0,0 +1 @@ +Subproject commit b75e88a33d67ae05ef9b5fa001d2a63a2effe377 diff --git a/src/mon/CMakeLists.txt b/src/mon/CMakeLists.txt index e70dffe58b9..93f02c8bd5d 100644 --- a/src/mon/CMakeLists.txt +++ b/src/mon/CMakeLists.txt @@ -34,3 +34,6 @@ endif() add_library(mon STATIC ${lib_mon_srcs}) target_link_libraries(mon kv heap_profiler) +if(WITH_JAEGER) + target_link_libraries(mon jaeger-base) +endif() diff --git a/src/os/CMakeLists.txt b/src/os/CMakeLists.txt index e4920f0c8bf..9008f2ed8c0 100644 --- a/src/os/CMakeLists.txt +++ b/src/os/CMakeLists.txt @@ -91,6 +91,10 @@ if(WITH_LTTNG) add_dependencies(os bluestore-tp) endif() +if(WITH_JAEGER) + target_link_libraries(os jaeger-base) +endif() + target_link_libraries(os kv) add_dependencies(os compressor_plugins) diff --git a/src/rgw/CMakeLists.txt b/src/rgw/CMakeLists.txt index dc67f65c7a9..2eecd2245a3 100644 --- a/src/rgw/CMakeLists.txt +++ b/src/rgw/CMakeLists.txt @@ -185,6 +185,10 @@ if(WITH_LTTNG) add_dependencies(rgw_common rgw_op-tp rgw_rados-tp) endif() +if(WITH_JAEGER) + add_dependencies(rgw_common jaegertracing::libjaegertracing) +endif() + set(rgw_a_srcs rgw_auth_keystone.cc rgw_client_io.cc diff --git a/src/vstart.sh b/src/vstart.sh index 88a161f7d6a..aceb72a3277 100755 --- a/src/vstart.sh +++ b/src/vstart.sh @@ -62,6 +62,7 @@ fi if [ -n "$CEPH_BUILD_ROOT" ]; then [ -z "$CEPH_BIN" ] && CEPH_BIN=$CEPH_BUILD_ROOT/bin [ -z "$CEPH_LIB" ] && CEPH_LIB=$CEPH_BUILD_ROOT/lib + [ -z "$CEPH_EXT_LIB" ] && CEPH_EXT_LIB=$CEPH_BUILD_ROOT/external/lib [ -z "$EC_PATH" ] && EC_PATH=$CEPH_LIB/erasure-code [ -z "$OBJCLASS_PATH" ] && OBJCLASS_PATH=$CEPH_LIB/rados-classes # make install should install python extensions into PYTHONPATH @@ -72,6 +73,7 @@ elif [ -n "$CEPH_ROOT" ]; then [ -z "$CEPH_ADM" ] && CEPH_ADM=$CEPH_BIN/ceph [ -z "$INIT_CEPH" ] && INIT_CEPH=$CEPH_BIN/init-ceph [ -z "$CEPH_LIB" ] && CEPH_LIB=$CEPH_BUILD_DIR/lib + [ -z "$CEPH_EXT_LIB" ] && CEPH_EXT_LIB=$CEPH_BUILD_DIR/external/lib [ -z "$OBJCLASS_PATH" ] && OBJCLASS_PATH=$CEPH_LIB [ -z "$EC_PATH" ] && EC_PATH=$CEPH_LIB [ -z "$CEPH_PYTHON_COMMON" ] && CEPH_PYTHON_COMMON=$CEPH_ROOT/src/python-common @@ -87,8 +89,8 @@ fi CYTHON_PYTHONPATH="$CEPH_LIB/cython_modules/lib.3" export PYTHONPATH=$PYBIND:$CYTHON_PYTHONPATH:$CEPH_PYTHON_COMMON$PYTHONPATH -export LD_LIBRARY_PATH=$CEPH_LIB:$LD_LIBRARY_PATH -export DYLD_LIBRARY_PATH=$CEPH_LIB:$DYLD_LIBRARY_PATH +export LD_LIBRARY_PATH=$CEPH_LIB:$CEPH_EXT_LIB:$LD_LIBRARY_PATH +export DYLD_LIBRARY_PATH=$CEPH_LIB:$CEPH_EXT_LIB:$DYLD_LIBRARY_PATH # Suppress logging for regular use that indicated that we are using a # development version. vstart.sh is only used during testing and # development