Skip to content

Commit e628091

Browse files
committed
Merge branch 'release/0.3.0'
2 parents 794ae62 + 7e3b0f6 commit e628091

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3812
-1503
lines changed

.gitignore

-5
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ build
55
dist
66
gen-cpp
77

8-
.sconsign.dblite
9-
.conan*
10-
SConscript_conan
11-
conan*info.*
12-
config.log
138
tags
149

1510
*.o

.travis.yml

+46-27
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,80 @@
11
sudo: required
2-
32
dist: trusty
4-
5-
services:
6-
- docker
7-
83
os:
94
- linux
105
- osx
6+
osx_image: xcode8.2
117

128
addons:
139
apt:
14-
packages:
10+
packages: &default_packages
1511
- automake
12+
- autoconf
1613
- bison
1714
- flex
15+
- libtool
16+
- libc++-dev
1817
- build-essential
19-
- clang
20-
- cmake
21-
- g++
22-
- libboost-dev
23-
- libboost-filesystem-dev
24-
- libboost-program-options-dev
25-
- libboost-system-dev
26-
- libboost-test-dev
18+
- libboost-all-dev
2719
- libevent-dev
2820
- libssl-dev
29-
- libtool
21+
- libcurl4-openssl-dev
22+
- libdouble-conversion-dev
23+
- thrift-compiler
3024
- make
3125
- pkg-config
32-
- curl
3326
- tree
3427

3528
language: cpp
36-
37-
compiler:
38-
- clang
39-
- gcc
29+
cache: ccache
4030

4131
python:
4232
- "2.7"
4333

4434
env:
4535
global:
46-
- THRIFT_VERSION=0.10.0
47-
- RDKAFKA_VERSION=0.9.4
36+
- CMAKE_VERSION=3.7.2
4837

49-
install:
50-
- pip install --upgrade pip
51-
- pip install --user conan
38+
matrix:
39+
include:
40+
- os: osx
41+
- os: linux
42+
env: COMPILER_NAME=gcc CXX=g++-5 CC=gcc-5
43+
addons:
44+
apt:
45+
packages:
46+
- *default_packages
47+
- g++-5
48+
sources: &sources
49+
- llvm-toolchain-precise-3.8
50+
- ubuntu-toolchain-r-test
51+
- os: linux
52+
env: COMPILER_NAME=clang CXX=clang++-3.8 CC=clang-3.8
53+
addons:
54+
apt:
55+
packages:
56+
- *default_packages
57+
- clang-3.8
58+
sources: *sources
5259

5360
before_script:
5461
- .travis/install-dependencies.sh
5562

5663
script:
57-
- scons
64+
- mkdir build && cd build && rm -rf *
65+
- echo travis_fold:start:cmake CMake configure
66+
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ../cmake-$CMAKE_VERSION-Linux-x86_64/bin/cmake .. ;fi
67+
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then cmake .. -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl ;fi
68+
- echo travis_fold:end:cmake
69+
- make && make test
5870

5971
after_failure:
6072
- echo `pwd`
61-
- tree -h
73+
- cat externals/src/Folly/folly/config.log
74+
- cat externals/src/Thrift/config.log
75+
- tree -h
76+
77+
cache:
78+
ccache: true
79+
directories:
80+
- cmake-$CMAKE_VERSION-Linux-x86_64

.travis/install-dependencies.sh

+5-29
Original file line numberDiff line numberDiff line change
@@ -3,35 +3,11 @@ set -e
33

