Skip to content

Commit

Permalink
add support of zipkin trace
Browse files Browse the repository at this point in the history
  • Loading branch information
huiyongchen committed Feb 21, 2019
1 parent e663956 commit 5f46a69
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 4 deletions.
2 changes: 2 additions & 0 deletions conf/TarsTest.LogServer.config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<reserved_port>
HttpProxyObj=10375
</reserved_port>
collector_host=127.0.0.1
collector_port=9411
</client>
</application>
<log>
Expand Down
2 changes: 2 additions & 0 deletions conf/TarsTest.StatServer.config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
<reserved_port>
HttpProxyObj=10375
</reserved_port>
collector_host=127.0.0.1
collector_port=9411
</client>
</application>
<log>
Expand Down
2 changes: 2 additions & 0 deletions conf/TarsTest.TestcaseServer.config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@
<reserved_port>
HttpProxyObj=10375
</reserved_port>
collector_host=127.0.0.1
collector_port=9411
</client>
</application>
<log>
Expand Down
2 changes: 2 additions & 0 deletions conf/TarsTest.UnitTest.config.conf
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@
<reserved_port>
HttpProxyObj=10375
</reserved_port>
collector_host=127.0.0.1
collector_port=9411
</client>
</application>
<log>
Expand Down
30 changes: 28 additions & 2 deletions project/cmakeConf/pre_make.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -O2 -Wall -Wno-deprecated")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -Wno-deprecated ")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -O2 -Wall -Wno-deprecated -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O2 -Wall -Wno-deprecated -pthread")

OPTION(ENABLE_GCOV "Enable gcov (debug, Linux builds only)" ON)
set(_USE_OPENTRACKING $ENV{_USE_OPENTRACKING})

if(ENABLE_GCOV AND NOT WIN32 AND NOT APPLE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
Expand All @@ -15,6 +16,31 @@ set(TARS_PROTOCOL_INC ${TARS_CODE_ROOT}/unittest/protocol/TarsTest)

set(TARS_UTIL_LIB ${TARS_CODE_ROOT}/util/lib)
set(TARS_SERVANT_LIB ${TARS_CODE_ROOT}/servant/lib)
set(GTEST_LIB_PATH /usr/local/lib64)

if(_USE_OPENTRACKING)
#set(CURL_LIB_PATH /usr/local/lib)
add_definitions(-D_USE_OPENTRACKING=1)
set(CURL_LIB_PATH /usr/lib64)
set(ZIPKIN_OPENTRACKING_LIB_PATH /usr/local/lib)
set(ZIPKIN_LIB_PATH /usr/local/lib)
set(OPENTRACKING_LIB_PATH /usr/local/lib)
set(TRACKING_LIBS_PATH "${ZIPKIN_OPENTRACKING_LIB_PATH} ${ZIPKIN_LIB_PATH} ${OPENTRACKING_LIB_PATH}")
set(TRACKING_LIBS "opentracing zipkin_opentracing zipkin curl")
link_directories(
${TARS_UTIL_LIB}
${TARS_SERVANT_LIB}
${GTEST_LIB_PATH}
${TRACKING_LIBS_PATH}
${CURL_LIB_PATH}
)
else()
link_directories(
${TARS_UTIL_LIB}
${TARS_SERVANT_LIB}
${GTEST_LIB_PATH}
)
endif()

set(TARS_TEST_PROTOCOL_PATH ${TARS_TEST_ROOT}/protocol)
set(TEST_CODE_SRC ${TARS_TEST_ROOT}/testcode/source)
Expand Down
4 changes: 4 additions & 0 deletions project/logServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ ${TARS_SERVANT_LIB}

add_executable(logServer ${LOG_SRV})

if(_USE_OPENTRACKING)
target_link_libraries(logServer tarsservant tarsutil pthread opentracing zipkin_opentracing zipkin curl)
else()
target_link_libraries(logServer tarsservant tarsutil pthread)
endif()
4 changes: 4 additions & 0 deletions project/statServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@ ${TARS_SERVANT_LIB}

add_executable(statServer ${STAT_SRV})

if(_USE_OPENTRACKING)
target_link_libraries(statServer tarsservant tarsutil pthread opentracing zipkin_opentracing zipkin curl)
else()
target_link_libraries(statServer tarsservant tarsutil pthread)
endif()
9 changes: 9 additions & 0 deletions project/testcase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
project(tars_testcase)
cmake_minimum_required(VERSION 2.6.2)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lgtest")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lgtest")
message(STATUS "start build tars test project:" ${CMAKE_CURRENT_SOURCE_DIR})

set(TARS_CODE_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
Expand Down Expand Up @@ -28,11 +30,18 @@ list(APPEND TESTCASE_SRC ${TEST_CODE_SRC}/main.cpp)

message(STATUS "TAF_LIB:" ${TAF_LIB})

set(GOOGLETEST_LIB /usr/local/lib64)

link_directories(
${TARS_UTIL_LIB}
${TARS_SERVANT_LIB}
${GOOGLETEST_LIB}
)

add_executable(testcase ${TESTCASE_SRC})

if(_USE_OPENTRACKING)
target_link_libraries(testcase tarsservant tarsutil gtest gtest_main pthread z pthread opentracing zipkin_opentracing zipkin curl)
else()
target_link_libraries(testcase tarsservant tarsutil gtest pthread z)
endif()
4 changes: 4 additions & 0 deletions project/unitTestServer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ ${TARS_SERVANT_LIB}

add_executable(unitTestServer ${UNIT_TEST_SRV})

if(_USE_OPENTRACKING)
target_link_libraries(unitTestServer tarsservant tarsutil pthread opentracing zipkin_opentracing zipkin curl)
else()
target_link_libraries(unitTestServer tarsservant tarsutil pthread)
endif()
4 changes: 2 additions & 2 deletions script/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ cd ./build

if [ "$clean_build"x == "YES"x ] ;then
rm -rf !tarscpp
cd ${TARS_ROOT}/cpp
cd ${TARS_ROOT}
find . -name "*.gcda" | xargs rm -rf
cd -
fi

if [ "$clean_all"x == "YES"x ] ;then
rm -rf *
cd ${TARS_ROOT}/cpp
cd ${TARS_ROOT}
find . -name "*.gcda" | xargs rm -rf
cd -
fi
Expand Down

0 comments on commit 5f46a69

Please sign in to comment.