Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jaegertracing build/ops integration #31358

Merged
merged 7 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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" OFF)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its

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)
Expand Down
54 changes: 48 additions & 6 deletions ceph.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
%endif
%endif
%bcond_with seastar
%bcond_with jaeger
%if 0%{?fedora} || 0%{?suse_version} >= 1500
# distros that ship cmd2 and/or colorama
%bcond_without cephfs_shell
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -796,7 +815,7 @@ Requires: python%{python3_pkgversion}-rados = %{_epoch_prefix}%{version}-%{relea
Provides: python-rgw = %{_epoch_prefix}%{version}-%{release}
Obsoletes: python-rgw < %{_epoch_prefix}%{version}-%{release}
%description -n python%{python3_pkgversion}-rgw
This package contains Python 3 libraries for interacting with Cephs RADOS
This package contains Python 3 libraries for interacting with Ceph RADOS
ideepika marked this conversation as resolved.
Show resolved Hide resolved
gateway.

%package -n python%{python3_pkgversion}-rados
Expand All @@ -810,7 +829,7 @@ Requires: librados2 = %{_epoch_prefix}%{version}-%{release}
Provides: python-rados = %{_epoch_prefix}%{version}-%{release}
Obsoletes: python-rados < %{_epoch_prefix}%{version}-%{release}
%description -n python%{python3_pkgversion}-rados
This package contains Python 3 libraries for interacting with Cephs RADOS
This package contains Python 3 libraries for interacting with Ceph RADOS
object store.

%if 0%{with libradosstriper}
Expand Down Expand Up @@ -885,7 +904,7 @@ Requires: python%{python3_pkgversion}-rados = %{_epoch_prefix}%{version}-%{relea
Provides: python-rbd = %{_epoch_prefix}%{version}-%{release}
Obsoletes: python-rbd < %{_epoch_prefix}%{version}-%{release}
%description -n python%{python3_pkgversion}-rbd
This package contains Python 3 libraries for interacting with Cephs RADOS
This package contains Python 3 libraries for interacting with Ceph RADOS
block device.

%package -n libcephfs2
Expand Down Expand Up @@ -916,7 +935,21 @@ Provides: libcephfs2-devel = %{_epoch_prefix}%{version}-%{release}
Obsoletes: libcephfs2-devel < %{_epoch_prefix}%{version}-%{release}
%description -n libcephfs-devel
This package contains libraries and headers needed to develop programs
that use Cephs distributed file system.
that use Ceph distributed file system.
ideepika marked this conversation as resolved.
Show resolved Hide resolved

%if 0%{with jaeger}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you expand a little bit in the commit message?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added comment on --without-jaeger build option

%package -n libjaeger
Summary: Ceph distributed file system tracing library
%if 0%{?suse_version}
Group: System/Libraries
%endif
Provides: libjaegertracing.so.0()(64bit)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

who will be consuming for instance libjaegertracing.so.0?

Copy link
Member Author

@ideepika ideepika Oct 13, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the internals of Provide script was not able to discover libjaegertracing.so.0 implicitly, and hence all the packages that had libjaeger as a dependency were failing with missing dependencies, explicit indication resolved that issue

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you be more specific which packages have libjaeger as a dependency?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sure, I added them in commit message:

note: libjaeger package if enabled will be a dependency on ceph-common, ceph-mon and transitively will be a dependency for modules that have them as  a dependency.

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.
%endif

%package -n python%{python3_pkgversion}-cephfs
Summary: Python 3 libraries for Ceph distributed file system
Expand All @@ -930,7 +963,7 @@ Requires: python%{python3_pkgversion}-ceph-argparse = %{_epoch_prefix}%{version}
Provides: python-cephfs = %{_epoch_prefix}%{version}-%{release}
Obsoletes: python-cephfs < %{_epoch_prefix}%{version}-%{release}
%description -n python%{python3_pkgversion}-cephfs
This package contains Python 3 libraries for interacting with Cephs distributed
This package contains Python 3 libraries for interacting with Ceph distributed
file system.

%package -n python%{python3_pkgversion}-ceph-argparse
Expand Down Expand Up @@ -1075,7 +1108,7 @@ Summary: Prometheus alerts for a Ceph deployment
BuildArch: noarch
Group: System/Monitoring
%description prometheus-alerts
This package provides Ceph’s default alerts for Prometheus.
This package provides Ceph default alerts for Prometheus.

#################################################################################
# common
Expand Down Expand Up @@ -2081,6 +2114,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
Expand Down
65 changes: 65 additions & 0 deletions cmake/modules/BuildJaeger.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# This module builds Jaeger after it's dependencies are installed and discovered
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its

# 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
ideepika marked this conversation as resolved.
Show resolved Hide resolved
# 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()
35 changes: 35 additions & 0 deletions cmake/modules/BuildOpenTracing.cmake
Original file line number Diff line number Diff line change
@@ -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()
54 changes: 54 additions & 0 deletions cmake/modules/Buildthrift.cmake
Original file line number Diff line number Diff line change
@@ -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()
36 changes: 36 additions & 0 deletions cmake/modules/Buildyaml-cpp.cmake
Original file line number Diff line number Diff line change
@@ -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()
17 changes: 17 additions & 0 deletions cmake/modules/ExternalProjectHelper.cmake
Original file line number Diff line number Diff line change
@@ -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 ()