44
if [[ $TRAVIS_OS_NAME == 'osx' ]]; then
55
brew update
6-
brew install thrift librdkafka
7-
8-
$HOME/.local/bin/conan install --build missing
6+
brew install ccache curl double-conversion gflags glog google-benchmark gperftools rapidjson folly thrift librdkafka grpc doxygen
97
else
10-
curl -sSL "http://apache.mirrors.spacedump.net/thrift/$THRIFT_VERSION/thrift-$THRIFT_VERSION.tar.gz" -o thrift.tar.gz
11-
mkdir -p thrift-$THRIFT_VERSION
12-
tar zxf thrift.tar.gz -C thrift-$THRIFT_VERSION --strip-components=1
13-
rm thrift.tar.gz
14-
cd thrift-$THRIFT_VERSION
15-
./configure --without-python --without-java --without-ruby --without-php --without-erlang --without-go --without-nodejs --without-qt4
16-
make
17-
sudo make install
18-
cd ..
19-
rm -rf thrift-$THRIFT_VERSION
20-
21-
curl -sSL "https://github.com/edenhill/librdkafka/archive/v$RDKAFKA_VERSION.tar.gz" -o librdkafka.tar.gz
22-
mkdir -p librdkafka-$RDKAFKA_VERSION
23-
tar zxf librdkafka.tar.gz -C librdkafka-$RDKAFKA_VERSION --strip-components=1
24-
rm librdkafka.tar.gz
25-
cd librdkafka-$RDKAFKA_VERSION
26-
./configure
27-
make
28-
sudo make install
29-
cd ..
30-
rm -rf librdkafka-$RDKAFKA_VERSION
31-
32-
if [ "$CXX" == "g++" ]; then
33-
$HOME/.local/bin/conan install --build missing -s compiler=gcc -s compiler.libcxx=libstdc++11
34-
else
35-
$HOME/.local/bin/conan install --build missing -s compiler=clang -s compiler.libcxx=libstdc++11
8+
if [[ ! -f "cmake-$CMAKE_VERSION-Linux-x86_64/bin/cmake" ]]
9+
then
10+
wget --no-check-certificate https://cmake.org/files/v3.7/cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
11+
tar -xvf cmake-$CMAKE_VERSION-Linux-x86_64.tar.gz
3612
fi
3713
fi

CMakeLists.txt

+148-26
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
cmake_minimum_required (VERSION 2.8.12)
1+
cmake_minimum_required (VERSION 3.0.0)
22

3-
project(zipkin C CXX)
3+
project(zipkin-cpp
4+
VERSION 0.3.0
5+
LANGUAGES C CXX)
46

5-
set (zipkin_VERSION_MAJOR 0)
6-
set (zipkin_VERSION_MINOR 2)
7-
set (zipkin_VERSION_PATCH 0)
8-
set (zipkin_VERSION ${zipkin_VERSION_MAJOR}.${zipkin_VERSION_MINOR}.${zipkin_VERSION_PATCH})
7+
include(CTest)
8+
enable_testing()
9+
10+
set (CMAKE_C_STANDARD 99)
11+
set (CMAKE_C_STANDARD_REQUIRED ON)
12+
set (CMAKE_CXX_STANDARD 11)
13+
set (CMAKE_CXX_STANDARD_REQUIRED ON)
14+
set (CMAKE_CXX_EXTENSIONS OFF)
15+
set (CMAKE_COLOR_MAKEFILE ON)
916

10-
include(${PROJECT_SOURCE_DIR}/conanbuildinfo.cmake)
11-
conan_basic_setup()
17+
if (APPLE)
18+
set (CMAKE_MACOSX_RPATH ON)
19+
endif ()
1220

1321
if (NOT CMAKE_BUILD_TYPE)
1422
message(STATUS "Default build type 'Release with debug info'")
@@ -30,29 +38,84 @@ set(Boost_USE_STATIC_LIBS ON) # only find static libs
3038
set(Boost_USE_MULTITHREADED ON)
3139
set(Boost_USE_STATIC_RUNTIME OFF)
3240

33-
find_package(Boost REQUIRED COMPONENTS regex system)
41+
find_package(Boost REQUIRED COMPONENTS regex system thread)
3442
if(Boost_FOUND)
3543
include_directories(${Boost_INCLUDE_DIRS})
3644
endif()
3745

