]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
jaeger, build/op: add jaeger and it's dependencies as submodules
authorDeepika Upadhyay <dupadhya@redhat.com>
Tue, 13 Oct 2020 06:54:46 +0000 (12:24 +0530)
committerDeepika Upadhyay <dupadhya@redhat.com>
Fri, 11 Dec 2020 07:55:46 +0000 (07:55 +0000)
* 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<package>.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 <dupadhya@redhat.com>
23 files changed:
.gitmodules
CMakeLists.txt
ceph.spec.in
cmake/modules/BuildJaeger.cmake [new file with mode: 0644]
cmake/modules/BuildOpenTracing.cmake [new file with mode: 0644]
cmake/modules/Buildthrift.cmake [new file with mode: 0644]
cmake/modules/Buildyaml-cpp.cmake [new file with mode: 0644]
cmake/modules/ExternalProjectHelper.cmake [new file with mode: 0644]
cmake/modules/Findyaml-cpp.cmake [new file with mode: 0644]
cmake/modules/IncludeJaeger.cmake [new file with mode: 0644]
debian/control
debian/libjaeger.install [new file with mode: 0644]
install-deps.sh
src/CMakeLists.txt
src/crimson/CMakeLists.txt
src/include/config-h.in.cmake
src/jaegertracing/jaeger-client-cpp [new submodule]
src/jaegertracing/opentracing-cpp [new submodule]
src/jaegertracing/thrift [new submodule]
src/mon/CMakeLists.txt
src/os/CMakeLists.txt
src/rgw/CMakeLists.txt
src/vstart.sh

index 173563ebdfcafde38b94dcab6e6a8e5c621a168d..0015ac5e29bb6487a3faef94d91e468859cc2728 100644 (file)
 [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
index e2da7739c26fa2c308f46cd5874967c0c94daed1..d91ba8119e4d2292cff0596561600b44e9629db3 100644 (file)
@@ -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)
index 8f45c631fa5a5a6a85910c69edc327fd537f94e7..9ccbfa7b4f2f42a485f22557726acff7a94cd753 100644 (file)
@@ -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 (file)
index 0000000..6a7d412
--- /dev/null
@@ -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<package>.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 <BINARY_DIR> --config $<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 (file)
index 0000000..d9c716a
--- /dev/null
@@ -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 <BINARY_DIR> --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 (file)
index 0000000..6601b94
--- /dev/null
@@ -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 <BINARY_DIR> --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 (file)
index 0000000..f559c4d
--- /dev/null
@@ -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 <BINARY_DIR> --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 (file)
index 0000000..42beab1
--- /dev/null
@@ -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 (file)
index 0000000..d1e1357
--- /dev/null
@@ -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 (file)
index 0000000..b62265c
--- /dev/null
@@ -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)
index 13471e67c0ef36f757a297ad58f9fcc72a54a4d4..f9e1d502f104416817a9abac0fe6f50ee8f124c7 100644 (file)
@@ -7,7 +7,9 @@ Vcs-Browser: https://github.com/ceph/ceph
 Maintainer: Ceph Maintainers <ceph-maintainers@lists.ceph.com>
 Uploaders: Ken Dreyer <kdreyer@redhat.com>,
            Alfredo Deza <adeza@redhat.com>,
-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 (file)
index 0000000..e7cb033
--- /dev/null
@@ -0,0 +1,3 @@
+usr/lib/libopentracing.so.*
+usr/lib/libjaegertracing.so.*
+usr/lib/libthrift.so.*
index 146ae7189c63f52c608104b10f5d3db548b5a6b1..77c03c10b881a8c76d2955b614d20fc136cbff5c 100755 (executable)
@@ -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
index b8110eab6216c4d001bf84b51d0c8cf06ab156bd..061b1927bff8878ec3a605a147cf8530a677c2d5 100644 (file)
@@ -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)
index f714aa9fbade36d44c44567b661100e484b982d0..b814fb56a55927e12ba5893ddaabd51c125a72ad 100644 (file)
@@ -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
index f3931951322e180982ce8d7e89555e86cfc2ba27..4e08bbf4e49f528a3ff7f9f69bcd450d05123c26 100644 (file)
 /* 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 (submodule)
index 0000000..7ad60f7
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 7ad60f7330a421fe2adcab1a2d3dbf4159af6bc2
diff --git a/src/jaegertracing/opentracing-cpp b/src/jaegertracing/opentracing-cpp
new file mode 160000 (submodule)
index 0000000..4bb431f
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 4bb431f7728eaf383a07e86f9754a5b67575dab0
diff --git a/src/jaegertracing/thrift b/src/jaegertracing/thrift
new file mode 160000 (submodule)
index 0000000..b75e88a
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit b75e88a33d67ae05ef9b5fa001d2a63a2effe377
index e70dffe58b9a237495d41f9ee49a7c50f3dfe1d2..93f02c8bd5d11cef0d2fc846c4245a0a59fb0c42 100644 (file)
@@ -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()
index e4920f0c8bf701318fa135cbb05a5b410cd63d4b..9008f2ed8c04ed56dcb8967d20141c52c4810c9a 100644 (file)
@@ -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)
index dc67f65c7a92a47427c1af3216a57fcb4401d3b2..2eecd2245a343abc0050b9599394921a44808a5b 100644 (file)
@@ -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
index 88a161f7d6ae29f1c2d4e444593c3d0d6394d3a6..aceb72a32770446a64e2dbb694f1cc2ee58c30d8 100755 (executable)
@@ -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