38-
find_package(Thrift REQUIRED)
39-
find_package(LibRDKafka REQUIRED)
40-
find_package(Doxygen QUIET)
46+
find_package(Threads REQUIRED)
47+
find_package(OpenSSL REQUIRED)
48+
find_package(ZLIB)
49+
find_package(Thrift)
50+
find_package(LibRDKafka)
51+
find_package(Folly)
52+
find_package(RapidJSON)
53+
find_package(DoubleConversion)
54+
find_package(GFlags)
55+
find_package(GLog)
56+
find_package(GTest)
57+
find_package(GBench)
58+
find_package(CURL)
59+
find_package(Protobuf)
60+
find_package(GRPC)
61+
find_package(Gperftools)
62+
find_package(Doxygen)
63+
64+
if (OPENSSL_FOUND)
65+
list(GET OPENSSL_LIBRARIES 0 openssl_libname)
66+
get_filename_component(OPENSSL_LIBRARY_DIR ${openssl_libname} DIRECTORY)
67+
get_filename_component(OPENSSL_ROOT_DIR ${OPENSSL_LIBRARY_DIR} DIRECTORY)
68+
69+
if (APPLE)
70+
set (WITH_OPENSSL "--with-openssl=${OPENSSL_ROOT_DIR}")
71+
endif ()
72+
73+
message(STATUS "Found OpenSSL ${OPENSSL_VERSION}, inc=${OPENSSL_INCLUDE_DIR}, libs=${OPENSSL_LIBRARIES} root=${OPENSSL_ROOT_DIR}")
74+
endif ()
75+
76+
include(InstallExternalProjects)
77+
78+
if (CURL_FOUND AND ZLIB_FOUND)
79+
set (WITH_CURL ON)
80+
else ()
81+
set (WITH_CURL OFF)
82+
endif ()
83+
84+
if (GRPC_FOUND)
85+
set (WITH_GRPC ON)
86+
else ()
87+
set (WITH_GRPC OFF)
88+
endif ()
4189

42-
if (${DOXYGEN_FOUND} AND ${RELEASE_BUILD})
90+
# gperftools - Google Performance Tool
91+
#
92+
# https://github.com/gperftools/gperftools
93+
if (GPERFTOOLS_FOUND)
94+
set (WITH_TCMALLOC ON)
95+
if (RELEASE_BUILD)
96+
set (WITH_PROFILER OFF)
97+
else ()
98+
set (WITH_PROFILER ON)
99+
endif ()
100+
else ()
101+
set (WITH_TCMALLOC OFF)
102+
set (WITH_PROFILER OFF)
103+
endif ()
104+
105+
if (DOXYGEN_FOUND AND RELEASE_BUILD)
43106
set (BUILD_DOCS ON)
44-
else()
107+
else ()
45108
set (BUILD_DOCS OFF)
46-
endif()
109+
endif ()
47110

111+
option (WITH_CURL "Build with cURL propagation" WITH_CURL)
112+
option (WITH_GRPC "Build with gRPC propagation" WITH_GRPC)
48113
option (WITH_FPIC "Build with -fPIC for shared library" OFF)
114+
option (WITH_TCMALLOC "Build with tcmalloc library" WITH_TCMALLOC)
115+
option (WITH_PROFILER "Build with CPU profiler" WITH_PROFILER)
49116
option (SHARED_LIB "Build shared library" OFF)
50117
option (BUILD_DOCS "Build API documentation (requires Doxygen)" BUILD_DOCS)
51118

52-
if (APPLE)
53-
set (CMAKE_MACOSX_RPATH ON)
54-
endif ()
55-
56119
if (RELEASE_BUILD)
57120
add_compile_options(-O2)
58121
else()
@@ -75,21 +138,80 @@ endif()
75138

76139
include_directories(${PROJECT_SOURCE_DIR}/src)
77140
include_directories(${PROJECT_SOURCE_DIR}/include)
78-
include_directories(${PROJECT_SOURCE_DIR}/gen-cpp)
79-
include_directories(${PROJECT_BINARY_DIR})
141+
include_directories(${PROJECT_BINARY_DIR}/gen-cpp)
142+
include_directories(${PROJECT_BINARY_DIR}/src)
80143
include_directories(SYSTEM include)
81144

82-
set(zipkin_DEPENDENCIES
83-
${CONAN_LIBS_GLOG}
84-
${CONAN_LIBS_GFLAGS}
145+
set (zipkin_DEPENDENCIES
146+
${GLOG_LIBRARY}
147+
${GFLAGS_LIBRARIES}
85148
${THRIFT_LIBRARIES}
86149
${LibRDKafka_LIBRARIES}
150+
${ZLIB_LIBRARIES}
151+
${OPENSSL_LIBRARIES}
152+
${FOLLY_STATIC_LIBRARY}
153+
${DOUBLE_CONVERSION_LIBRARY}
87154
${Boost_LIBRARIES}
155+
${CMAKE_THREAD_LIBS_INIT}
88156
)
89157

90-
message (STATUS "Link with ${zipkin_DEPENDENCIES}")
158+
if (WITH_CURL)
159+
if (NOT CURL_FOUND)
160+
message(SEND_ERROR "cURL not found")
161+
endif()
91162

92-
enable_testing()
163+
if (NOT ZLIB_FOUND)
164+
message(SEND_ERROR "zlib not found")
165+
endif()
166+
167+
message(STATUS "Build with cURL propagation")
168+
169+
list (APPEND zipkin_DEPENDENCIES ${CURL_LIBRARIES})
170+
171+
set (CURL_ENABLED 1)
172+
else()
173+
message(STATUS "cURL supports disabled")
174+
endif()
175+
176+
if (WITH_GRPC)
177+
if (NOT GRPC_FOUND)
178+
message(SEND_ERROR "gRPC not found")
179+
endif()
180+
181+
message(STATUS "Build with gRPC propagation")
182+
183+
list(APPEND zipkin_DEPENDENCIES ${GRPC_LIBRARIES})
184+
185+
set (GRPC_ENABLED 1)
186+
else()
187+
message(STATUS "gRPC supports disabled")
188+
endif()
189+
190+
if (WITH_TCMALLOC OR WITH_PROFILER)
191+
if (NOT GPERFTOOLS_FOUND)
192+
message(SEND_ERROR "gperftools not found")
193+
endif()
194+
195+
if (WITH_TCMALLOC)
196+
add_compile_options(-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free)
197+
endif ()
198+
199+
if (WITH_TCMALLOC AND WITH_PROFILER)
200+
message(STATUS "Build with tcmalloc and profiler library")
201+
202+
list(APPEND zipkin_DEPENDENCIES ${GPERFTOOLS_LIBRARIES})
203+
elseif (WITH_TCMALLOC)
204+
message(STATUS "Build with tcmalloc library")
205+
206+
list(APPEND zipkin_DEPENDENCIES ${GPERFTOOLS_TCMALLOC})
207+
elseif (WITH_PROFILER)
208+
message(STATUS "Build with profiler library")
209+
210+
list(APPEND zipkin_DEPENDENCIES ${GPERFTOOLS_PROFILER})
211+
endif ()
212+
endif ()
213+
214+
message (STATUS "Link with ${zipkin_DEPENDENCIES}")
93215

94216
add_subdirectory(docs)
95217
add_subdirectory(src)

bench/BenchSpan.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
void bench_span_reuse(benchmark::State &state)
1616
{
17-
std::unique_ptr<zipkin::Tracer> tracer(zipkin::Tracer::create(nullptr, "bench"));
17+
std::unique_ptr<zipkin::Tracer> tracer(zipkin::Tracer::create(nullptr));
1818
std::vector<zipkin::Span *> spans(state.range(0));
1919

2020
while (state.KeepRunning())

bench/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ add_executable(bench ${zipkin_bench_SRCS})
1010
target_link_libraries(bench
1111
zipkin
1212
${zipkin_DEPENDENCIES}
13-
${CONAN_LIBS_GOOGLE-BENCHMARK}
13+
${GBENCH_LIBRARY}
1414
)

0 commit comments

Comments
 (0)