From b1940acc5aa62732b56fa82013cad8c809485b3e Mon Sep 17 00:00:00 2001 From: isaachier Date: Wed, 2 May 2018 17:52:05 -0400 Subject: [PATCH] Use thrift 0.11.0 (#94) * Upgrade Thrift to 0.11.0 Signed-off-by: Isaac Hier * Update copyrights on touched files Signed-off-by: Isaac Hier --- CMakeLists.txt | 147 +- cmake/Hunter/config.cmake | 1 - crossdock/Server.cpp | 12 +- idl | 2 +- scripts/thrift-gen.patch | 115 ++ src/jaegertracing/UDPTransport.cpp | 2 +- src/jaegertracing/UDPTransport.h | 4 +- src/jaegertracing/net/URI.cpp | 13 +- src/jaegertracing/net/http/Header.h | 10 +- src/jaegertracing/net/http/Request.cpp | 10 +- src/jaegertracing/net/http/Response.cpp | 11 +- src/jaegertracing/testutils/CMakeLists.txt | 9 - src/jaegertracing/testutils/MockAgent.cpp | 21 +- src/jaegertracing/thrift-gen/Agent.cpp | 67 +- src/jaegertracing/thrift-gen/Agent.h | 104 +- .../thrift-gen/AggregationValidator.cpp | 102 +- .../thrift-gen/AggregationValidator.h | 103 +- .../thrift-gen/BaggageRestrictionManager.cpp | 102 +- .../thrift-gen/BaggageRestrictionManager.h | 103 +- src/jaegertracing/thrift-gen/Collector.cpp | 102 +- src/jaegertracing/thrift-gen/Collector.h | 103 +- src/jaegertracing/thrift-gen/Dependency.cpp | 131 +- src/jaegertracing/thrift-gen/Dependency.h | 113 +- .../thrift-gen/SamplingManager.cpp | 102 +- .../thrift-gen/SamplingManager.h | 103 +- .../thrift-gen/TracedService.cpp | 195 ++- src/jaegertracing/thrift-gen/TracedService.h | 122 +- .../thrift-gen/ZipkinCollector.cpp | 102 +- .../thrift-gen/ZipkinCollector.h | 103 +- .../thrift-gen/agent_constants.cpp | 2 +- .../thrift-gen/agent_constants.h | 2 +- src/jaegertracing/thrift-gen/agent_types.cpp | 2 +- src/jaegertracing/thrift-gen/agent_types.h | 5 +- .../aggregation_validator_constants.cpp | 2 +- .../aggregation_validator_constants.h | 2 +- .../aggregation_validator_types.cpp | 22 +- .../thrift-gen/aggregation_validator_types.h | 14 +- .../thrift-gen/baggage_constants.cpp | 2 +- .../thrift-gen/baggage_constants.h | 2 +- .../thrift-gen/baggage_types.cpp | 22 +- src/jaegertracing/thrift-gen/baggage_types.h | 14 +- .../thrift-gen/dependency_constants.cpp | 2 +- .../thrift-gen/dependency_constants.h | 2 +- .../thrift-gen/dependency_types.cpp | 42 +- .../thrift-gen/dependency_types.h | 23 +- .../thrift-gen/jaeger_constants.cpp | 2 +- .../thrift-gen/jaeger_constants.h | 2 +- src/jaegertracing/thrift-gen/jaeger_types.cpp | 192 ++- src/jaegertracing/thrift-gen/jaeger_types.h | 72 +- .../thrift-gen/sampling_constants.cpp | 2 +- .../thrift-gen/sampling_constants.h | 2 +- .../thrift-gen/sampling_types.cpp | 116 +- src/jaegertracing/thrift-gen/sampling_types.h | 52 +- .../thrift-gen/tracetest_constants.cpp | 2 +- .../thrift-gen/tracetest_constants.h | 2 +- .../thrift-gen/tracetest_types.cpp | 1357 ++++++++--------- .../thrift-gen/tracetest_types.h | 564 ++++--- .../thrift-gen/zipkincore_constants.cpp | 51 +- .../thrift-gen/zipkincore_constants.h | 48 +- .../thrift-gen/zipkincore_types.cpp | 136 +- .../thrift-gen/zipkincore_types.h | 52 +- src/jaegertracing/utils/Regex.cpp | 17 - src/jaegertracing/utils/Regex.h | 39 - src/jaegertracing/utils/UDPClient.cpp | 4 +- src/jaegertracing/utils/UDPClient.h | 2 +- 65 files changed, 3019 insertions(+), 1969 deletions(-) delete mode 100644 cmake/Hunter/config.cmake create mode 100644 scripts/thrift-gen.patch delete mode 100644 src/jaegertracing/testutils/CMakeLists.txt delete mode 100644 src/jaegertracing/utils/Regex.cpp delete mode 100644 src/jaegertracing/utils/Regex.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 61d6dfde..e370e998 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,8 @@ set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/toolchain.cmake" include(CMakeDependentOption) include(HunterGate) HunterGate( - URL "https://github.com/ruslo/hunter/archive/v0.20.18.tar.gz" - SHA1 "c2614bc107a5172c167a5784f476b6fb39e314a9" - LOCAL + URL "https://github.com/ruslo/hunter/archive/v0.20.62.tar.gz" + SHA1 "10ffae63cf7b07193d6d7b459c1d0cfa242fad5b" ) project(jaegertracing VERSION 0.3.0) @@ -36,16 +35,9 @@ endif() set(package_deps) if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND - CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") - set(boost_components regex) - hunter_add_package(Boost COMPONENTS regex) - list(APPEND LIBS Boost::regex) -else() - set(boost_components) - hunter_add_package(Boost) + CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.9") + message(FATAL_ERROR "Must use gcc >= 4.9") endif() -find_package(Boost ${hunter_config} REQUIRED ${boost_components}) -list(APPEND package_deps Boost) hunter_add_package(thrift) find_package(thrift ${hunter_config} REQUIRED) @@ -100,38 +92,6 @@ if(BUILD_TESTING) endif() endif() -if(JAEGERTRACING_BUILD_CROSSDOCK) - set(CROSSDOCK_SRC crossdock/Server.cpp) - add_executable(crossdock ${CROSSDOCK_SRC}) - target_include_directories(crossdock PUBLIC - $) - target_link_libraries(crossdock PUBLIC jaegertracing-static) - - set(JAEGER_CROSSDOCK_URL -"https://raw.githubusercontent.com/jaegertracing/jaeger/master/docker-compose/\ -jaeger-docker-compose.yml") - file(DOWNLOAD ${JAEGER_CROSSDOCK_URL} - "${PROJECT_SOURCE_DIR}/crossdock/jaeger-docker-compose.yml") - find_program(DOCKER_COMPOSE_EXE docker-compose REQUIRED) - set(DOCKER_COMPOSE_CMD ${DOCKER_COMPOSE_EXE} - -f ${PROJECT_SOURCE_DIR}/crossdock/docker-compose.yml - -f ${PROJECT_SOURCE_DIR}/crossdock/jaeger-docker-compose.yml) - add_custom_target(crossdock-kill - COMMAND ${DOCKER_COMPOSE_CMD} kill - COMMAND ${DOCKER_COMPOSE_CMD} rm --force) - add_custom_target(crossdock-run - COMMAND ${DOCKER_COMPOSE_CMD} build - COMMAND ${DOCKER_COMPOSE_CMD} run crossdock - DEPENDS crossdock-kill) - add_custom_target(crossdock-fresh - COMMAND ${DOCKER_COMPOSE_CMD} pull - COMMAND ${DOCKER_COMPOSE_CMD} build - COMMAND ${DOCKER_COMPOSE_CMD} run crossdock - DEPENDS crossdock-kill) - add_custom_target(crossdock-logs - COMMAND ${DOCKER_COMPOSE_CMD} logs) -endif() - set(SRC src/jaegertracing/Config.cpp src/jaegertracing/LogRecord.cpp @@ -203,7 +163,6 @@ set(SRC src/jaegertracing/thrift-gen/Collector.cpp src/jaegertracing/thrift-gen/Dependency.cpp src/jaegertracing/thrift-gen/SamplingManager.cpp - src/jaegertracing/thrift-gen/TracedService.cpp src/jaegertracing/thrift-gen/ZipkinCollector.cpp src/jaegertracing/thrift-gen/agent_constants.cpp src/jaegertracing/thrift-gen/agent_types.cpp @@ -217,25 +176,52 @@ set(SRC src/jaegertracing/thrift-gen/jaeger_types.cpp src/jaegertracing/thrift-gen/sampling_constants.cpp src/jaegertracing/thrift-gen/sampling_types.cpp - src/jaegertracing/thrift-gen/tracetest_constants.cpp - src/jaegertracing/thrift-gen/tracetest_types.cpp src/jaegertracing/thrift-gen/zipkincore_constants.cpp src/jaegertracing/thrift-gen/zipkincore_types.cpp src/jaegertracing/utils/ErrorUtil.cpp src/jaegertracing/utils/HexParsing.cpp src/jaegertracing/utils/RateLimiter.cpp - src/jaegertracing/utils/Regex.cpp src/jaegertracing/utils/UDPClient.cpp src/jaegertracing/utils/YAML.cpp) -add_library(jaegertracing SHARED ${SRC}) -target_include_directories(jaegertracing PUBLIC - $ - $) -target_link_libraries(jaegertracing ${LIBS}) -set_target_properties(jaegertracing PROPERTIES - VERSION ${PROJECT_VERSION} - SOVERSION ${PROJECT_VERSION_MAJOR}) +if(JAEGERTRACING_BUILD_CROSSDOCK) + list(APPEND SRC + src/jaegertracing/thrift-gen/TracedService.cpp + src/jaegertracing/thrift-gen/tracetest_constants.cpp + src/jaegertracing/thrift-gen/tracetest_types.cpp) +endif() + +function(add_lib_deps lib) + target_include_directories(${lib} PUBLIC + $ + $) + target_link_libraries(${lib} PUBLIC ${LIBS}) +endfunction() + +option(JAEGERTRACING_PLUGIN "Build dynamic plugin" OFF) +cmake_dependent_option(BUILD_SHARED_LIBS "Build shared libraries" ON + "NOT JAEGERTRACING_PLUGIN" OFF) + +if(BUILD_SHARED_LIBS) + add_library(jaegertracing SHARED ${SRC}) + add_lib_deps(jaegertracing) + set_target_properties(jaegertracing PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}) + set(JAEGERTRACING_LIB jaegertracing) + list(APPEND JAEGERTRACING_LIBS jaegertracing) +endif() + +if(JAEGERTRACING_PLUGIN) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/export.map + "{ global: OpenTracingMakeTracerFactory; local: *; };") + add_library(jaegertracing_plugin MODULE ${SRC}) + add_lib_deps(jaegertracing_plugin) + target_link_libraries(jaegertracing_plugin PUBLIC + -static-libgcc + -static-libstdc++ + -Wl,--version-script=${CMAKE_CURRENT_BINARY_DIR}/export.map) +endif() add_library(jaegertracing-static STATIC ${SRC}) target_include_directories(jaegertracing-static PUBLIC @@ -252,17 +238,24 @@ configure_file( set(CMAKE_INCLUDE_CURRENT_DIR ON) if(BUILD_TESTING) - add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/jaegertracing/testutils") - set(TEST_SRC + add_library(testutils + src/jaegertracing/testutils/TUDPTransport.cpp + src/jaegertracing/testutils/SamplingManager.cpp + src/jaegertracing/testutils/MockAgent.cpp + src/jaegertracing/testutils/TracerUtil.cpp) + target_link_libraries(testutils PUBLIC ${JAEGERTRACING_LIB}) + + add_executable(UnitTest src/jaegertracing/ConfigTest.cpp + src/jaegertracing/DynamicLoadTest.cpp src/jaegertracing/ReferenceTest.cpp src/jaegertracing/SpanContextTest.cpp src/jaegertracing/SpanTest.cpp src/jaegertracing/TagTest.cpp src/jaegertracing/TraceIDTest.cpp - src/jaegertracing/TracerTest.cpp src/jaegertracing/TracerFactoryTest.cpp src/jaegertracing/DynamicLoadTest.cpp + src/jaegertracing/TracerTest.cpp src/jaegertracing/UDPTransportTest.cpp src/jaegertracing/baggage/BaggageTest.cpp src/jaegertracing/metrics/MetricsTest.cpp @@ -277,12 +270,10 @@ if(BUILD_TESTING) src/jaegertracing/reporters/ReporterTest.cpp src/jaegertracing/samplers/SamplerTest.cpp src/jaegertracing/testutils/MockAgentTest.cpp - src/jaegertracing/testutils/TracerUtil.cpp src/jaegertracing/testutils/TUDPTransportTest.cpp src/jaegertracing/utils/ErrorUtilTest.cpp src/jaegertracing/utils/RateLimiterTest.cpp src/jaegertracing/utils/UDPClientTest.cpp) - add_executable(UnitTest ${TEST_SRC}) target_compile_definitions(UnitTest PUBLIC GTEST_HAS_TR1_TUPLE=0 GTEST_USE_OWN_TR1_TUPLE=0) @@ -304,6 +295,40 @@ if(BUILD_TESTING) endif() endif() +if(JAEGERTRACING_BUILD_CROSSDOCK) + set(CROSSDOCK_SRC crossdock/Server.cpp) + add_executable(crossdock ${CROSSDOCK_SRC}) + target_include_directories(crossdock PUBLIC + $) + target_link_libraries(crossdock PUBLIC ${JAEGERTRACING_LIB}) + + set(JAEGER_CROSSDOCK_URL +"https://raw.githubusercontent.com/jaegertracing/jaeger/master/docker-compose/\ +jaeger-docker-compose.yml") + file(DOWNLOAD ${JAEGER_CROSSDOCK_URL} + "${CMAKE_CURRENT_SOURCE_DIR}/crossdock/jaeger-docker-compose.yml") + find_program(DOCKER_COMPOSE_EXE docker-compose REQUIRED) + set(DOCKER_COMPOSE_CMD ${DOCKER_COMPOSE_EXE} + -f ${CMAKE_CURRENT_SOURCE_DIR}/crossdock/docker-compose.yml + -f ${CMAKE_CURRENT_SOURCE_DIR}/crossdock/jaeger-docker-compose.yml) + add_custom_target(crossdock-kill + COMMAND ${DOCKER_COMPOSE_CMD} kill + COMMAND ${DOCKER_COMPOSE_CMD} rm --force) + add_custom_target(crossdock-run + COMMAND ${DOCKER_COMPOSE_CMD} build + COMMAND ${DOCKER_COMPOSE_CMD} run crossdock + DEPENDS crossdock-kill) + add_custom_target(crossdock-fresh + COMMAND ${DOCKER_COMPOSE_CMD} pull + COMMAND ${DOCKER_COMPOSE_CMD} build + COMMAND ${DOCKER_COMPOSE_CMD} run crossdock + DEPENDS crossdock-kill) + add_custom_target(crossdock-logs + COMMAND ${DOCKER_COMPOSE_CMD} logs) +endif() + + + # Installation (https://github.com/forexample/package-example) # Layout. This works for all platforms: diff --git a/cmake/Hunter/config.cmake b/cmake/Hunter/config.cmake deleted file mode 100644 index 8bc95a80..00000000 --- a/cmake/Hunter/config.cmake +++ /dev/null @@ -1 +0,0 @@ -hunter_config(thrift VERSION 0.9.2-p2) diff --git a/crossdock/Server.cpp b/crossdock/Server.cpp index fb924c5d..cc6836e5 100644 --- a/crossdock/Server.cpp +++ b/crossdock/Server.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -90,7 +90,8 @@ void from_json(const nlohmann::json& json, Downstream& downstream) downstream.__set_transport(json.at("transport").get()); auto itr = json.find("downstream"); if (itr != std::end(json) && !itr->is_null()) { - downstream.__set_downstream(itr->get()); + downstream.__set_downstream( + std::make_shared(itr->get())); } } @@ -160,7 +161,8 @@ void from_json(const nlohmann::json& json, TraceResponse& response) } itr = json.find("downstream"); if (itr != std::end(json) && !itr->is_null()) { - response.__set_downstream(itr->get()); + response.__set_downstream( + std::make_shared(itr->get())); } FIELD_FROM_JSON(response, notImplementedError); } @@ -346,8 +348,8 @@ thrift::TraceResponse prepareResponse(const opentracing::SpanContext& ctx, thrift::TraceResponse response; response.__set_span(observedSpan); if (downstream) { - response.__set_downstream( - callDownstream(ctx, role, *downstream, tracer, logger)); + response.__set_downstream(std::make_shared( + callDownstream(ctx, role, *downstream, tracer, logger))); } return response; } diff --git a/idl b/idl index 6710b74a..95d85500 160000 --- a/idl +++ b/idl @@ -1 +1 @@ -Subproject commit 6710b74a8559dfba9773f972619d2a8cd80178f2 +Subproject commit 95d85500d409d56c8a3be2ede56c42a2ed984a63 diff --git a/scripts/thrift-gen.patch b/scripts/thrift-gen.patch new file mode 100644 index 00000000..aa484888 --- /dev/null +++ b/scripts/thrift-gen.patch @@ -0,0 +1,115 @@ +diff --git a/src/jaegertracing/thrift-gen/tracetest_types.cpp b/src/jaegertracing/thrift-gen/tracetest_types.cpp +index cb7199e..ceb7a20 100644 +--- a/src/jaegertracing/thrift-gen/tracetest_types.cpp ++++ b/src/jaegertracing/thrift-gen/tracetest_types.cpp +@@ -60,7 +60,7 @@ void Downstream::__set_transport(const Transport::type val) { + this->transport = val; + } + +-void Downstream::__set_downstream(const Downstream& val) { ++void Downstream::__set_downstream(const std::shared_ptr& val) { + this->downstream = val; + __isset.downstream = true; + } +@@ -141,7 +141,7 @@ uint32_t Downstream::read(::apache::thrift::protocol::TProtocol* iprot) { + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { +- xfer += this->downstream.read(iprot); ++ xfer += this->downstream->read(iprot); + this->__isset.downstream = true; + } else { + xfer += iprot->skip(ftype); +@@ -196,7 +196,7 @@ uint32_t Downstream::write(::apache::thrift::protocol::TProtocol* oprot) const { + + if (this->__isset.downstream) { + xfer += oprot->writeFieldBegin("downstream", ::apache::thrift::protocol::T_STRUCT, 6); +- xfer += this->downstream.write(oprot); ++ xfer += this->downstream->write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); +@@ -672,7 +672,7 @@ void TraceResponse::__set_span(const ObservedSpan& val) { + __isset.span = true; + } + +-void TraceResponse::__set_downstream(const TraceResponse& val) { ++void TraceResponse::__set_downstream(const std::shared_ptr& val) { + this->downstream = val; + __isset.downstream = true; + } +@@ -719,7 +719,7 @@ uint32_t TraceResponse::read(::apache::thrift::protocol::TProtocol* iprot) { + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { +- xfer += this->downstream.read(iprot); ++ xfer += this->downstream->read(iprot); + this->__isset.downstream = true; + } else { + xfer += iprot->skip(ftype); +@@ -759,7 +759,7 @@ uint32_t TraceResponse::write(::apache::thrift::protocol::TProtocol* oprot) cons + } + if (this->__isset.downstream) { + xfer += oprot->writeFieldBegin("downstream", ::apache::thrift::protocol::T_STRUCT, 2); +- xfer += this->downstream.write(oprot); ++ xfer += this->downstream->write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldBegin("notImplementedError", ::apache::thrift::protocol::T_STRING, 3); +diff --git a/src/jaegertracing/thrift-gen/tracetest_types.h b/src/jaegertracing/thrift-gen/tracetest_types.h +index 5a0e6c9..a44f3a3 100644 +--- a/src/jaegertracing/thrift-gen/tracetest_types.h ++++ b/src/jaegertracing/thrift-gen/tracetest_types.h +@@ -61,7 +61,7 @@ class Downstream : public virtual ::apache::thrift::TBase { + std::string host; + std::string port; + Transport::type transport; +- Downstream downstream; ++ std::shared_ptr downstream; + + _Downstream__isset __isset; + +@@ -75,7 +75,7 @@ class Downstream : public virtual ::apache::thrift::TBase { + + void __set_transport(const Transport::type val); + +- void __set_downstream(const Downstream& val); ++ void __set_downstream(const std::shared_ptr& val); + + bool operator == (const Downstream & rhs) const + { +@@ -91,7 +91,7 @@ class Downstream : public virtual ::apache::thrift::TBase { + return false; + if (__isset.downstream != rhs.__isset.downstream) + return false; +- else if (__isset.downstream && !(downstream == rhs.downstream)) ++ else if (__isset.downstream && !(*downstream == *rhs.downstream)) + return false; + return true; + } +@@ -273,14 +273,14 @@ class TraceResponse : public virtual ::apache::thrift::TBase { + + virtual ~TraceResponse() throw(); + ObservedSpan span; +- TraceResponse downstream; ++ std::shared_ptr downstream; + std::string notImplementedError; + + _TraceResponse__isset __isset; + + void __set_span(const ObservedSpan& val); + +- void __set_downstream(const TraceResponse& val); ++ void __set_downstream(const std::shared_ptr& val); + + void __set_notImplementedError(const std::string& val); + +@@ -292,7 +292,7 @@ class TraceResponse : public virtual ::apache::thrift::TBase { + return false; + if (__isset.downstream != rhs.__isset.downstream) + return false; +- else if (__isset.downstream && !(downstream == rhs.downstream)) ++ else if (__isset.downstream && !(*downstream == *rhs.downstream)) + return false; + if (!(notImplementedError == rhs.notImplementedError)) + return false; diff --git a/src/jaegertracing/UDPTransport.cpp b/src/jaegertracing/UDPTransport.cpp index 1310ff32..8f990045 100644 --- a/src/jaegertracing/UDPTransport.cpp +++ b/src/jaegertracing/UDPTransport.cpp @@ -39,7 +39,7 @@ constexpr auto kEmitBatchOverhead = 30; template int calcSizeOfSerializedThrift(const ThriftType& base, int maxPacketSize) { - boost::shared_ptr buffer( + std::shared_ptr buffer( new apache::thrift::transport::TMemoryBuffer(maxPacketSize)); apache::thrift::protocol::TCompactProtocolFactory factory; auto protocol = factory.getProtocol(buffer); diff --git a/src/jaegertracing/UDPTransport.h b/src/jaegertracing/UDPTransport.h index 31858081..25e3a775 100644 --- a/src/jaegertracing/UDPTransport.h +++ b/src/jaegertracing/UDPTransport.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,7 +53,7 @@ class UDPTransport : public Transport { int _maxSpanBytes; int _byteBufferSize; std::vector _spanBuffer; - boost::shared_ptr _protocol; + std::shared_ptr _protocol; thrift::Process _process; int _processByteSize; }; diff --git a/src/jaegertracing/net/URI.cpp b/src/jaegertracing/net/URI.cpp index d6a0a203..7687cbb6 100644 --- a/src/jaegertracing/net/URI.cpp +++ b/src/jaegertracing/net/URI.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,7 @@ #include #include #include - -#include "jaegertracing/utils/Regex.h" +#include namespace jaegertracing { namespace net { @@ -68,11 +67,11 @@ URI URI::parse(const std::string& uriStr) { // See https://tools.ietf.org/html/rfc3986 for explanation. URI uri; - regex_namespace::regex uriRegex( + std::regex uriRegex( "^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?", - regex_namespace::regex::extended); - regex_namespace::smatch match; - regex_namespace::regex_match(uriStr, match, uriRegex); + std::regex::extended); + std::smatch match; + std::regex_match(uriStr, match, uriRegex); constexpr auto kSchemeIndex = 2; constexpr auto kAuthorityIndex = 4; diff --git a/src/jaegertracing/net/http/Header.h b/src/jaegertracing/net/http/Header.h index 7787743d..27d0d65b 100644 --- a/src/jaegertracing/net/http/Header.h +++ b/src/jaegertracing/net/http/Header.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ #include #include "jaegertracing/net/http/Error.h" -#include "jaegertracing/utils/Regex.h" namespace jaegertracing { namespace net { @@ -78,15 +77,14 @@ inline std::istream& readLineCRLF(std::istream& in, std::string& line) inline void readHeaders(std::istream& in, std::vector
& headers) { - const regex_namespace::regex headerPattern("([^:]+): (.+)$"); + const std::regex headerPattern("([^:]+): (.+)$"); std::string line; - regex_namespace::smatch match; + std::smatch match; while (readLineCRLF(in, line)) { if (line.empty()) { break; } - if (!regex_namespace::regex_match(line, match, headerPattern) || - match.size() < 3) { + if (!std::regex_match(line, match, headerPattern) || match.size() < 3) { throw ParseError::make("header", line); } headers.emplace_back(Header(match[1], match[2])); diff --git a/src/jaegertracing/net/http/Request.cpp b/src/jaegertracing/net/http/Request.cpp index 19d97b17..55758cb1 100644 --- a/src/jaegertracing/net/http/Request.cpp +++ b/src/jaegertracing/net/http/Request.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,7 @@ #include "jaegertracing/net/http/Request.h" -#include "jaegertracing/utils/Regex.h" +#include namespace jaegertracing { namespace net { @@ -24,12 +24,12 @@ namespace http { Request Request::parse(std::istream& in) { - const regex_namespace::regex requestLinePattern( + const std::regex requestLinePattern( "([A-Z]+) ([^ ]+) HTTP/([0-9]\\.[0-9])$"); std::string line; - regex_namespace::smatch match; + std::smatch match; if (!readLineCRLF(in, line) || - !regex_namespace::regex_match(line, match, requestLinePattern) || + !std::regex_match(line, match, requestLinePattern) || match.size() < 4) { throw ParseError::make("request line", line); } diff --git a/src/jaegertracing/net/http/Response.cpp b/src/jaegertracing/net/http/Response.cpp index 94648729..c4fc4e8b 100644 --- a/src/jaegertracing/net/http/Response.cpp +++ b/src/jaegertracing/net/http/Response.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ #include "jaegertracing/Constants.h" #include "jaegertracing/net/Socket.h" -#include "jaegertracing/utils/Regex.h" namespace jaegertracing { namespace net { @@ -33,13 +32,11 @@ namespace http { Response Response::parse(std::istream& in) { - const regex_namespace::regex statusLinePattern( - "HTTP/([0-9]\\.[0-9]) ([0-9]+) (.+)$"); + const std::regex statusLinePattern("HTTP/([0-9]\\.[0-9]) ([0-9]+) (.+)$"); std::string line; - regex_namespace::smatch match; + std::smatch match; if (!readLineCRLF(in, line) || - !regex_namespace::regex_match(line, match, statusLinePattern) || - match.size() < 4) { + !std::regex_match(line, match, statusLinePattern) || match.size() < 4) { throw ParseError::make("status line", line); } Response response; diff --git a/src/jaegertracing/testutils/CMakeLists.txt b/src/jaegertracing/testutils/CMakeLists.txt deleted file mode 100644 index 215630f6..00000000 --- a/src/jaegertracing/testutils/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -set(SRC -MockAgent.cpp -SamplingManager.cpp -TUDPTransport.cpp) - -add_library(testutils ${SRC}) -target_include_directories(testutils PUBLIC - $) -target_link_libraries(testutils thrift::thrift_static) diff --git a/src/jaegertracing/testutils/MockAgent.cpp b/src/jaegertracing/testutils/MockAgent.cpp index 57091c15..bf156063 100644 --- a/src/jaegertracing/testutils/MockAgent.cpp +++ b/src/jaegertracing/testutils/MockAgent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ #include "jaegertracing/testutils/MockAgent.h" +#include #include #include @@ -28,7 +29,6 @@ #include "jaegertracing/net/http/Response.h" #include "jaegertracing/samplers/RemoteSamplingJSON.h" #include "jaegertracing/utils/ErrorUtil.h" -#include "jaegertracing/utils/Regex.h" #include "jaegertracing/utils/UDPClient.h" namespace jaegertracing { @@ -90,14 +90,10 @@ void MockAgent::serveUDP(std::promise& started) apache::thrift::protocol::TCompactProtocolFactory; using TMemoryBuffer = apache::thrift::transport::TMemoryBuffer; - // Trick for converting `std::shared_ptr` into `boost::shared_ptr`. See - // https://stackoverflow.com/a/12315035/1930331. - auto ptr = shared_from_this(); - boost::shared_ptr iface( - ptr.get(), [ptr](MockAgent*) mutable { ptr.reset(); }); + auto iface = shared_from_this(); agent::thrift::AgentProcessor handler(iface); TCompactProtocolFactory protocolFactory; - boost::shared_ptr trans( + std::shared_ptr trans( new TMemoryBuffer(net::kUDPPacketMaxLength)); // Notify main thread that setup is done. @@ -140,7 +136,7 @@ void MockAgent::serveHTTP(std::promise& started) _servingHTTP = true; started.set_value(); - const regex_namespace::regex servicePattern("[?&]service=([^?&]+)"); + const std::regex servicePattern("[?&]service=([^?&]+)"); while (isServingHTTP()) { constexpr auto kBufferSize = 256; std::array buffer; @@ -168,12 +164,11 @@ void MockAgent::serveHTTP(std::promise& started) _httpAddress.authority() + "/baggageRestrictions")) { resource = Resource::kBaggage; } - regex_namespace::smatch match; - if (!regex_namespace::regex_search(target, match, servicePattern)) { + std::smatch match; + if (!std::regex_search(target, match, servicePattern)) { throw net::http::ParseError("no 'service' parameter"); } - if (regex_namespace::regex_search(match.suffix().str(), - servicePattern)) { + if (std::regex_search(match.suffix().str(), servicePattern)) { throw net::http::ParseError( "'service' parameter must occur only once"); } diff --git a/src/jaegertracing/thrift-gen/Agent.cpp b/src/jaegertracing/thrift-gen/Agent.cpp index 22ca2375..bc7d948f 100644 --- a/src/jaegertracing/thrift-gen/Agent.cpp +++ b/src/jaegertracing/thrift-gen/Agent.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ Agent_emitZipkinBatch_args::~Agent_emitZipkinBatch_args() throw() { uint32_t Agent_emitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -67,7 +68,7 @@ uint32_t Agent_emitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* uint32_t Agent_emitZipkinBatch_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Agent_emitZipkinBatch_args"); xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); @@ -84,7 +85,6 @@ uint32_t Agent_emitZipkinBatch_args::write(::apache::thrift::protocol::TProtocol xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -95,7 +95,7 @@ Agent_emitZipkinBatch_pargs::~Agent_emitZipkinBatch_pargs() throw() { uint32_t Agent_emitZipkinBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Agent_emitZipkinBatch_pargs"); xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); @@ -112,7 +112,6 @@ uint32_t Agent_emitZipkinBatch_pargs::write(::apache::thrift::protocol::TProtoco xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -123,6 +122,7 @@ Agent_emitBatch_args::~Agent_emitBatch_args() throw() { uint32_t Agent_emitBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -163,7 +163,7 @@ uint32_t Agent_emitBatch_args::read(::apache::thrift::protocol::TProtocol* iprot uint32_t Agent_emitBatch_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Agent_emitBatch_args"); xfer += oprot->writeFieldBegin("batch", ::apache::thrift::protocol::T_STRUCT, 1); @@ -172,7 +172,6 @@ uint32_t Agent_emitBatch_args::write(::apache::thrift::protocol::TProtocol* opro xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -183,7 +182,7 @@ Agent_emitBatch_pargs::~Agent_emitBatch_pargs() throw() { uint32_t Agent_emitBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Agent_emitBatch_pargs"); xfer += oprot->writeFieldBegin("batch", ::apache::thrift::protocol::T_STRUCT, 1); @@ -192,7 +191,6 @@ uint32_t Agent_emitBatch_pargs::write(::apache::thrift::protocol::TProtocol* opr xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -327,11 +325,56 @@ void AgentProcessor::process_emitBatch(int32_t, ::apache::thrift::protocol::TPro return; } -::boost::shared_ptr< ::apache::thrift::TProcessor > AgentProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > AgentProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< AgentIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< AgentIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new AgentProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< AgentIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new AgentProcessor(handler)); return processor; } + +void AgentConcurrentClient::emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) +{ + send_emitZipkinBatch(spans); +} + +void AgentConcurrentClient::send_emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) +{ + int32_t cseqid = 0; + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("emitZipkinBatch", ::apache::thrift::protocol::T_ONEWAY, cseqid); + + Agent_emitZipkinBatch_pargs args; + args.spans = &spans; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); +} + +void AgentConcurrentClient::emitBatch(const ::jaegertracing::thrift::Batch& batch) +{ + send_emitBatch(batch); +} + +void AgentConcurrentClient::send_emitBatch(const ::jaegertracing::thrift::Batch& batch) +{ + int32_t cseqid = 0; + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("emitBatch", ::apache::thrift::protocol::T_ONEWAY, cseqid); + + Agent_emitBatch_pargs args; + args.batch = &batch; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); +} + }}} // namespace diff --git a/src/jaegertracing/thrift-gen/Agent.h b/src/jaegertracing/thrift-gen/Agent.h index 2f17fb52..99e70b3b 100644 --- a/src/jaegertracing/thrift-gen/Agent.h +++ b/src/jaegertracing/thrift-gen/Agent.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define Agent_H #include +#include #include "agent_types.h" namespace jaegertracing { namespace agent { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class AgentIf { public: virtual ~AgentIf() {} @@ -31,7 +37,7 @@ class AgentIfFactory { class AgentIfSingletonFactory : virtual public AgentIfFactory { public: - AgentIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + AgentIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~AgentIfSingletonFactory() {} virtual AgentIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -40,7 +46,7 @@ class AgentIfSingletonFactory : virtual public AgentIfFactory { virtual void releaseHandler(AgentIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class AgentNull : virtual public AgentIf { @@ -62,9 +68,6 @@ typedef struct _Agent_emitZipkinBatch_args__isset { class Agent_emitZipkinBatch_args { public: - static const char* ascii_fingerprint; // = "83B240223F8FA813FDD0EA4C9255FAA4"; - static const uint8_t binary_fingerprint[16]; // = {0x83,0xB2,0x40,0x22,0x3F,0x8F,0xA8,0x13,0xFD,0xD0,0xEA,0x4C,0x92,0x55,0xFA,0xA4}; - Agent_emitZipkinBatch_args(const Agent_emitZipkinBatch_args&); Agent_emitZipkinBatch_args& operator=(const Agent_emitZipkinBatch_args&); Agent_emitZipkinBatch_args() { @@ -92,23 +95,18 @@ class Agent_emitZipkinBatch_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Agent_emitZipkinBatch_args& obj); }; class Agent_emitZipkinBatch_pargs { public: - static const char* ascii_fingerprint; // = "83B240223F8FA813FDD0EA4C9255FAA4"; - static const uint8_t binary_fingerprint[16]; // = {0x83,0xB2,0x40,0x22,0x3F,0x8F,0xA8,0x13,0xFD,0xD0,0xEA,0x4C,0x92,0x55,0xFA,0xA4}; - virtual ~Agent_emitZipkinBatch_pargs() throw(); const std::vector< ::twitter::zipkin::thrift::Span> * spans; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Agent_emitZipkinBatch_pargs& obj); }; typedef struct _Agent_emitBatch_args__isset { @@ -119,9 +117,6 @@ typedef struct _Agent_emitBatch_args__isset { class Agent_emitBatch_args { public: - static const char* ascii_fingerprint; // = "4A47EC6C4659312572A7C4824E9AADB9"; - static const uint8_t binary_fingerprint[16]; // = {0x4A,0x47,0xEC,0x6C,0x46,0x59,0x31,0x25,0x72,0xA7,0xC4,0x82,0x4E,0x9A,0xAD,0xB9}; - Agent_emitBatch_args(const Agent_emitBatch_args&); Agent_emitBatch_args& operator=(const Agent_emitBatch_args&); Agent_emitBatch_args() { @@ -149,48 +144,43 @@ class Agent_emitBatch_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Agent_emitBatch_args& obj); }; class Agent_emitBatch_pargs { public: - static const char* ascii_fingerprint; // = "4A47EC6C4659312572A7C4824E9AADB9"; - static const uint8_t binary_fingerprint[16]; // = {0x4A,0x47,0xEC,0x6C,0x46,0x59,0x31,0x25,0x72,0xA7,0xC4,0x82,0x4E,0x9A,0xAD,0xB9}; - virtual ~Agent_emitBatch_pargs() throw(); const ::jaegertracing::thrift::Batch* batch; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Agent_emitBatch_pargs& obj); }; class AgentClient : virtual public AgentIf { public: - AgentClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + AgentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - AgentClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + AgentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans); @@ -198,15 +188,15 @@ class AgentClient : virtual public AgentIf { void emitBatch(const ::jaegertracing::thrift::Batch& batch); void send_emitBatch(const ::jaegertracing::thrift::Batch& batch); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class AgentProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (AgentProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -215,7 +205,7 @@ class AgentProcessor : public ::apache::thrift::TDispatchProcessor { void process_emitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_emitBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - AgentProcessor(boost::shared_ptr iface) : + AgentProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["emitZipkinBatch"] = &AgentProcessor::process_emitZipkinBatch; processMap_["emitBatch"] = &AgentProcessor::process_emitBatch; @@ -226,24 +216,24 @@ class AgentProcessor : public ::apache::thrift::TDispatchProcessor { class AgentProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - AgentProcessorFactory(const ::boost::shared_ptr< AgentIfFactory >& handlerFactory) : + AgentProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< AgentIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< AgentIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< AgentIfFactory > handlerFactory_; }; class AgentMultiface : virtual public AgentIf { public: - AgentMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + AgentMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~AgentMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; AgentMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -267,6 +257,50 @@ class AgentMultiface : virtual public AgentIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class AgentConcurrentClient : virtual public AgentIf { + public: + AgentConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + AgentConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans); + void send_emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans); + void emitBatch(const ::jaegertracing::thrift::Batch& batch); + void send_emitBatch(const ::jaegertracing::thrift::Batch& batch); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/AggregationValidator.cpp b/src/jaegertracing/thrift-gen/AggregationValidator.cpp index 688dc10a..24af119e 100644 --- a/src/jaegertracing/thrift-gen/AggregationValidator.cpp +++ b/src/jaegertracing/thrift-gen/AggregationValidator.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ AggregationValidator_validateTrace_args::~AggregationValidator_validateTrace_arg uint32_t AggregationValidator_validateTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -58,7 +59,7 @@ uint32_t AggregationValidator_validateTrace_args::read(::apache::thrift::protoco uint32_t AggregationValidator_validateTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("AggregationValidator_validateTrace_args"); xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); @@ -67,7 +68,6 @@ uint32_t AggregationValidator_validateTrace_args::write(::apache::thrift::protoc xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -78,7 +78,7 @@ AggregationValidator_validateTrace_pargs::~AggregationValidator_validateTrace_pa uint32_t AggregationValidator_validateTrace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("AggregationValidator_validateTrace_pargs"); xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); @@ -87,7 +87,6 @@ uint32_t AggregationValidator_validateTrace_pargs::write(::apache::thrift::proto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -98,6 +97,7 @@ AggregationValidator_validateTrace_result::~AggregationValidator_validateTrace_r uint32_t AggregationValidator_validateTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -159,6 +159,7 @@ AggregationValidator_validateTrace_presult::~AggregationValidator_validateTrace_ uint32_t AggregationValidator_validateTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -328,11 +329,96 @@ void AggregationValidatorProcessor::process_validateTrace(int32_t seqid, ::apach } } -::boost::shared_ptr< ::apache::thrift::TProcessor > AggregationValidatorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > AggregationValidatorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< AggregationValidatorIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< AggregationValidatorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new AggregationValidatorProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< AggregationValidatorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new AggregationValidatorProcessor(handler)); return processor; } + +void AggregationValidatorConcurrentClient::validateTrace(ValidateTraceResponse& _return, const std::string& traceId) +{ + int32_t seqid = send_validateTrace(traceId); + recv_validateTrace(_return, seqid); +} + +int32_t AggregationValidatorConcurrentClient::send_validateTrace(const std::string& traceId) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("validateTrace", ::apache::thrift::protocol::T_CALL, cseqid); + + AggregationValidator_validateTrace_pargs args; + args.traceId = &traceId; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void AggregationValidatorConcurrentClient::recv_validateTrace(ValidateTraceResponse& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("validateTrace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + AggregationValidator_validateTrace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "validateTrace failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }} // namespace diff --git a/src/jaegertracing/thrift-gen/AggregationValidator.h b/src/jaegertracing/thrift-gen/AggregationValidator.h index c121eb40..1c430a42 100644 --- a/src/jaegertracing/thrift-gen/AggregationValidator.h +++ b/src/jaegertracing/thrift-gen/AggregationValidator.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define AggregationValidator_H #include +#include #include "aggregation_validator_types.h" namespace jaegertracing { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class AggregationValidatorIf { public: virtual ~AggregationValidatorIf() {} @@ -30,7 +36,7 @@ class AggregationValidatorIfFactory { class AggregationValidatorIfSingletonFactory : virtual public AggregationValidatorIfFactory { public: - AggregationValidatorIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + AggregationValidatorIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~AggregationValidatorIfSingletonFactory() {} virtual AggregationValidatorIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -39,7 +45,7 @@ class AggregationValidatorIfSingletonFactory : virtual public AggregationValidat virtual void releaseHandler(AggregationValidatorIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class AggregationValidatorNull : virtual public AggregationValidatorIf { @@ -54,9 +60,6 @@ class AggregationValidatorNull : virtual public AggregationValidatorIf { class AggregationValidator_validateTrace_args { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - AggregationValidator_validateTrace_args(const AggregationValidator_validateTrace_args&); AggregationValidator_validateTrace_args& operator=(const AggregationValidator_validateTrace_args&); AggregationValidator_validateTrace_args() : traceId() { @@ -82,23 +85,18 @@ class AggregationValidator_validateTrace_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const AggregationValidator_validateTrace_args& obj); }; class AggregationValidator_validateTrace_pargs { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - virtual ~AggregationValidator_validateTrace_pargs() throw(); const std::string* traceId; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const AggregationValidator_validateTrace_pargs& obj); }; typedef struct _AggregationValidator_validateTrace_result__isset { @@ -109,9 +107,6 @@ typedef struct _AggregationValidator_validateTrace_result__isset { class AggregationValidator_validateTrace_result { public: - static const char* ascii_fingerprint; // = "B9222F12B3CD97DF5433FB0E39FDBB0A"; - static const uint8_t binary_fingerprint[16]; // = {0xB9,0x22,0x2F,0x12,0xB3,0xCD,0x97,0xDF,0x54,0x33,0xFB,0x0E,0x39,0xFD,0xBB,0x0A}; - AggregationValidator_validateTrace_result(const AggregationValidator_validateTrace_result&); AggregationValidator_validateTrace_result& operator=(const AggregationValidator_validateTrace_result&); AggregationValidator_validateTrace_result() { @@ -139,7 +134,6 @@ class AggregationValidator_validateTrace_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const AggregationValidator_validateTrace_result& obj); }; typedef struct _AggregationValidator_validateTrace_presult__isset { @@ -150,9 +144,6 @@ typedef struct _AggregationValidator_validateTrace_presult__isset { class AggregationValidator_validateTrace_presult { public: - static const char* ascii_fingerprint; // = "B9222F12B3CD97DF5433FB0E39FDBB0A"; - static const uint8_t binary_fingerprint[16]; // = {0xB9,0x22,0x2F,0x12,0xB3,0xCD,0x97,0xDF,0x54,0x33,0xFB,0x0E,0x39,0xFD,0xBB,0x0A}; - virtual ~AggregationValidator_validateTrace_presult() throw(); ValidateTraceResponse* success; @@ -161,47 +152,46 @@ class AggregationValidator_validateTrace_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const AggregationValidator_validateTrace_presult& obj); }; class AggregationValidatorClient : virtual public AggregationValidatorIf { public: - AggregationValidatorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + AggregationValidatorClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - AggregationValidatorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + AggregationValidatorClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void validateTrace(ValidateTraceResponse& _return, const std::string& traceId); void send_validateTrace(const std::string& traceId); void recv_validateTrace(ValidateTraceResponse& _return); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class AggregationValidatorProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (AggregationValidatorProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -209,7 +199,7 @@ class AggregationValidatorProcessor : public ::apache::thrift::TDispatchProcesso ProcessMap processMap_; void process_validateTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - AggregationValidatorProcessor(boost::shared_ptr iface) : + AggregationValidatorProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["validateTrace"] = &AggregationValidatorProcessor::process_validateTrace; } @@ -219,24 +209,24 @@ class AggregationValidatorProcessor : public ::apache::thrift::TDispatchProcesso class AggregationValidatorProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - AggregationValidatorProcessorFactory(const ::boost::shared_ptr< AggregationValidatorIfFactory >& handlerFactory) : + AggregationValidatorProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< AggregationValidatorIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< AggregationValidatorIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< AggregationValidatorIfFactory > handlerFactory_; }; class AggregationValidatorMultiface : virtual public AggregationValidatorIf { public: - AggregationValidatorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + AggregationValidatorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~AggregationValidatorMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; AggregationValidatorMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -252,6 +242,49 @@ class AggregationValidatorMultiface : virtual public AggregationValidatorIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class AggregationValidatorConcurrentClient : virtual public AggregationValidatorIf { + public: + AggregationValidatorConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + AggregationValidatorConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void validateTrace(ValidateTraceResponse& _return, const std::string& traceId); + int32_t send_validateTrace(const std::string& traceId); + void recv_validateTrace(ValidateTraceResponse& _return, const int32_t seqid); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/BaggageRestrictionManager.cpp b/src/jaegertracing/thrift-gen/BaggageRestrictionManager.cpp index 7e5c7e38..5c0e152b 100644 --- a/src/jaegertracing/thrift-gen/BaggageRestrictionManager.cpp +++ b/src/jaegertracing/thrift-gen/BaggageRestrictionManager.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ BaggageRestrictionManager_getBaggageRestrictions_args::~BaggageRestrictionManage uint32_t BaggageRestrictionManager_getBaggageRestrictions_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -55,7 +56,7 @@ uint32_t BaggageRestrictionManager_getBaggageRestrictions_args::read(::apache::t uint32_t BaggageRestrictionManager_getBaggageRestrictions_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BaggageRestrictionManager_getBaggageRestrictions_args"); xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1); @@ -64,7 +65,6 @@ uint32_t BaggageRestrictionManager_getBaggageRestrictions_args::write(::apache:: xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -75,7 +75,7 @@ BaggageRestrictionManager_getBaggageRestrictions_pargs::~BaggageRestrictionManag uint32_t BaggageRestrictionManager_getBaggageRestrictions_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BaggageRestrictionManager_getBaggageRestrictions_pargs"); xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1); @@ -84,7 +84,6 @@ uint32_t BaggageRestrictionManager_getBaggageRestrictions_pargs::write(::apache: xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -95,6 +94,7 @@ BaggageRestrictionManager_getBaggageRestrictions_result::~BaggageRestrictionMana uint32_t BaggageRestrictionManager_getBaggageRestrictions_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -176,6 +176,7 @@ BaggageRestrictionManager_getBaggageRestrictions_presult::~BaggageRestrictionMan uint32_t BaggageRestrictionManager_getBaggageRestrictions_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -357,11 +358,96 @@ void BaggageRestrictionManagerProcessor::process_getBaggageRestrictions(int32_t } } -::boost::shared_ptr< ::apache::thrift::TProcessor > BaggageRestrictionManagerProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > BaggageRestrictionManagerProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< BaggageRestrictionManagerIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< BaggageRestrictionManagerIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new BaggageRestrictionManagerProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< BaggageRestrictionManagerIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new BaggageRestrictionManagerProcessor(handler)); return processor; } + +void BaggageRestrictionManagerConcurrentClient::getBaggageRestrictions(std::vector & _return, const std::string& serviceName) +{ + int32_t seqid = send_getBaggageRestrictions(serviceName); + recv_getBaggageRestrictions(_return, seqid); +} + +int32_t BaggageRestrictionManagerConcurrentClient::send_getBaggageRestrictions(const std::string& serviceName) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("getBaggageRestrictions", ::apache::thrift::protocol::T_CALL, cseqid); + + BaggageRestrictionManager_getBaggageRestrictions_pargs args; + args.serviceName = &serviceName; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void BaggageRestrictionManagerConcurrentClient::recv_getBaggageRestrictions(std::vector & _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("getBaggageRestrictions") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + BaggageRestrictionManager_getBaggageRestrictions_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getBaggageRestrictions failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }} // namespace diff --git a/src/jaegertracing/thrift-gen/BaggageRestrictionManager.h b/src/jaegertracing/thrift-gen/BaggageRestrictionManager.h index 375eb09d..7aee5dac 100644 --- a/src/jaegertracing/thrift-gen/BaggageRestrictionManager.h +++ b/src/jaegertracing/thrift-gen/BaggageRestrictionManager.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define BaggageRestrictionManager_H #include +#include #include "baggage_types.h" namespace jaegertracing { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class BaggageRestrictionManagerIf { public: virtual ~BaggageRestrictionManagerIf() {} @@ -38,7 +44,7 @@ class BaggageRestrictionManagerIfFactory { class BaggageRestrictionManagerIfSingletonFactory : virtual public BaggageRestrictionManagerIfFactory { public: - BaggageRestrictionManagerIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + BaggageRestrictionManagerIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~BaggageRestrictionManagerIfSingletonFactory() {} virtual BaggageRestrictionManagerIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -47,7 +53,7 @@ class BaggageRestrictionManagerIfSingletonFactory : virtual public BaggageRestri virtual void releaseHandler(BaggageRestrictionManagerIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class BaggageRestrictionManagerNull : virtual public BaggageRestrictionManagerIf { @@ -66,9 +72,6 @@ typedef struct _BaggageRestrictionManager_getBaggageRestrictions_args__isset { class BaggageRestrictionManager_getBaggageRestrictions_args { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - BaggageRestrictionManager_getBaggageRestrictions_args(const BaggageRestrictionManager_getBaggageRestrictions_args&); BaggageRestrictionManager_getBaggageRestrictions_args& operator=(const BaggageRestrictionManager_getBaggageRestrictions_args&); BaggageRestrictionManager_getBaggageRestrictions_args() : serviceName() { @@ -96,23 +99,18 @@ class BaggageRestrictionManager_getBaggageRestrictions_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const BaggageRestrictionManager_getBaggageRestrictions_args& obj); }; class BaggageRestrictionManager_getBaggageRestrictions_pargs { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - virtual ~BaggageRestrictionManager_getBaggageRestrictions_pargs() throw(); const std::string* serviceName; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const BaggageRestrictionManager_getBaggageRestrictions_pargs& obj); }; typedef struct _BaggageRestrictionManager_getBaggageRestrictions_result__isset { @@ -123,9 +121,6 @@ typedef struct _BaggageRestrictionManager_getBaggageRestrictions_result__isset { class BaggageRestrictionManager_getBaggageRestrictions_result { public: - static const char* ascii_fingerprint; // = "4C53C87891978470ACC4312D02689432"; - static const uint8_t binary_fingerprint[16]; // = {0x4C,0x53,0xC8,0x78,0x91,0x97,0x84,0x70,0xAC,0xC4,0x31,0x2D,0x02,0x68,0x94,0x32}; - BaggageRestrictionManager_getBaggageRestrictions_result(const BaggageRestrictionManager_getBaggageRestrictions_result&); BaggageRestrictionManager_getBaggageRestrictions_result& operator=(const BaggageRestrictionManager_getBaggageRestrictions_result&); BaggageRestrictionManager_getBaggageRestrictions_result() { @@ -153,7 +148,6 @@ class BaggageRestrictionManager_getBaggageRestrictions_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const BaggageRestrictionManager_getBaggageRestrictions_result& obj); }; typedef struct _BaggageRestrictionManager_getBaggageRestrictions_presult__isset { @@ -164,9 +158,6 @@ typedef struct _BaggageRestrictionManager_getBaggageRestrictions_presult__isset class BaggageRestrictionManager_getBaggageRestrictions_presult { public: - static const char* ascii_fingerprint; // = "4C53C87891978470ACC4312D02689432"; - static const uint8_t binary_fingerprint[16]; // = {0x4C,0x53,0xC8,0x78,0x91,0x97,0x84,0x70,0xAC,0xC4,0x31,0x2D,0x02,0x68,0x94,0x32}; - virtual ~BaggageRestrictionManager_getBaggageRestrictions_presult() throw(); std::vector * success; @@ -175,47 +166,46 @@ class BaggageRestrictionManager_getBaggageRestrictions_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const BaggageRestrictionManager_getBaggageRestrictions_presult& obj); }; class BaggageRestrictionManagerClient : virtual public BaggageRestrictionManagerIf { public: - BaggageRestrictionManagerClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + BaggageRestrictionManagerClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - BaggageRestrictionManagerClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + BaggageRestrictionManagerClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void getBaggageRestrictions(std::vector & _return, const std::string& serviceName); void send_getBaggageRestrictions(const std::string& serviceName); void recv_getBaggageRestrictions(std::vector & _return); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class BaggageRestrictionManagerProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (BaggageRestrictionManagerProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -223,7 +213,7 @@ class BaggageRestrictionManagerProcessor : public ::apache::thrift::TDispatchPro ProcessMap processMap_; void process_getBaggageRestrictions(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - BaggageRestrictionManagerProcessor(boost::shared_ptr iface) : + BaggageRestrictionManagerProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["getBaggageRestrictions"] = &BaggageRestrictionManagerProcessor::process_getBaggageRestrictions; } @@ -233,24 +223,24 @@ class BaggageRestrictionManagerProcessor : public ::apache::thrift::TDispatchPro class BaggageRestrictionManagerProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - BaggageRestrictionManagerProcessorFactory(const ::boost::shared_ptr< BaggageRestrictionManagerIfFactory >& handlerFactory) : + BaggageRestrictionManagerProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< BaggageRestrictionManagerIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< BaggageRestrictionManagerIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< BaggageRestrictionManagerIfFactory > handlerFactory_; }; class BaggageRestrictionManagerMultiface : virtual public BaggageRestrictionManagerIf { public: - BaggageRestrictionManagerMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + BaggageRestrictionManagerMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~BaggageRestrictionManagerMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; BaggageRestrictionManagerMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -266,6 +256,49 @@ class BaggageRestrictionManagerMultiface : virtual public BaggageRestrictionMana }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class BaggageRestrictionManagerConcurrentClient : virtual public BaggageRestrictionManagerIf { + public: + BaggageRestrictionManagerConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + BaggageRestrictionManagerConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void getBaggageRestrictions(std::vector & _return, const std::string& serviceName); + int32_t send_getBaggageRestrictions(const std::string& serviceName); + void recv_getBaggageRestrictions(std::vector & _return, const int32_t seqid); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/Collector.cpp b/src/jaegertracing/thrift-gen/Collector.cpp index 125a207b..d5b604cc 100644 --- a/src/jaegertracing/thrift-gen/Collector.cpp +++ b/src/jaegertracing/thrift-gen/Collector.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ Collector_submitBatches_args::~Collector_submitBatches_args() throw() { uint32_t Collector_submitBatches_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -67,7 +68,7 @@ uint32_t Collector_submitBatches_args::read(::apache::thrift::protocol::TProtoco uint32_t Collector_submitBatches_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Collector_submitBatches_args"); xfer += oprot->writeFieldBegin("batches", ::apache::thrift::protocol::T_LIST, 1); @@ -84,7 +85,6 @@ uint32_t Collector_submitBatches_args::write(::apache::thrift::protocol::TProtoc xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -95,7 +95,7 @@ Collector_submitBatches_pargs::~Collector_submitBatches_pargs() throw() { uint32_t Collector_submitBatches_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Collector_submitBatches_pargs"); xfer += oprot->writeFieldBegin("batches", ::apache::thrift::protocol::T_LIST, 1); @@ -112,7 +112,6 @@ uint32_t Collector_submitBatches_pargs::write(::apache::thrift::protocol::TProto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -123,6 +122,7 @@ Collector_submitBatches_result::~Collector_submitBatches_result() throw() { uint32_t Collector_submitBatches_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -204,6 +204,7 @@ Collector_submitBatches_presult::~Collector_submitBatches_presult() throw() { uint32_t Collector_submitBatches_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -385,11 +386,96 @@ void CollectorProcessor::process_submitBatches(int32_t seqid, ::apache::thrift:: } } -::boost::shared_ptr< ::apache::thrift::TProcessor > CollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > CollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< CollectorIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< CollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new CollectorProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< CollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new CollectorProcessor(handler)); return processor; } + +void CollectorConcurrentClient::submitBatches(std::vector & _return, const std::vector & batches) +{ + int32_t seqid = send_submitBatches(batches); + recv_submitBatches(_return, seqid); +} + +int32_t CollectorConcurrentClient::send_submitBatches(const std::vector & batches) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_CALL, cseqid); + + Collector_submitBatches_pargs args; + args.batches = &batches; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void CollectorConcurrentClient::recv_submitBatches(std::vector & _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("submitBatches") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + Collector_submitBatches_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitBatches failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }} // namespace diff --git a/src/jaegertracing/thrift-gen/Collector.h b/src/jaegertracing/thrift-gen/Collector.h index 7538ca96..99fe3e6b 100644 --- a/src/jaegertracing/thrift-gen/Collector.h +++ b/src/jaegertracing/thrift-gen/Collector.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define Collector_H #include +#include #include "jaeger_types.h" namespace jaegertracing { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class CollectorIf { public: virtual ~CollectorIf() {} @@ -30,7 +36,7 @@ class CollectorIfFactory { class CollectorIfSingletonFactory : virtual public CollectorIfFactory { public: - CollectorIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + CollectorIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~CollectorIfSingletonFactory() {} virtual CollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -39,7 +45,7 @@ class CollectorIfSingletonFactory : virtual public CollectorIfFactory { virtual void releaseHandler(CollectorIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class CollectorNull : virtual public CollectorIf { @@ -58,9 +64,6 @@ typedef struct _Collector_submitBatches_args__isset { class Collector_submitBatches_args { public: - static const char* ascii_fingerprint; // = "B3672015D2EC74183915D15C37A67BE0"; - static const uint8_t binary_fingerprint[16]; // = {0xB3,0x67,0x20,0x15,0xD2,0xEC,0x74,0x18,0x39,0x15,0xD1,0x5C,0x37,0xA6,0x7B,0xE0}; - Collector_submitBatches_args(const Collector_submitBatches_args&); Collector_submitBatches_args& operator=(const Collector_submitBatches_args&); Collector_submitBatches_args() { @@ -88,23 +91,18 @@ class Collector_submitBatches_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Collector_submitBatches_args& obj); }; class Collector_submitBatches_pargs { public: - static const char* ascii_fingerprint; // = "B3672015D2EC74183915D15C37A67BE0"; - static const uint8_t binary_fingerprint[16]; // = {0xB3,0x67,0x20,0x15,0xD2,0xEC,0x74,0x18,0x39,0x15,0xD1,0x5C,0x37,0xA6,0x7B,0xE0}; - virtual ~Collector_submitBatches_pargs() throw(); const std::vector * batches; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Collector_submitBatches_pargs& obj); }; typedef struct _Collector_submitBatches_result__isset { @@ -115,9 +113,6 @@ typedef struct _Collector_submitBatches_result__isset { class Collector_submitBatches_result { public: - static const char* ascii_fingerprint; // = "CBD1A3538AA40917A7704428034B61EC"; - static const uint8_t binary_fingerprint[16]; // = {0xCB,0xD1,0xA3,0x53,0x8A,0xA4,0x09,0x17,0xA7,0x70,0x44,0x28,0x03,0x4B,0x61,0xEC}; - Collector_submitBatches_result(const Collector_submitBatches_result&); Collector_submitBatches_result& operator=(const Collector_submitBatches_result&); Collector_submitBatches_result() { @@ -145,7 +140,6 @@ class Collector_submitBatches_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Collector_submitBatches_result& obj); }; typedef struct _Collector_submitBatches_presult__isset { @@ -156,9 +150,6 @@ typedef struct _Collector_submitBatches_presult__isset { class Collector_submitBatches_presult { public: - static const char* ascii_fingerprint; // = "CBD1A3538AA40917A7704428034B61EC"; - static const uint8_t binary_fingerprint[16]; // = {0xCB,0xD1,0xA3,0x53,0x8A,0xA4,0x09,0x17,0xA7,0x70,0x44,0x28,0x03,0x4B,0x61,0xEC}; - virtual ~Collector_submitBatches_presult() throw(); std::vector * success; @@ -167,47 +158,46 @@ class Collector_submitBatches_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const Collector_submitBatches_presult& obj); }; class CollectorClient : virtual public CollectorIf { public: - CollectorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + CollectorClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - CollectorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + CollectorClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void submitBatches(std::vector & _return, const std::vector & batches); void send_submitBatches(const std::vector & batches); void recv_submitBatches(std::vector & _return); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class CollectorProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (CollectorProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -215,7 +205,7 @@ class CollectorProcessor : public ::apache::thrift::TDispatchProcessor { ProcessMap processMap_; void process_submitBatches(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - CollectorProcessor(boost::shared_ptr iface) : + CollectorProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["submitBatches"] = &CollectorProcessor::process_submitBatches; } @@ -225,24 +215,24 @@ class CollectorProcessor : public ::apache::thrift::TDispatchProcessor { class CollectorProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - CollectorProcessorFactory(const ::boost::shared_ptr< CollectorIfFactory >& handlerFactory) : + CollectorProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< CollectorIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< CollectorIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< CollectorIfFactory > handlerFactory_; }; class CollectorMultiface : virtual public CollectorIf { public: - CollectorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + CollectorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~CollectorMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; CollectorMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -258,6 +248,49 @@ class CollectorMultiface : virtual public CollectorIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class CollectorConcurrentClient : virtual public CollectorIf { + public: + CollectorConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + CollectorConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void submitBatches(std::vector & _return, const std::vector & batches); + int32_t send_submitBatches(const std::vector & batches); + void recv_submitBatches(std::vector & _return, const int32_t seqid); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/Dependency.cpp b/src/jaegertracing/thrift-gen/Dependency.cpp index 268a099c..f5bbaf23 100644 --- a/src/jaegertracing/thrift-gen/Dependency.cpp +++ b/src/jaegertracing/thrift-gen/Dependency.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ Dependency_getDependenciesForTrace_args::~Dependency_getDependenciesForTrace_arg uint32_t Dependency_getDependenciesForTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -58,7 +59,7 @@ uint32_t Dependency_getDependenciesForTrace_args::read(::apache::thrift::protoco uint32_t Dependency_getDependenciesForTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Dependency_getDependenciesForTrace_args"); xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); @@ -67,7 +68,6 @@ uint32_t Dependency_getDependenciesForTrace_args::write(::apache::thrift::protoc xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -78,7 +78,7 @@ Dependency_getDependenciesForTrace_pargs::~Dependency_getDependenciesForTrace_pa uint32_t Dependency_getDependenciesForTrace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Dependency_getDependenciesForTrace_pargs"); xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); @@ -87,7 +87,6 @@ uint32_t Dependency_getDependenciesForTrace_pargs::write(::apache::thrift::proto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -98,6 +97,7 @@ Dependency_getDependenciesForTrace_result::~Dependency_getDependenciesForTrace_r uint32_t Dependency_getDependenciesForTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -159,6 +159,7 @@ Dependency_getDependenciesForTrace_presult::~Dependency_getDependenciesForTrace_ uint32_t Dependency_getDependenciesForTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -204,6 +205,7 @@ Dependency_saveDependencies_args::~Dependency_saveDependencies_args() throw() { uint32_t Dependency_saveDependencies_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -244,7 +246,7 @@ uint32_t Dependency_saveDependencies_args::read(::apache::thrift::protocol::TPro uint32_t Dependency_saveDependencies_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Dependency_saveDependencies_args"); xfer += oprot->writeFieldBegin("dependencies", ::apache::thrift::protocol::T_STRUCT, 1); @@ -253,7 +255,6 @@ uint32_t Dependency_saveDependencies_args::write(::apache::thrift::protocol::TPr xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -264,7 +265,7 @@ Dependency_saveDependencies_pargs::~Dependency_saveDependencies_pargs() throw() uint32_t Dependency_saveDependencies_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Dependency_saveDependencies_pargs"); xfer += oprot->writeFieldBegin("dependencies", ::apache::thrift::protocol::T_STRUCT, 1); @@ -273,7 +274,6 @@ uint32_t Dependency_saveDependencies_pargs::write(::apache::thrift::protocol::TP xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -464,11 +464,118 @@ void DependencyProcessor::process_saveDependencies(int32_t, ::apache::thrift::pr return; } -::boost::shared_ptr< ::apache::thrift::TProcessor > DependencyProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > DependencyProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< DependencyIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< DependencyIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new DependencyProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< DependencyIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new DependencyProcessor(handler)); return processor; } + +void DependencyConcurrentClient::getDependenciesForTrace(Dependencies& _return, const std::string& traceId) +{ + int32_t seqid = send_getDependenciesForTrace(traceId); + recv_getDependenciesForTrace(_return, seqid); +} + +int32_t DependencyConcurrentClient::send_getDependenciesForTrace(const std::string& traceId) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("getDependenciesForTrace", ::apache::thrift::protocol::T_CALL, cseqid); + + Dependency_getDependenciesForTrace_pargs args; + args.traceId = &traceId; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void DependencyConcurrentClient::recv_getDependenciesForTrace(Dependencies& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("getDependenciesForTrace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + Dependency_getDependenciesForTrace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getDependenciesForTrace failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +void DependencyConcurrentClient::saveDependencies(const Dependencies& dependencies) +{ + send_saveDependencies(dependencies); +} + +void DependencyConcurrentClient::send_saveDependencies(const Dependencies& dependencies) +{ + int32_t cseqid = 0; + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("saveDependencies", ::apache::thrift::protocol::T_ONEWAY, cseqid); + + Dependency_saveDependencies_pargs args; + args.dependencies = &dependencies; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); +} + }} // namespace diff --git a/src/jaegertracing/thrift-gen/Dependency.h b/src/jaegertracing/thrift-gen/Dependency.h index f01c0b3a..8ccee592 100644 --- a/src/jaegertracing/thrift-gen/Dependency.h +++ b/src/jaegertracing/thrift-gen/Dependency.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define Dependency_H #include +#include #include "dependency_types.h" namespace jaegertracing { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class DependencyIf { public: virtual ~DependencyIf() {} @@ -31,7 +37,7 @@ class DependencyIfFactory { class DependencyIfSingletonFactory : virtual public DependencyIfFactory { public: - DependencyIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + DependencyIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~DependencyIfSingletonFactory() {} virtual DependencyIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -40,7 +46,7 @@ class DependencyIfSingletonFactory : virtual public DependencyIfFactory { virtual void releaseHandler(DependencyIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class DependencyNull : virtual public DependencyIf { @@ -58,9 +64,6 @@ class DependencyNull : virtual public DependencyIf { class Dependency_getDependenciesForTrace_args { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - Dependency_getDependenciesForTrace_args(const Dependency_getDependenciesForTrace_args&); Dependency_getDependenciesForTrace_args& operator=(const Dependency_getDependenciesForTrace_args&); Dependency_getDependenciesForTrace_args() : traceId() { @@ -86,23 +89,18 @@ class Dependency_getDependenciesForTrace_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Dependency_getDependenciesForTrace_args& obj); }; class Dependency_getDependenciesForTrace_pargs { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - virtual ~Dependency_getDependenciesForTrace_pargs() throw(); const std::string* traceId; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Dependency_getDependenciesForTrace_pargs& obj); }; typedef struct _Dependency_getDependenciesForTrace_result__isset { @@ -113,9 +111,6 @@ typedef struct _Dependency_getDependenciesForTrace_result__isset { class Dependency_getDependenciesForTrace_result { public: - static const char* ascii_fingerprint; // = "2FD0AAACF989C5BB020BD559E1DD111E"; - static const uint8_t binary_fingerprint[16]; // = {0x2F,0xD0,0xAA,0xAC,0xF9,0x89,0xC5,0xBB,0x02,0x0B,0xD5,0x59,0xE1,0xDD,0x11,0x1E}; - Dependency_getDependenciesForTrace_result(const Dependency_getDependenciesForTrace_result&); Dependency_getDependenciesForTrace_result& operator=(const Dependency_getDependenciesForTrace_result&); Dependency_getDependenciesForTrace_result() { @@ -143,7 +138,6 @@ class Dependency_getDependenciesForTrace_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Dependency_getDependenciesForTrace_result& obj); }; typedef struct _Dependency_getDependenciesForTrace_presult__isset { @@ -154,9 +148,6 @@ typedef struct _Dependency_getDependenciesForTrace_presult__isset { class Dependency_getDependenciesForTrace_presult { public: - static const char* ascii_fingerprint; // = "2FD0AAACF989C5BB020BD559E1DD111E"; - static const uint8_t binary_fingerprint[16]; // = {0x2F,0xD0,0xAA,0xAC,0xF9,0x89,0xC5,0xBB,0x02,0x0B,0xD5,0x59,0xE1,0xDD,0x11,0x1E}; - virtual ~Dependency_getDependenciesForTrace_presult() throw(); Dependencies* success; @@ -165,7 +156,6 @@ class Dependency_getDependenciesForTrace_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const Dependency_getDependenciesForTrace_presult& obj); }; typedef struct _Dependency_saveDependencies_args__isset { @@ -176,9 +166,6 @@ typedef struct _Dependency_saveDependencies_args__isset { class Dependency_saveDependencies_args { public: - static const char* ascii_fingerprint; // = "1A1CA83CD19B491397D2DC6C82B8DFC0"; - static const uint8_t binary_fingerprint[16]; // = {0x1A,0x1C,0xA8,0x3C,0xD1,0x9B,0x49,0x13,0x97,0xD2,0xDC,0x6C,0x82,0xB8,0xDF,0xC0}; - Dependency_saveDependencies_args(const Dependency_saveDependencies_args&); Dependency_saveDependencies_args& operator=(const Dependency_saveDependencies_args&); Dependency_saveDependencies_args() { @@ -206,48 +193,43 @@ class Dependency_saveDependencies_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Dependency_saveDependencies_args& obj); }; class Dependency_saveDependencies_pargs { public: - static const char* ascii_fingerprint; // = "1A1CA83CD19B491397D2DC6C82B8DFC0"; - static const uint8_t binary_fingerprint[16]; // = {0x1A,0x1C,0xA8,0x3C,0xD1,0x9B,0x49,0x13,0x97,0xD2,0xDC,0x6C,0x82,0xB8,0xDF,0xC0}; - virtual ~Dependency_saveDependencies_pargs() throw(); const Dependencies* dependencies; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Dependency_saveDependencies_pargs& obj); }; class DependencyClient : virtual public DependencyIf { public: - DependencyClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + DependencyClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - DependencyClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + DependencyClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void getDependenciesForTrace(Dependencies& _return, const std::string& traceId); @@ -256,15 +238,15 @@ class DependencyClient : virtual public DependencyIf { void saveDependencies(const Dependencies& dependencies); void send_saveDependencies(const Dependencies& dependencies); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class DependencyProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (DependencyProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -273,7 +255,7 @@ class DependencyProcessor : public ::apache::thrift::TDispatchProcessor { void process_getDependenciesForTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_saveDependencies(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - DependencyProcessor(boost::shared_ptr iface) : + DependencyProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["getDependenciesForTrace"] = &DependencyProcessor::process_getDependenciesForTrace; processMap_["saveDependencies"] = &DependencyProcessor::process_saveDependencies; @@ -284,24 +266,24 @@ class DependencyProcessor : public ::apache::thrift::TDispatchProcessor { class DependencyProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - DependencyProcessorFactory(const ::boost::shared_ptr< DependencyIfFactory >& handlerFactory) : + DependencyProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< DependencyIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< DependencyIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< DependencyIfFactory > handlerFactory_; }; class DependencyMultiface : virtual public DependencyIf { public: - DependencyMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + DependencyMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~DependencyMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; DependencyMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -326,6 +308,51 @@ class DependencyMultiface : virtual public DependencyIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class DependencyConcurrentClient : virtual public DependencyIf { + public: + DependencyConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + DependencyConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void getDependenciesForTrace(Dependencies& _return, const std::string& traceId); + int32_t send_getDependenciesForTrace(const std::string& traceId); + void recv_getDependenciesForTrace(Dependencies& _return, const int32_t seqid); + void saveDependencies(const Dependencies& dependencies); + void send_saveDependencies(const Dependencies& dependencies); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/SamplingManager.cpp b/src/jaegertracing/thrift-gen/SamplingManager.cpp index 1f0272d9..c0a00fe3 100644 --- a/src/jaegertracing/thrift-gen/SamplingManager.cpp +++ b/src/jaegertracing/thrift-gen/SamplingManager.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ SamplingManager_getSamplingStrategy_args::~SamplingManager_getSamplingStrategy_a uint32_t SamplingManager_getSamplingStrategy_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -55,7 +56,7 @@ uint32_t SamplingManager_getSamplingStrategy_args::read(::apache::thrift::protoc uint32_t SamplingManager_getSamplingStrategy_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("SamplingManager_getSamplingStrategy_args"); xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1); @@ -64,7 +65,6 @@ uint32_t SamplingManager_getSamplingStrategy_args::write(::apache::thrift::proto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -75,7 +75,7 @@ SamplingManager_getSamplingStrategy_pargs::~SamplingManager_getSamplingStrategy_ uint32_t SamplingManager_getSamplingStrategy_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("SamplingManager_getSamplingStrategy_pargs"); xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1); @@ -84,7 +84,6 @@ uint32_t SamplingManager_getSamplingStrategy_pargs::write(::apache::thrift::prot xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -95,6 +94,7 @@ SamplingManager_getSamplingStrategy_result::~SamplingManager_getSamplingStrategy uint32_t SamplingManager_getSamplingStrategy_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -156,6 +156,7 @@ SamplingManager_getSamplingStrategy_presult::~SamplingManager_getSamplingStrateg uint32_t SamplingManager_getSamplingStrategy_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -325,11 +326,96 @@ void SamplingManagerProcessor::process_getSamplingStrategy(int32_t seqid, ::apac } } -::boost::shared_ptr< ::apache::thrift::TProcessor > SamplingManagerProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > SamplingManagerProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< SamplingManagerIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< SamplingManagerIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new SamplingManagerProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< SamplingManagerIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new SamplingManagerProcessor(handler)); return processor; } + +void SamplingManagerConcurrentClient::getSamplingStrategy(SamplingStrategyResponse& _return, const std::string& serviceName) +{ + int32_t seqid = send_getSamplingStrategy(serviceName); + recv_getSamplingStrategy(_return, seqid); +} + +int32_t SamplingManagerConcurrentClient::send_getSamplingStrategy(const std::string& serviceName) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("getSamplingStrategy", ::apache::thrift::protocol::T_CALL, cseqid); + + SamplingManager_getSamplingStrategy_pargs args; + args.serviceName = &serviceName; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void SamplingManagerConcurrentClient::recv_getSamplingStrategy(SamplingStrategyResponse& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("getSamplingStrategy") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + SamplingManager_getSamplingStrategy_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "getSamplingStrategy failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }}} // namespace diff --git a/src/jaegertracing/thrift-gen/SamplingManager.h b/src/jaegertracing/thrift-gen/SamplingManager.h index c23d5fcf..6d8649f1 100644 --- a/src/jaegertracing/thrift-gen/SamplingManager.h +++ b/src/jaegertracing/thrift-gen/SamplingManager.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define SamplingManager_H #include +#include #include "sampling_types.h" namespace jaegertracing { namespace sampling_manager { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class SamplingManagerIf { public: virtual ~SamplingManagerIf() {} @@ -30,7 +36,7 @@ class SamplingManagerIfFactory { class SamplingManagerIfSingletonFactory : virtual public SamplingManagerIfFactory { public: - SamplingManagerIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + SamplingManagerIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~SamplingManagerIfSingletonFactory() {} virtual SamplingManagerIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -39,7 +45,7 @@ class SamplingManagerIfSingletonFactory : virtual public SamplingManagerIfFactor virtual void releaseHandler(SamplingManagerIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class SamplingManagerNull : virtual public SamplingManagerIf { @@ -58,9 +64,6 @@ typedef struct _SamplingManager_getSamplingStrategy_args__isset { class SamplingManager_getSamplingStrategy_args { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - SamplingManager_getSamplingStrategy_args(const SamplingManager_getSamplingStrategy_args&); SamplingManager_getSamplingStrategy_args& operator=(const SamplingManager_getSamplingStrategy_args&); SamplingManager_getSamplingStrategy_args() : serviceName() { @@ -88,23 +91,18 @@ class SamplingManager_getSamplingStrategy_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const SamplingManager_getSamplingStrategy_args& obj); }; class SamplingManager_getSamplingStrategy_pargs { public: - static const char* ascii_fingerprint; // = "EFB929595D312AC8F305D5A794CFEDA1"; - static const uint8_t binary_fingerprint[16]; // = {0xEF,0xB9,0x29,0x59,0x5D,0x31,0x2A,0xC8,0xF3,0x05,0xD5,0xA7,0x94,0xCF,0xED,0xA1}; - virtual ~SamplingManager_getSamplingStrategy_pargs() throw(); const std::string* serviceName; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const SamplingManager_getSamplingStrategy_pargs& obj); }; typedef struct _SamplingManager_getSamplingStrategy_result__isset { @@ -115,9 +113,6 @@ typedef struct _SamplingManager_getSamplingStrategy_result__isset { class SamplingManager_getSamplingStrategy_result { public: - static const char* ascii_fingerprint; // = "8A7C908D0EFFAAD77D77B0A73655B901"; - static const uint8_t binary_fingerprint[16]; // = {0x8A,0x7C,0x90,0x8D,0x0E,0xFF,0xAA,0xD7,0x7D,0x77,0xB0,0xA7,0x36,0x55,0xB9,0x01}; - SamplingManager_getSamplingStrategy_result(const SamplingManager_getSamplingStrategy_result&); SamplingManager_getSamplingStrategy_result& operator=(const SamplingManager_getSamplingStrategy_result&); SamplingManager_getSamplingStrategy_result() { @@ -145,7 +140,6 @@ class SamplingManager_getSamplingStrategy_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const SamplingManager_getSamplingStrategy_result& obj); }; typedef struct _SamplingManager_getSamplingStrategy_presult__isset { @@ -156,9 +150,6 @@ typedef struct _SamplingManager_getSamplingStrategy_presult__isset { class SamplingManager_getSamplingStrategy_presult { public: - static const char* ascii_fingerprint; // = "8A7C908D0EFFAAD77D77B0A73655B901"; - static const uint8_t binary_fingerprint[16]; // = {0x8A,0x7C,0x90,0x8D,0x0E,0xFF,0xAA,0xD7,0x7D,0x77,0xB0,0xA7,0x36,0x55,0xB9,0x01}; - virtual ~SamplingManager_getSamplingStrategy_presult() throw(); SamplingStrategyResponse* success; @@ -167,47 +158,46 @@ class SamplingManager_getSamplingStrategy_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const SamplingManager_getSamplingStrategy_presult& obj); }; class SamplingManagerClient : virtual public SamplingManagerIf { public: - SamplingManagerClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + SamplingManagerClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - SamplingManagerClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + SamplingManagerClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void getSamplingStrategy(SamplingStrategyResponse& _return, const std::string& serviceName); void send_getSamplingStrategy(const std::string& serviceName); void recv_getSamplingStrategy(SamplingStrategyResponse& _return); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class SamplingManagerProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (SamplingManagerProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -215,7 +205,7 @@ class SamplingManagerProcessor : public ::apache::thrift::TDispatchProcessor { ProcessMap processMap_; void process_getSamplingStrategy(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - SamplingManagerProcessor(boost::shared_ptr iface) : + SamplingManagerProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["getSamplingStrategy"] = &SamplingManagerProcessor::process_getSamplingStrategy; } @@ -225,24 +215,24 @@ class SamplingManagerProcessor : public ::apache::thrift::TDispatchProcessor { class SamplingManagerProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - SamplingManagerProcessorFactory(const ::boost::shared_ptr< SamplingManagerIfFactory >& handlerFactory) : + SamplingManagerProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< SamplingManagerIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< SamplingManagerIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< SamplingManagerIfFactory > handlerFactory_; }; class SamplingManagerMultiface : virtual public SamplingManagerIf { public: - SamplingManagerMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + SamplingManagerMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~SamplingManagerMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; SamplingManagerMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -258,6 +248,49 @@ class SamplingManagerMultiface : virtual public SamplingManagerIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class SamplingManagerConcurrentClient : virtual public SamplingManagerIf { + public: + SamplingManagerConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + SamplingManagerConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void getSamplingStrategy(SamplingStrategyResponse& _return, const std::string& serviceName); + int32_t send_getSamplingStrategy(const std::string& serviceName); + void recv_getSamplingStrategy(SamplingStrategyResponse& _return, const int32_t seqid); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/TracedService.cpp b/src/jaegertracing/thrift-gen/TracedService.cpp index 10b5fd2c..21e8954f 100644 --- a/src/jaegertracing/thrift-gen/TracedService.cpp +++ b/src/jaegertracing/thrift-gen/TracedService.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ TracedService_startTrace_args::~TracedService_startTrace_args() throw() { uint32_t TracedService_startTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -55,7 +56,7 @@ uint32_t TracedService_startTrace_args::read(::apache::thrift::protocol::TProtoc uint32_t TracedService_startTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("TracedService_startTrace_args"); xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); @@ -64,7 +65,6 @@ uint32_t TracedService_startTrace_args::write(::apache::thrift::protocol::TProto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -75,7 +75,7 @@ TracedService_startTrace_pargs::~TracedService_startTrace_pargs() throw() { uint32_t TracedService_startTrace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("TracedService_startTrace_pargs"); xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); @@ -84,7 +84,6 @@ uint32_t TracedService_startTrace_pargs::write(::apache::thrift::protocol::TProt xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -95,6 +94,7 @@ TracedService_startTrace_result::~TracedService_startTrace_result() throw() { uint32_t TracedService_startTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -156,6 +156,7 @@ TracedService_startTrace_presult::~TracedService_startTrace_presult() throw() { uint32_t TracedService_startTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -201,6 +202,7 @@ TracedService_joinTrace_args::~TracedService_joinTrace_args() throw() { uint32_t TracedService_joinTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -241,7 +243,7 @@ uint32_t TracedService_joinTrace_args::read(::apache::thrift::protocol::TProtoco uint32_t TracedService_joinTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("TracedService_joinTrace_args"); xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); @@ -250,7 +252,6 @@ uint32_t TracedService_joinTrace_args::write(::apache::thrift::protocol::TProtoc xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -261,7 +262,7 @@ TracedService_joinTrace_pargs::~TracedService_joinTrace_pargs() throw() { uint32_t TracedService_joinTrace_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("TracedService_joinTrace_pargs"); xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); @@ -270,7 +271,6 @@ uint32_t TracedService_joinTrace_pargs::write(::apache::thrift::protocol::TProto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -281,6 +281,7 @@ TracedService_joinTrace_result::~TracedService_joinTrace_result() throw() { uint32_t TracedService_joinTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -342,6 +343,7 @@ TracedService_joinTrace_presult::~TracedService_joinTrace_presult() throw() { uint32_t TracedService_joinTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -623,11 +625,180 @@ void TracedServiceProcessor::process_joinTrace(int32_t seqid, ::apache::thrift:: } } -::boost::shared_ptr< ::apache::thrift::TProcessor > TracedServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > TracedServiceProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< TracedServiceIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< TracedServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new TracedServiceProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< TracedServiceIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new TracedServiceProcessor(handler)); return processor; } + +void TracedServiceConcurrentClient::startTrace(TraceResponse& _return, const StartTraceRequest& request) +{ + int32_t seqid = send_startTrace(request); + recv_startTrace(_return, seqid); +} + +int32_t TracedServiceConcurrentClient::send_startTrace(const StartTraceRequest& request) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("startTrace", ::apache::thrift::protocol::T_CALL, cseqid); + + TracedService_startTrace_pargs args; + args.request = &request; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void TracedServiceConcurrentClient::recv_startTrace(TraceResponse& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("startTrace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + TracedService_startTrace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "startTrace failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + +void TracedServiceConcurrentClient::joinTrace(TraceResponse& _return, const JoinTraceRequest& request) +{ + int32_t seqid = send_joinTrace(request); + recv_joinTrace(_return, seqid); +} + +int32_t TracedServiceConcurrentClient::send_joinTrace(const JoinTraceRequest& request) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("joinTrace", ::apache::thrift::protocol::T_CALL, cseqid); + + TracedService_joinTrace_pargs args; + args.request = &request; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void TracedServiceConcurrentClient::recv_joinTrace(TraceResponse& _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("joinTrace") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + TracedService_joinTrace_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "joinTrace failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }}} // namespace diff --git a/src/jaegertracing/thrift-gen/TracedService.h b/src/jaegertracing/thrift-gen/TracedService.h index 3d1ae6b7..83bbea88 100644 --- a/src/jaegertracing/thrift-gen/TracedService.h +++ b/src/jaegertracing/thrift-gen/TracedService.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define TracedService_H #include +#include #include "tracetest_types.h" namespace jaegertracing { namespace crossdock { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class TracedServiceIf { public: virtual ~TracedServiceIf() {} @@ -31,7 +37,7 @@ class TracedServiceIfFactory { class TracedServiceIfSingletonFactory : virtual public TracedServiceIfFactory { public: - TracedServiceIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + TracedServiceIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~TracedServiceIfSingletonFactory() {} virtual TracedServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -40,7 +46,7 @@ class TracedServiceIfSingletonFactory : virtual public TracedServiceIfFactory { virtual void releaseHandler(TracedServiceIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class TracedServiceNull : virtual public TracedServiceIf { @@ -62,9 +68,6 @@ typedef struct _TracedService_startTrace_args__isset { class TracedService_startTrace_args { public: - static const char* ascii_fingerprint; // = "75E1EFBE012B6047AC6FC549B40DF573"; - static const uint8_t binary_fingerprint[16]; // = {0x75,0xE1,0xEF,0xBE,0x01,0x2B,0x60,0x47,0xAC,0x6F,0xC5,0x49,0xB4,0x0D,0xF5,0x73}; - TracedService_startTrace_args(const TracedService_startTrace_args&); TracedService_startTrace_args& operator=(const TracedService_startTrace_args&); TracedService_startTrace_args() { @@ -92,23 +95,18 @@ class TracedService_startTrace_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const TracedService_startTrace_args& obj); }; class TracedService_startTrace_pargs { public: - static const char* ascii_fingerprint; // = "75E1EFBE012B6047AC6FC549B40DF573"; - static const uint8_t binary_fingerprint[16]; // = {0x75,0xE1,0xEF,0xBE,0x01,0x2B,0x60,0x47,0xAC,0x6F,0xC5,0x49,0xB4,0x0D,0xF5,0x73}; - virtual ~TracedService_startTrace_pargs() throw(); const StartTraceRequest* request; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const TracedService_startTrace_pargs& obj); }; typedef struct _TracedService_startTrace_result__isset { @@ -119,9 +117,6 @@ typedef struct _TracedService_startTrace_result__isset { class TracedService_startTrace_result { public: - static const char* ascii_fingerprint; // = "7822BCFD5E6B23D1ECCF9A542B99CA5F"; - static const uint8_t binary_fingerprint[16]; // = {0x78,0x22,0xBC,0xFD,0x5E,0x6B,0x23,0xD1,0xEC,0xCF,0x9A,0x54,0x2B,0x99,0xCA,0x5F}; - TracedService_startTrace_result(const TracedService_startTrace_result&); TracedService_startTrace_result& operator=(const TracedService_startTrace_result&); TracedService_startTrace_result() { @@ -149,7 +144,6 @@ class TracedService_startTrace_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const TracedService_startTrace_result& obj); }; typedef struct _TracedService_startTrace_presult__isset { @@ -160,9 +154,6 @@ typedef struct _TracedService_startTrace_presult__isset { class TracedService_startTrace_presult { public: - static const char* ascii_fingerprint; // = "7822BCFD5E6B23D1ECCF9A542B99CA5F"; - static const uint8_t binary_fingerprint[16]; // = {0x78,0x22,0xBC,0xFD,0x5E,0x6B,0x23,0xD1,0xEC,0xCF,0x9A,0x54,0x2B,0x99,0xCA,0x5F}; - virtual ~TracedService_startTrace_presult() throw(); TraceResponse* success; @@ -171,7 +162,6 @@ class TracedService_startTrace_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const TracedService_startTrace_presult& obj); }; typedef struct _TracedService_joinTrace_args__isset { @@ -182,9 +172,6 @@ typedef struct _TracedService_joinTrace_args__isset { class TracedService_joinTrace_args { public: - static const char* ascii_fingerprint; // = "C9866C489F3BFF411AD949D13837452D"; - static const uint8_t binary_fingerprint[16]; // = {0xC9,0x86,0x6C,0x48,0x9F,0x3B,0xFF,0x41,0x1A,0xD9,0x49,0xD1,0x38,0x37,0x45,0x2D}; - TracedService_joinTrace_args(const TracedService_joinTrace_args&); TracedService_joinTrace_args& operator=(const TracedService_joinTrace_args&); TracedService_joinTrace_args() { @@ -212,23 +199,18 @@ class TracedService_joinTrace_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const TracedService_joinTrace_args& obj); }; class TracedService_joinTrace_pargs { public: - static const char* ascii_fingerprint; // = "C9866C489F3BFF411AD949D13837452D"; - static const uint8_t binary_fingerprint[16]; // = {0xC9,0x86,0x6C,0x48,0x9F,0x3B,0xFF,0x41,0x1A,0xD9,0x49,0xD1,0x38,0x37,0x45,0x2D}; - virtual ~TracedService_joinTrace_pargs() throw(); const JoinTraceRequest* request; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const TracedService_joinTrace_pargs& obj); }; typedef struct _TracedService_joinTrace_result__isset { @@ -239,9 +221,6 @@ typedef struct _TracedService_joinTrace_result__isset { class TracedService_joinTrace_result { public: - static const char* ascii_fingerprint; // = "7822BCFD5E6B23D1ECCF9A542B99CA5F"; - static const uint8_t binary_fingerprint[16]; // = {0x78,0x22,0xBC,0xFD,0x5E,0x6B,0x23,0xD1,0xEC,0xCF,0x9A,0x54,0x2B,0x99,0xCA,0x5F}; - TracedService_joinTrace_result(const TracedService_joinTrace_result&); TracedService_joinTrace_result& operator=(const TracedService_joinTrace_result&); TracedService_joinTrace_result() { @@ -269,7 +248,6 @@ class TracedService_joinTrace_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const TracedService_joinTrace_result& obj); }; typedef struct _TracedService_joinTrace_presult__isset { @@ -280,9 +258,6 @@ typedef struct _TracedService_joinTrace_presult__isset { class TracedService_joinTrace_presult { public: - static const char* ascii_fingerprint; // = "7822BCFD5E6B23D1ECCF9A542B99CA5F"; - static const uint8_t binary_fingerprint[16]; // = {0x78,0x22,0xBC,0xFD,0x5E,0x6B,0x23,0xD1,0xEC,0xCF,0x9A,0x54,0x2B,0x99,0xCA,0x5F}; - virtual ~TracedService_joinTrace_presult() throw(); TraceResponse* success; @@ -291,32 +266,31 @@ class TracedService_joinTrace_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const TracedService_joinTrace_presult& obj); }; class TracedServiceClient : virtual public TracedServiceIf { public: - TracedServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + TracedServiceClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - TracedServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + TracedServiceClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void startTrace(TraceResponse& _return, const StartTraceRequest& request); @@ -326,15 +300,15 @@ class TracedServiceClient : virtual public TracedServiceIf { void send_joinTrace(const JoinTraceRequest& request); void recv_joinTrace(TraceResponse& _return); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class TracedServiceProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (TracedServiceProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -343,7 +317,7 @@ class TracedServiceProcessor : public ::apache::thrift::TDispatchProcessor { void process_startTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); void process_joinTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - TracedServiceProcessor(boost::shared_ptr iface) : + TracedServiceProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["startTrace"] = &TracedServiceProcessor::process_startTrace; processMap_["joinTrace"] = &TracedServiceProcessor::process_joinTrace; @@ -354,24 +328,24 @@ class TracedServiceProcessor : public ::apache::thrift::TDispatchProcessor { class TracedServiceProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - TracedServiceProcessorFactory(const ::boost::shared_ptr< TracedServiceIfFactory >& handlerFactory) : + TracedServiceProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< TracedServiceIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< TracedServiceIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< TracedServiceIfFactory > handlerFactory_; }; class TracedServiceMultiface : virtual public TracedServiceIf { public: - TracedServiceMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + TracedServiceMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~TracedServiceMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; TracedServiceMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -397,6 +371,52 @@ class TracedServiceMultiface : virtual public TracedServiceIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class TracedServiceConcurrentClient : virtual public TracedServiceIf { + public: + TracedServiceConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + TracedServiceConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void startTrace(TraceResponse& _return, const StartTraceRequest& request); + int32_t send_startTrace(const StartTraceRequest& request); + void recv_startTrace(TraceResponse& _return, const int32_t seqid); + void joinTrace(TraceResponse& _return, const JoinTraceRequest& request); + int32_t send_joinTrace(const JoinTraceRequest& request); + void recv_joinTrace(TraceResponse& _return, const int32_t seqid); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/ZipkinCollector.cpp b/src/jaegertracing/thrift-gen/ZipkinCollector.cpp index 6cf5d8e8..638512dc 100644 --- a/src/jaegertracing/thrift-gen/ZipkinCollector.cpp +++ b/src/jaegertracing/thrift-gen/ZipkinCollector.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -15,6 +15,7 @@ ZipkinCollector_submitZipkinBatch_args::~ZipkinCollector_submitZipkinBatch_args( uint32_t ZipkinCollector_submitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -67,7 +68,7 @@ uint32_t ZipkinCollector_submitZipkinBatch_args::read(::apache::thrift::protocol uint32_t ZipkinCollector_submitZipkinBatch_args::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("ZipkinCollector_submitZipkinBatch_args"); xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); @@ -84,7 +85,6 @@ uint32_t ZipkinCollector_submitZipkinBatch_args::write(::apache::thrift::protoco xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -95,7 +95,7 @@ ZipkinCollector_submitZipkinBatch_pargs::~ZipkinCollector_submitZipkinBatch_parg uint32_t ZipkinCollector_submitZipkinBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("ZipkinCollector_submitZipkinBatch_pargs"); xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); @@ -112,7 +112,6 @@ uint32_t ZipkinCollector_submitZipkinBatch_pargs::write(::apache::thrift::protoc xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -123,6 +122,7 @@ ZipkinCollector_submitZipkinBatch_result::~ZipkinCollector_submitZipkinBatch_res uint32_t ZipkinCollector_submitZipkinBatch_result::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -204,6 +204,7 @@ ZipkinCollector_submitZipkinBatch_presult::~ZipkinCollector_submitZipkinBatch_pr uint32_t ZipkinCollector_submitZipkinBatch_presult::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -385,11 +386,96 @@ void ZipkinCollectorProcessor::process_submitZipkinBatch(int32_t seqid, ::apache } } -::boost::shared_ptr< ::apache::thrift::TProcessor > ZipkinCollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { +::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > ZipkinCollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) { ::apache::thrift::ReleaseHandler< ZipkinCollectorIfFactory > cleanup(handlerFactory_); - ::boost::shared_ptr< ZipkinCollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); - ::boost::shared_ptr< ::apache::thrift::TProcessor > processor(new ZipkinCollectorProcessor(handler)); + ::apache::thrift::stdcxx::shared_ptr< ZipkinCollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > processor(new ZipkinCollectorProcessor(handler)); return processor; } + +void ZipkinCollectorConcurrentClient::submitZipkinBatch(std::vector & _return, const std::vector & spans) +{ + int32_t seqid = send_submitZipkinBatch(spans); + recv_submitZipkinBatch(_return, seqid); +} + +int32_t ZipkinCollectorConcurrentClient::send_submitZipkinBatch(const std::vector & spans) +{ + int32_t cseqid = this->sync_.generateSeqId(); + ::apache::thrift::async::TConcurrentSendSentry sentry(&this->sync_); + oprot_->writeMessageBegin("submitZipkinBatch", ::apache::thrift::protocol::T_CALL, cseqid); + + ZipkinCollector_submitZipkinBatch_pargs args; + args.spans = &spans; + args.write(oprot_); + + oprot_->writeMessageEnd(); + oprot_->getTransport()->writeEnd(); + oprot_->getTransport()->flush(); + + sentry.commit(); + return cseqid; +} + +void ZipkinCollectorConcurrentClient::recv_submitZipkinBatch(std::vector & _return, const int32_t seqid) +{ + + int32_t rseqid = 0; + std::string fname; + ::apache::thrift::protocol::TMessageType mtype; + + // the read mutex gets dropped and reacquired as part of waitForWork() + // The destructor of this sentry wakes up other clients + ::apache::thrift::async::TConcurrentRecvSentry sentry(&this->sync_, seqid); + + while(true) { + if(!this->sync_.getPending(fname, mtype, rseqid)) { + iprot_->readMessageBegin(fname, mtype, rseqid); + } + if(seqid == rseqid) { + if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { + ::apache::thrift::TApplicationException x; + x.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + sentry.commit(); + throw x; + } + if (mtype != ::apache::thrift::protocol::T_REPLY) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + } + if (fname.compare("submitZipkinBatch") != 0) { + iprot_->skip(::apache::thrift::protocol::T_STRUCT); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + // in a bad state, don't commit + using ::apache::thrift::protocol::TProtocolException; + throw TProtocolException(TProtocolException::INVALID_DATA); + } + ZipkinCollector_submitZipkinBatch_presult result; + result.success = &_return; + result.read(iprot_); + iprot_->readMessageEnd(); + iprot_->getTransport()->readEnd(); + + if (result.__isset.success) { + // _return pointer has now been filled + sentry.commit(); + return; + } + // in a bad state, don't commit + throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitZipkinBatch failed: unknown result"); + } + // seqid != rseqid + this->sync_.updatePending(fname, mtype, rseqid); + + // this will temporarily unlock the readMutex, and let other clients get work done + this->sync_.waitForWork(seqid); + } // end while(true) +} + }}} // namespace diff --git a/src/jaegertracing/thrift-gen/ZipkinCollector.h b/src/jaegertracing/thrift-gen/ZipkinCollector.h index cb128c63..97a42192 100644 --- a/src/jaegertracing/thrift-gen/ZipkinCollector.h +++ b/src/jaegertracing/thrift-gen/ZipkinCollector.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -8,10 +8,16 @@ #define ZipkinCollector_H #include +#include #include "zipkincore_types.h" namespace twitter { namespace zipkin { namespace thrift { +#ifdef _MSC_VER + #pragma warning( push ) + #pragma warning (disable : 4250 ) //inheriting methods via dominance +#endif + class ZipkinCollectorIf { public: virtual ~ZipkinCollectorIf() {} @@ -30,7 +36,7 @@ class ZipkinCollectorIfFactory { class ZipkinCollectorIfSingletonFactory : virtual public ZipkinCollectorIfFactory { public: - ZipkinCollectorIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} + ZipkinCollectorIfSingletonFactory(const ::apache::thrift::stdcxx::shared_ptr& iface) : iface_(iface) {} virtual ~ZipkinCollectorIfSingletonFactory() {} virtual ZipkinCollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) { @@ -39,7 +45,7 @@ class ZipkinCollectorIfSingletonFactory : virtual public ZipkinCollectorIfFactor virtual void releaseHandler(ZipkinCollectorIf* /* handler */) {} protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; }; class ZipkinCollectorNull : virtual public ZipkinCollectorIf { @@ -58,9 +64,6 @@ typedef struct _ZipkinCollector_submitZipkinBatch_args__isset { class ZipkinCollector_submitZipkinBatch_args { public: - static const char* ascii_fingerprint; // = "83B240223F8FA813FDD0EA4C9255FAA4"; - static const uint8_t binary_fingerprint[16]; // = {0x83,0xB2,0x40,0x22,0x3F,0x8F,0xA8,0x13,0xFD,0xD0,0xEA,0x4C,0x92,0x55,0xFA,0xA4}; - ZipkinCollector_submitZipkinBatch_args(const ZipkinCollector_submitZipkinBatch_args&); ZipkinCollector_submitZipkinBatch_args& operator=(const ZipkinCollector_submitZipkinBatch_args&); ZipkinCollector_submitZipkinBatch_args() { @@ -88,23 +91,18 @@ class ZipkinCollector_submitZipkinBatch_args { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const ZipkinCollector_submitZipkinBatch_args& obj); }; class ZipkinCollector_submitZipkinBatch_pargs { public: - static const char* ascii_fingerprint; // = "83B240223F8FA813FDD0EA4C9255FAA4"; - static const uint8_t binary_fingerprint[16]; // = {0x83,0xB2,0x40,0x22,0x3F,0x8F,0xA8,0x13,0xFD,0xD0,0xEA,0x4C,0x92,0x55,0xFA,0xA4}; - virtual ~ZipkinCollector_submitZipkinBatch_pargs() throw(); const std::vector * spans; uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const ZipkinCollector_submitZipkinBatch_pargs& obj); }; typedef struct _ZipkinCollector_submitZipkinBatch_result__isset { @@ -115,9 +113,6 @@ typedef struct _ZipkinCollector_submitZipkinBatch_result__isset { class ZipkinCollector_submitZipkinBatch_result { public: - static const char* ascii_fingerprint; // = "CBD1A3538AA40917A7704428034B61EC"; - static const uint8_t binary_fingerprint[16]; // = {0xCB,0xD1,0xA3,0x53,0x8A,0xA4,0x09,0x17,0xA7,0x70,0x44,0x28,0x03,0x4B,0x61,0xEC}; - ZipkinCollector_submitZipkinBatch_result(const ZipkinCollector_submitZipkinBatch_result&); ZipkinCollector_submitZipkinBatch_result& operator=(const ZipkinCollector_submitZipkinBatch_result&); ZipkinCollector_submitZipkinBatch_result() { @@ -145,7 +140,6 @@ class ZipkinCollector_submitZipkinBatch_result { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const ZipkinCollector_submitZipkinBatch_result& obj); }; typedef struct _ZipkinCollector_submitZipkinBatch_presult__isset { @@ -156,9 +150,6 @@ typedef struct _ZipkinCollector_submitZipkinBatch_presult__isset { class ZipkinCollector_submitZipkinBatch_presult { public: - static const char* ascii_fingerprint; // = "CBD1A3538AA40917A7704428034B61EC"; - static const uint8_t binary_fingerprint[16]; // = {0xCB,0xD1,0xA3,0x53,0x8A,0xA4,0x09,0x17,0xA7,0x70,0x44,0x28,0x03,0x4B,0x61,0xEC}; - virtual ~ZipkinCollector_submitZipkinBatch_presult() throw(); std::vector * success; @@ -167,47 +158,46 @@ class ZipkinCollector_submitZipkinBatch_presult { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - friend std::ostream& operator<<(std::ostream& out, const ZipkinCollector_submitZipkinBatch_presult& obj); }; class ZipkinCollectorClient : virtual public ZipkinCollectorIf { public: - ZipkinCollectorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + ZipkinCollectorClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot); } - ZipkinCollectorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + ZipkinCollectorClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { setProtocol(iprot,oprot); } private: - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { setProtocol(prot,prot); } - void setProtocol(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { piprot_=iprot; poprot_=oprot; iprot_ = iprot.get(); oprot_ = oprot.get(); } public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { return piprot_; } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { return poprot_; } void submitZipkinBatch(std::vector & _return, const std::vector & spans); void send_submitZipkinBatch(const std::vector & spans); void recv_submitZipkinBatch(std::vector & _return); protected: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; ::apache::thrift::protocol::TProtocol* iprot_; ::apache::thrift::protocol::TProtocol* oprot_; }; class ZipkinCollectorProcessor : public ::apache::thrift::TDispatchProcessor { protected: - boost::shared_ptr iface_; + ::apache::thrift::stdcxx::shared_ptr iface_; virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); private: typedef void (ZipkinCollectorProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); @@ -215,7 +205,7 @@ class ZipkinCollectorProcessor : public ::apache::thrift::TDispatchProcessor { ProcessMap processMap_; void process_submitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); public: - ZipkinCollectorProcessor(boost::shared_ptr iface) : + ZipkinCollectorProcessor(::apache::thrift::stdcxx::shared_ptr iface) : iface_(iface) { processMap_["submitZipkinBatch"] = &ZipkinCollectorProcessor::process_submitZipkinBatch; } @@ -225,24 +215,24 @@ class ZipkinCollectorProcessor : public ::apache::thrift::TDispatchProcessor { class ZipkinCollectorProcessorFactory : public ::apache::thrift::TProcessorFactory { public: - ZipkinCollectorProcessorFactory(const ::boost::shared_ptr< ZipkinCollectorIfFactory >& handlerFactory) : + ZipkinCollectorProcessorFactory(const ::apache::thrift::stdcxx::shared_ptr< ZipkinCollectorIfFactory >& handlerFactory) : handlerFactory_(handlerFactory) {} - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); + ::apache::thrift::stdcxx::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); protected: - ::boost::shared_ptr< ZipkinCollectorIfFactory > handlerFactory_; + ::apache::thrift::stdcxx::shared_ptr< ZipkinCollectorIfFactory > handlerFactory_; }; class ZipkinCollectorMultiface : virtual public ZipkinCollectorIf { public: - ZipkinCollectorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { + ZipkinCollectorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { } virtual ~ZipkinCollectorMultiface() {} protected: - std::vector > ifaces_; + std::vector > ifaces_; ZipkinCollectorMultiface() {} - void add(boost::shared_ptr iface) { + void add(::apache::thrift::stdcxx::shared_ptr iface) { ifaces_.push_back(iface); } public: @@ -258,6 +248,49 @@ class ZipkinCollectorMultiface : virtual public ZipkinCollectorIf { }; +// The 'concurrent' client is a thread safe client that correctly handles +// out of order responses. It is slower than the regular client, so should +// only be used when you need to share a connection among multiple threads +class ZipkinCollectorConcurrentClient : virtual public ZipkinCollectorIf { + public: + ZipkinCollectorConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot); + } + ZipkinCollectorConcurrentClient(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + setProtocol(iprot,oprot); + } + private: + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) { + setProtocol(prot,prot); + } + void setProtocol(apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { + piprot_=iprot; + poprot_=oprot; + iprot_ = iprot.get(); + oprot_ = oprot.get(); + } + public: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { + return piprot_; + } + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { + return poprot_; + } + void submitZipkinBatch(std::vector & _return, const std::vector & spans); + int32_t send_submitZipkinBatch(const std::vector & spans); + void recv_submitZipkinBatch(std::vector & _return, const int32_t seqid); + protected: + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_; + apache::thrift::stdcxx::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_; + ::apache::thrift::protocol::TProtocol* iprot_; + ::apache::thrift::protocol::TProtocol* oprot_; + ::apache::thrift::async::TConcurrentClientSyncInfo sync_; +}; + +#ifdef _MSC_VER + #pragma warning( pop ) +#endif + }}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/agent_constants.cpp b/src/jaegertracing/thrift-gen/agent_constants.cpp index 84010444..f6a9d94e 100644 --- a/src/jaegertracing/thrift-gen/agent_constants.cpp +++ b/src/jaegertracing/thrift-gen/agent_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/agent_constants.h b/src/jaegertracing/thrift-gen/agent_constants.h index cc1590c4..31302545 100644 --- a/src/jaegertracing/thrift-gen/agent_constants.h +++ b/src/jaegertracing/thrift-gen/agent_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/agent_types.cpp b/src/jaegertracing/thrift-gen/agent_types.cpp index 0cac7885..c06f58dc 100644 --- a/src/jaegertracing/thrift-gen/agent_types.cpp +++ b/src/jaegertracing/thrift-gen/agent_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/agent_types.h b/src/jaegertracing/thrift-gen/agent_types.h index 046f32ac..bbf93835 100644 --- a/src/jaegertracing/thrift-gen/agent_types.h +++ b/src/jaegertracing/thrift-gen/agent_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include #include "jaeger_types.h" #include "zipkincore_types.h" diff --git a/src/jaegertracing/thrift-gen/aggregation_validator_constants.cpp b/src/jaegertracing/thrift-gen/aggregation_validator_constants.cpp index ed6e4c25..727fcd22 100644 --- a/src/jaegertracing/thrift-gen/aggregation_validator_constants.cpp +++ b/src/jaegertracing/thrift-gen/aggregation_validator_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/aggregation_validator_constants.h b/src/jaegertracing/thrift-gen/aggregation_validator_constants.h index 046a80c0..45d93b64 100644 --- a/src/jaegertracing/thrift-gen/aggregation_validator_constants.h +++ b/src/jaegertracing/thrift-gen/aggregation_validator_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/aggregation_validator_types.cpp b/src/jaegertracing/thrift-gen/aggregation_validator_types.cpp index f7c0b4f3..85454e87 100644 --- a/src/jaegertracing/thrift-gen/aggregation_validator_types.cpp +++ b/src/jaegertracing/thrift-gen/aggregation_validator_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -25,12 +25,16 @@ void ValidateTraceResponse::__set_ok(const bool val) { void ValidateTraceResponse::__set_traceCount(const int64_t val) { this->traceCount = val; } +std::ostream& operator<<(std::ostream& out, const ValidateTraceResponse& obj) +{ + obj.printTo(out); + return out; +} -const char* ValidateTraceResponse::ascii_fingerprint = "92DB7C08FAF226B322B117D193F35B5F"; -const uint8_t ValidateTraceResponse::binary_fingerprint[16] = {0x92,0xDB,0x7C,0x08,0xFA,0xF2,0x26,0xB3,0x22,0xB1,0x17,0xD1,0x93,0xF3,0x5B,0x5F}; uint32_t ValidateTraceResponse::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -85,7 +89,7 @@ uint32_t ValidateTraceResponse::read(::apache::thrift::protocol::TProtocol* ipro uint32_t ValidateTraceResponse::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("ValidateTraceResponse"); xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1); @@ -98,7 +102,6 @@ uint32_t ValidateTraceResponse::write(::apache::thrift::protocol::TProtocol* opr xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -117,13 +120,12 @@ ValidateTraceResponse& ValidateTraceResponse::operator=(const ValidateTraceRespo traceCount = other1.traceCount; return *this; } -std::ostream& operator<<(std::ostream& out, const ValidateTraceResponse& obj) { - using apache::thrift::to_string; +void ValidateTraceResponse::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "ValidateTraceResponse("; - out << "ok=" << to_string(obj.ok); - out << ", " << "traceCount=" << to_string(obj.traceCount); + out << "ok=" << to_string(ok); + out << ", " << "traceCount=" << to_string(traceCount); out << ")"; - return out; } }} // namespace diff --git a/src/jaegertracing/thrift-gen/aggregation_validator_types.h b/src/jaegertracing/thrift-gen/aggregation_validator_types.h index 9f8c1d18..adaf6c37 100644 --- a/src/jaegertracing/thrift-gen/aggregation_validator_types.h +++ b/src/jaegertracing/thrift-gen/aggregation_validator_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include namespace jaegertracing { namespace thrift { @@ -22,12 +23,9 @@ namespace jaegertracing { namespace thrift { class ValidateTraceResponse; -class ValidateTraceResponse { +class ValidateTraceResponse : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "92DB7C08FAF226B322B117D193F35B5F"; - static const uint8_t binary_fingerprint[16]; // = {0x92,0xDB,0x7C,0x08,0xFA,0xF2,0x26,0xB3,0x22,0xB1,0x17,0xD1,0x93,0xF3,0x5B,0x5F}; - ValidateTraceResponse(const ValidateTraceResponse&); ValidateTraceResponse& operator=(const ValidateTraceResponse&); ValidateTraceResponse() : ok(0), traceCount(0) { @@ -58,11 +56,13 @@ class ValidateTraceResponse { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const ValidateTraceResponse& obj); + virtual void printTo(std::ostream& out) const; }; void swap(ValidateTraceResponse &a, ValidateTraceResponse &b); +std::ostream& operator<<(std::ostream& out, const ValidateTraceResponse& obj); + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/baggage_constants.cpp b/src/jaegertracing/thrift-gen/baggage_constants.cpp index 070583e7..1d5b2ffa 100644 --- a/src/jaegertracing/thrift-gen/baggage_constants.cpp +++ b/src/jaegertracing/thrift-gen/baggage_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/baggage_constants.h b/src/jaegertracing/thrift-gen/baggage_constants.h index 57db116a..98534714 100644 --- a/src/jaegertracing/thrift-gen/baggage_constants.h +++ b/src/jaegertracing/thrift-gen/baggage_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/baggage_types.cpp b/src/jaegertracing/thrift-gen/baggage_types.cpp index ba74a3be..73b8526b 100644 --- a/src/jaegertracing/thrift-gen/baggage_types.cpp +++ b/src/jaegertracing/thrift-gen/baggage_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -25,12 +25,16 @@ void BaggageRestriction::__set_baggageKey(const std::string& val) { void BaggageRestriction::__set_maxValueLength(const int32_t val) { this->maxValueLength = val; } +std::ostream& operator<<(std::ostream& out, const BaggageRestriction& obj) +{ + obj.printTo(out); + return out; +} -const char* BaggageRestriction::ascii_fingerprint = "EEBC915CE44901401D881E6091423036"; -const uint8_t BaggageRestriction::binary_fingerprint[16] = {0xEE,0xBC,0x91,0x5C,0xE4,0x49,0x01,0x40,0x1D,0x88,0x1E,0x60,0x91,0x42,0x30,0x36}; uint32_t BaggageRestriction::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -85,7 +89,7 @@ uint32_t BaggageRestriction::read(::apache::thrift::protocol::TProtocol* iprot) uint32_t BaggageRestriction::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BaggageRestriction"); xfer += oprot->writeFieldBegin("baggageKey", ::apache::thrift::protocol::T_STRING, 1); @@ -98,7 +102,6 @@ uint32_t BaggageRestriction::write(::apache::thrift::protocol::TProtocol* oprot) xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -117,13 +120,12 @@ BaggageRestriction& BaggageRestriction::operator=(const BaggageRestriction& othe maxValueLength = other1.maxValueLength; return *this; } -std::ostream& operator<<(std::ostream& out, const BaggageRestriction& obj) { - using apache::thrift::to_string; +void BaggageRestriction::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "BaggageRestriction("; - out << "baggageKey=" << to_string(obj.baggageKey); - out << ", " << "maxValueLength=" << to_string(obj.maxValueLength); + out << "baggageKey=" << to_string(baggageKey); + out << ", " << "maxValueLength=" << to_string(maxValueLength); out << ")"; - return out; } }} // namespace diff --git a/src/jaegertracing/thrift-gen/baggage_types.h b/src/jaegertracing/thrift-gen/baggage_types.h index 9190e054..27eceb63 100644 --- a/src/jaegertracing/thrift-gen/baggage_types.h +++ b/src/jaegertracing/thrift-gen/baggage_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include namespace jaegertracing { namespace thrift { @@ -22,12 +23,9 @@ namespace jaegertracing { namespace thrift { class BaggageRestriction; -class BaggageRestriction { +class BaggageRestriction : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "EEBC915CE44901401D881E6091423036"; - static const uint8_t binary_fingerprint[16]; // = {0xEE,0xBC,0x91,0x5C,0xE4,0x49,0x01,0x40,0x1D,0x88,0x1E,0x60,0x91,0x42,0x30,0x36}; - BaggageRestriction(const BaggageRestriction&); BaggageRestriction& operator=(const BaggageRestriction&); BaggageRestriction() : baggageKey(), maxValueLength(0) { @@ -58,11 +56,13 @@ class BaggageRestriction { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const BaggageRestriction& obj); + virtual void printTo(std::ostream& out) const; }; void swap(BaggageRestriction &a, BaggageRestriction &b); +std::ostream& operator<<(std::ostream& out, const BaggageRestriction& obj); + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/dependency_constants.cpp b/src/jaegertracing/thrift-gen/dependency_constants.cpp index 5427ca83..fcfb77fb 100644 --- a/src/jaegertracing/thrift-gen/dependency_constants.cpp +++ b/src/jaegertracing/thrift-gen/dependency_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/dependency_constants.h b/src/jaegertracing/thrift-gen/dependency_constants.h index 170313e7..bc7a0f7d 100644 --- a/src/jaegertracing/thrift-gen/dependency_constants.h +++ b/src/jaegertracing/thrift-gen/dependency_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/dependency_types.cpp b/src/jaegertracing/thrift-gen/dependency_types.cpp index 261a0c76..65fb208f 100644 --- a/src/jaegertracing/thrift-gen/dependency_types.cpp +++ b/src/jaegertracing/thrift-gen/dependency_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -29,12 +29,16 @@ void DependencyLink::__set_child(const std::string& val) { void DependencyLink::__set_callCount(const int64_t val) { this->callCount = val; } +std::ostream& operator<<(std::ostream& out, const DependencyLink& obj) +{ + obj.printTo(out); + return out; +} -const char* DependencyLink::ascii_fingerprint = "99D57D762942D436C0E0A065B166EE5B"; -const uint8_t DependencyLink::binary_fingerprint[16] = {0x99,0xD5,0x7D,0x76,0x29,0x42,0xD4,0x36,0xC0,0xE0,0xA0,0x65,0xB1,0x66,0xEE,0x5B}; uint32_t DependencyLink::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -100,7 +104,7 @@ uint32_t DependencyLink::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t DependencyLink::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("DependencyLink"); xfer += oprot->writeFieldBegin("parent", ::apache::thrift::protocol::T_STRING, 1); @@ -117,7 +121,6 @@ uint32_t DependencyLink::write(::apache::thrift::protocol::TProtocol* oprot) con xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -139,14 +142,13 @@ DependencyLink& DependencyLink::operator=(const DependencyLink& other1) { callCount = other1.callCount; return *this; } -std::ostream& operator<<(std::ostream& out, const DependencyLink& obj) { - using apache::thrift::to_string; +void DependencyLink::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "DependencyLink("; - out << "parent=" << to_string(obj.parent); - out << ", " << "child=" << to_string(obj.child); - out << ", " << "callCount=" << to_string(obj.callCount); + out << "parent=" << to_string(parent); + out << ", " << "child=" << to_string(child); + out << ", " << "callCount=" << to_string(callCount); out << ")"; - return out; } @@ -157,12 +159,16 @@ Dependencies::~Dependencies() throw() { void Dependencies::__set_links(const std::vector & val) { this->links = val; } +std::ostream& operator<<(std::ostream& out, const Dependencies& obj) +{ + obj.printTo(out); + return out; +} -const char* Dependencies::ascii_fingerprint = "315F85222FA0D924D55E8B20337B325C"; -const uint8_t Dependencies::binary_fingerprint[16] = {0x31,0x5F,0x85,0x22,0x2F,0xA0,0xD9,0x24,0xD5,0x5E,0x8B,0x20,0x33,0x7B,0x32,0x5C}; uint32_t Dependencies::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -218,7 +224,7 @@ uint32_t Dependencies::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Dependencies::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Dependencies"); xfer += oprot->writeFieldBegin("links", ::apache::thrift::protocol::T_LIST, 1); @@ -235,7 +241,6 @@ uint32_t Dependencies::write(::apache::thrift::protocol::TProtocol* oprot) const xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -251,12 +256,11 @@ Dependencies& Dependencies::operator=(const Dependencies& other9) { links = other9.links; return *this; } -std::ostream& operator<<(std::ostream& out, const Dependencies& obj) { - using apache::thrift::to_string; +void Dependencies::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Dependencies("; - out << "links=" << to_string(obj.links); + out << "links=" << to_string(links); out << ")"; - return out; } }} // namespace diff --git a/src/jaegertracing/thrift-gen/dependency_types.h b/src/jaegertracing/thrift-gen/dependency_types.h index 5ede12c0..607edc81 100644 --- a/src/jaegertracing/thrift-gen/dependency_types.h +++ b/src/jaegertracing/thrift-gen/dependency_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include namespace jaegertracing { namespace thrift { @@ -24,12 +25,9 @@ class DependencyLink; class Dependencies; -class DependencyLink { +class DependencyLink : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "99D57D762942D436C0E0A065B166EE5B"; - static const uint8_t binary_fingerprint[16]; // = {0x99,0xD5,0x7D,0x76,0x29,0x42,0xD4,0x36,0xC0,0xE0,0xA0,0x65,0xB1,0x66,0xEE,0x5B}; - DependencyLink(const DependencyLink&); DependencyLink& operator=(const DependencyLink&); DependencyLink() : parent(), child(), callCount(0) { @@ -65,17 +63,16 @@ class DependencyLink { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const DependencyLink& obj); + virtual void printTo(std::ostream& out) const; }; void swap(DependencyLink &a, DependencyLink &b); +std::ostream& operator<<(std::ostream& out, const DependencyLink& obj); -class Dependencies { - public: - static const char* ascii_fingerprint; // = "315F85222FA0D924D55E8B20337B325C"; - static const uint8_t binary_fingerprint[16]; // = {0x31,0x5F,0x85,0x22,0x2F,0xA0,0xD9,0x24,0xD5,0x5E,0x8B,0x20,0x33,0x7B,0x32,0x5C}; +class Dependencies : public virtual ::apache::thrift::TBase { + public: Dependencies(const Dependencies&); Dependencies& operator=(const Dependencies&); @@ -102,11 +99,13 @@ class Dependencies { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Dependencies& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Dependencies &a, Dependencies &b); +std::ostream& operator<<(std::ostream& out, const Dependencies& obj); + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/jaeger_constants.cpp b/src/jaegertracing/thrift-gen/jaeger_constants.cpp index 927bcf89..97ed9430 100644 --- a/src/jaegertracing/thrift-gen/jaeger_constants.cpp +++ b/src/jaegertracing/thrift-gen/jaeger_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/jaeger_constants.h b/src/jaegertracing/thrift-gen/jaeger_constants.h index 4f58ac1e..dc857da1 100644 --- a/src/jaegertracing/thrift-gen/jaeger_constants.h +++ b/src/jaegertracing/thrift-gen/jaeger_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/jaeger_types.cpp b/src/jaegertracing/thrift-gen/jaeger_types.cpp index e5df84c6..eaac975a 100644 --- a/src/jaegertracing/thrift-gen/jaeger_types.cpp +++ b/src/jaegertracing/thrift-gen/jaeger_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -29,6 +29,16 @@ const char* _kTagTypeNames[] = { }; const std::map _TagType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kTagTypeValues, _kTagTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +std::ostream& operator<<(std::ostream& out, const TagType::type& val) { + std::map::const_iterator it = _TagType_VALUES_TO_NAMES.find(val); + if (it != _TagType_VALUES_TO_NAMES.end()) { + out << it->second; + } else { + out << static_cast(val); + } + return out; +} + int _kSpanRefTypeValues[] = { SpanRefType::CHILD_OF, SpanRefType::FOLLOWS_FROM @@ -39,6 +49,16 @@ const char* _kSpanRefTypeNames[] = { }; const std::map _SpanRefType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kSpanRefTypeValues, _kSpanRefTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +std::ostream& operator<<(std::ostream& out, const SpanRefType::type& val) { + std::map::const_iterator it = _SpanRefType_VALUES_TO_NAMES.find(val); + if (it != _SpanRefType_VALUES_TO_NAMES.end()) { + out << it->second; + } else { + out << static_cast(val); + } + return out; +} + Tag::~Tag() throw() { } @@ -76,12 +96,16 @@ void Tag::__set_vBinary(const std::string& val) { this->vBinary = val; __isset.vBinary = true; } +std::ostream& operator<<(std::ostream& out, const Tag& obj) +{ + obj.printTo(out); + return out; +} -const char* Tag::ascii_fingerprint = "8582F6F2F042EBCA6A59AF229BC83A19"; -const uint8_t Tag::binary_fingerprint[16] = {0x85,0x82,0xF6,0xF2,0xF0,0x42,0xEB,0xCA,0x6A,0x59,0xAF,0x22,0x9B,0xC8,0x3A,0x19}; uint32_t Tag::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -178,7 +202,7 @@ uint32_t Tag::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Tag::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Tag"); xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); @@ -216,7 +240,6 @@ uint32_t Tag::write(::apache::thrift::protocol::TProtocol* oprot) const { } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -253,18 +276,17 @@ Tag& Tag::operator=(const Tag& other2) { __isset = other2.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const Tag& obj) { - using apache::thrift::to_string; +void Tag::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Tag("; - out << "key=" << to_string(obj.key); - out << ", " << "vType=" << to_string(obj.vType); - out << ", " << "vStr="; (obj.__isset.vStr ? (out << to_string(obj.vStr)) : (out << "")); - out << ", " << "vDouble="; (obj.__isset.vDouble ? (out << to_string(obj.vDouble)) : (out << "")); - out << ", " << "vBool="; (obj.__isset.vBool ? (out << to_string(obj.vBool)) : (out << "")); - out << ", " << "vLong="; (obj.__isset.vLong ? (out << to_string(obj.vLong)) : (out << "")); - out << ", " << "vBinary="; (obj.__isset.vBinary ? (out << to_string(obj.vBinary)) : (out << "")); + out << "key=" << to_string(key); + out << ", " << "vType=" << to_string(vType); + out << ", " << "vStr="; (__isset.vStr ? (out << to_string(vStr)) : (out << "")); + out << ", " << "vDouble="; (__isset.vDouble ? (out << to_string(vDouble)) : (out << "")); + out << ", " << "vBool="; (__isset.vBool ? (out << to_string(vBool)) : (out << "")); + out << ", " << "vLong="; (__isset.vLong ? (out << to_string(vLong)) : (out << "")); + out << ", " << "vBinary="; (__isset.vBinary ? (out << to_string(vBinary)) : (out << "")); out << ")"; - return out; } @@ -279,12 +301,16 @@ void Log::__set_timestamp(const int64_t val) { void Log::__set_fields(const std::vector & val) { this->fields = val; } +std::ostream& operator<<(std::ostream& out, const Log& obj) +{ + obj.printTo(out); + return out; +} -const char* Log::ascii_fingerprint = "BF15A287717C8B21038FA44470407EA2"; -const uint8_t Log::binary_fingerprint[16] = {0xBF,0x15,0xA2,0x87,0x71,0x7C,0x8B,0x21,0x03,0x8F,0xA4,0x44,0x70,0x40,0x7E,0xA2}; uint32_t Log::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -351,7 +377,7 @@ uint32_t Log::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Log::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Log"); xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 1); @@ -372,7 +398,6 @@ uint32_t Log::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -391,13 +416,12 @@ Log& Log::operator=(const Log& other10) { fields = other10.fields; return *this; } -std::ostream& operator<<(std::ostream& out, const Log& obj) { - using apache::thrift::to_string; +void Log::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Log("; - out << "timestamp=" << to_string(obj.timestamp); - out << ", " << "fields=" << to_string(obj.fields); + out << "timestamp=" << to_string(timestamp); + out << ", " << "fields=" << to_string(fields); out << ")"; - return out; } @@ -420,12 +444,16 @@ void SpanRef::__set_traceIdHigh(const int64_t val) { void SpanRef::__set_spanId(const int64_t val) { this->spanId = val; } +std::ostream& operator<<(std::ostream& out, const SpanRef& obj) +{ + obj.printTo(out); + return out; +} -const char* SpanRef::ascii_fingerprint = "0EE2406AF5BAD779BC70AC6569984DBA"; -const uint8_t SpanRef::binary_fingerprint[16] = {0x0E,0xE2,0x40,0x6A,0xF5,0xBA,0xD7,0x79,0xBC,0x70,0xAC,0x65,0x69,0x98,0x4D,0xBA}; uint32_t SpanRef::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -504,7 +532,7 @@ uint32_t SpanRef::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t SpanRef::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("SpanRef"); xfer += oprot->writeFieldBegin("refType", ::apache::thrift::protocol::T_I32, 1); @@ -525,7 +553,6 @@ uint32_t SpanRef::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -550,15 +577,14 @@ SpanRef& SpanRef::operator=(const SpanRef& other13) { spanId = other13.spanId; return *this; } -std::ostream& operator<<(std::ostream& out, const SpanRef& obj) { - using apache::thrift::to_string; +void SpanRef::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "SpanRef("; - out << "refType=" << to_string(obj.refType); - out << ", " << "traceIdLow=" << to_string(obj.traceIdLow); - out << ", " << "traceIdHigh=" << to_string(obj.traceIdHigh); - out << ", " << "spanId=" << to_string(obj.spanId); + out << "refType=" << to_string(refType); + out << ", " << "traceIdLow=" << to_string(traceIdLow); + out << ", " << "traceIdHigh=" << to_string(traceIdHigh); + out << ", " << "spanId=" << to_string(spanId); out << ")"; - return out; } @@ -612,12 +638,16 @@ void Span::__set_logs(const std::vector & val) { this->logs = val; __isset.logs = true; } +std::ostream& operator<<(std::ostream& out, const Span& obj) +{ + obj.printTo(out); + return out; +} -const char* Span::ascii_fingerprint = "AA54155ADAB6A4BBC542C4848D7A657E"; -const uint8_t Span::binary_fingerprint[16] = {0xAA,0x54,0x15,0x5A,0xDA,0xB6,0xA4,0xBB,0xC5,0x42,0xC4,0x84,0x8D,0x7A,0x65,0x7E}; uint32_t Span::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -798,7 +828,7 @@ uint32_t Span::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Span"); xfer += oprot->writeFieldBegin("traceIdLow", ::apache::thrift::protocol::T_I64, 1); @@ -874,7 +904,6 @@ uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const { } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -923,22 +952,21 @@ Span& Span::operator=(const Span& other33) { __isset = other33.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const Span& obj) { - using apache::thrift::to_string; +void Span::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Span("; - out << "traceIdLow=" << to_string(obj.traceIdLow); - out << ", " << "traceIdHigh=" << to_string(obj.traceIdHigh); - out << ", " << "spanId=" << to_string(obj.spanId); - out << ", " << "parentSpanId=" << to_string(obj.parentSpanId); - out << ", " << "operationName=" << to_string(obj.operationName); - out << ", " << "references="; (obj.__isset.references ? (out << to_string(obj.references)) : (out << "")); - out << ", " << "flags=" << to_string(obj.flags); - out << ", " << "startTime=" << to_string(obj.startTime); - out << ", " << "duration=" << to_string(obj.duration); - out << ", " << "tags="; (obj.__isset.tags ? (out << to_string(obj.tags)) : (out << "")); - out << ", " << "logs="; (obj.__isset.logs ? (out << to_string(obj.logs)) : (out << "")); + out << "traceIdLow=" << to_string(traceIdLow); + out << ", " << "traceIdHigh=" << to_string(traceIdHigh); + out << ", " << "spanId=" << to_string(spanId); + out << ", " << "parentSpanId=" << to_string(parentSpanId); + out << ", " << "operationName=" << to_string(operationName); + out << ", " << "references="; (__isset.references ? (out << to_string(references)) : (out << "")); + out << ", " << "flags=" << to_string(flags); + out << ", " << "startTime=" << to_string(startTime); + out << ", " << "duration=" << to_string(duration); + out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "")); + out << ", " << "logs="; (__isset.logs ? (out << to_string(logs)) : (out << "")); out << ")"; - return out; } @@ -954,12 +982,16 @@ void Process::__set_tags(const std::vector & val) { this->tags = val; __isset.tags = true; } +std::ostream& operator<<(std::ostream& out, const Process& obj) +{ + obj.printTo(out); + return out; +} -const char* Process::ascii_fingerprint = "4A5C2912BE6C88C79B33329AA651C11F"; -const uint8_t Process::binary_fingerprint[16] = {0x4A,0x5C,0x29,0x12,0xBE,0x6C,0x88,0xC7,0x9B,0x33,0x32,0x9A,0xA6,0x51,0xC1,0x1F}; uint32_t Process::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -1023,7 +1055,7 @@ uint32_t Process::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Process::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Process"); xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1); @@ -1045,7 +1077,6 @@ uint32_t Process::write(::apache::thrift::protocol::TProtocol* oprot) const { } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -1067,13 +1098,12 @@ Process& Process::operator=(const Process& other41) { __isset = other41.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const Process& obj) { - using apache::thrift::to_string; +void Process::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Process("; - out << "serviceName=" << to_string(obj.serviceName); - out << ", " << "tags="; (obj.__isset.tags ? (out << to_string(obj.tags)) : (out << "")); + out << "serviceName=" << to_string(serviceName); + out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "")); out << ")"; - return out; } @@ -1088,12 +1118,16 @@ void Batch::__set_process(const Process& val) { void Batch::__set_spans(const std::vector & val) { this->spans = val; } +std::ostream& operator<<(std::ostream& out, const Batch& obj) +{ + obj.printTo(out); + return out; +} -const char* Batch::ascii_fingerprint = "245FA213AA72499F4AA5301FF5A1E955"; -const uint8_t Batch::binary_fingerprint[16] = {0x24,0x5F,0xA2,0x13,0xAA,0x72,0x49,0x9F,0x4A,0xA5,0x30,0x1F,0xF5,0xA1,0xE9,0x55}; uint32_t Batch::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -1160,7 +1194,7 @@ uint32_t Batch::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Batch::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Batch"); xfer += oprot->writeFieldBegin("process", ::apache::thrift::protocol::T_STRUCT, 1); @@ -1181,7 +1215,6 @@ uint32_t Batch::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -1200,13 +1233,12 @@ Batch& Batch::operator=(const Batch& other49) { spans = other49.spans; return *this; } -std::ostream& operator<<(std::ostream& out, const Batch& obj) { - using apache::thrift::to_string; +void Batch::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Batch("; - out << "process=" << to_string(obj.process); - out << ", " << "spans=" << to_string(obj.spans); + out << "process=" << to_string(process); + out << ", " << "spans=" << to_string(spans); out << ")"; - return out; } @@ -1217,12 +1249,16 @@ BatchSubmitResponse::~BatchSubmitResponse() throw() { void BatchSubmitResponse::__set_ok(const bool val) { this->ok = val; } +std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj) +{ + obj.printTo(out); + return out; +} -const char* BatchSubmitResponse::ascii_fingerprint = "5892306F7B861249AE8E27C8ED619593"; -const uint8_t BatchSubmitResponse::binary_fingerprint[16] = {0x58,0x92,0x30,0x6F,0x7B,0x86,0x12,0x49,0xAE,0x8E,0x27,0xC8,0xED,0x61,0x95,0x93}; uint32_t BatchSubmitResponse::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -1266,7 +1302,7 @@ uint32_t BatchSubmitResponse::read(::apache::thrift::protocol::TProtocol* iprot) uint32_t BatchSubmitResponse::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BatchSubmitResponse"); xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1); @@ -1275,7 +1311,6 @@ uint32_t BatchSubmitResponse::write(::apache::thrift::protocol::TProtocol* oprot xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -1291,12 +1326,11 @@ BatchSubmitResponse& BatchSubmitResponse::operator=(const BatchSubmitResponse& o ok = other51.ok; return *this; } -std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj) { - using apache::thrift::to_string; +void BatchSubmitResponse::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "BatchSubmitResponse("; - out << "ok=" << to_string(obj.ok); + out << "ok=" << to_string(ok); out << ")"; - return out; } }} // namespace diff --git a/src/jaegertracing/thrift-gen/jaeger_types.h b/src/jaegertracing/thrift-gen/jaeger_types.h index 9861af5e..6afa2c10 100644 --- a/src/jaegertracing/thrift-gen/jaeger_types.h +++ b/src/jaegertracing/thrift-gen/jaeger_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include namespace jaegertracing { namespace thrift { @@ -31,6 +32,8 @@ struct TagType { extern const std::map _TagType_VALUES_TO_NAMES; +std::ostream& operator<<(std::ostream& out, const TagType::type& val); + struct SpanRefType { enum type { CHILD_OF = 0, @@ -40,6 +43,8 @@ struct SpanRefType { extern const std::map _SpanRefType_VALUES_TO_NAMES; +std::ostream& operator<<(std::ostream& out, const SpanRefType::type& val); + class Tag; class Log; @@ -63,12 +68,9 @@ typedef struct _Tag__isset { bool vBinary :1; } _Tag__isset; -class Tag { +class Tag : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "8582F6F2F042EBCA6A59AF229BC83A19"; - static const uint8_t binary_fingerprint[16]; // = {0x85,0x82,0xF6,0xF2,0xF0,0x42,0xEB,0xCA,0x6A,0x59,0xAF,0x22,0x9B,0xC8,0x3A,0x19}; - Tag(const Tag&); Tag& operator=(const Tag&); Tag() : key(), vType((TagType::type)0), vStr(), vDouble(0), vBool(0), vLong(0), vBinary() { @@ -136,17 +138,16 @@ class Tag { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Tag& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Tag &a, Tag &b); +std::ostream& operator<<(std::ostream& out, const Tag& obj); -class Log { - public: - static const char* ascii_fingerprint; // = "BF15A287717C8B21038FA44470407EA2"; - static const uint8_t binary_fingerprint[16]; // = {0xBF,0x15,0xA2,0x87,0x71,0x7C,0x8B,0x21,0x03,0x8F,0xA4,0x44,0x70,0x40,0x7E,0xA2}; +class Log : public virtual ::apache::thrift::TBase { + public: Log(const Log&); Log& operator=(const Log&); @@ -178,17 +179,16 @@ class Log { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Log& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Log &a, Log &b); +std::ostream& operator<<(std::ostream& out, const Log& obj); -class SpanRef { - public: - static const char* ascii_fingerprint; // = "0EE2406AF5BAD779BC70AC6569984DBA"; - static const uint8_t binary_fingerprint[16]; // = {0x0E,0xE2,0x40,0x6A,0xF5,0xBA,0xD7,0x79,0xBC,0x70,0xAC,0x65,0x69,0x98,0x4D,0xBA}; +class SpanRef : public virtual ::apache::thrift::TBase { + public: SpanRef(const SpanRef&); SpanRef& operator=(const SpanRef&); @@ -230,11 +230,13 @@ class SpanRef { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const SpanRef& obj); + virtual void printTo(std::ostream& out) const; }; void swap(SpanRef &a, SpanRef &b); +std::ostream& operator<<(std::ostream& out, const SpanRef& obj); + typedef struct _Span__isset { _Span__isset() : references(false), tags(false), logs(false) {} bool references :1; @@ -242,12 +244,9 @@ typedef struct _Span__isset { bool logs :1; } _Span__isset; -class Span { +class Span : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "AA54155ADAB6A4BBC542C4848D7A657E"; - static const uint8_t binary_fingerprint[16]; // = {0xAA,0x54,0x15,0x5A,0xDA,0xB6,0xA4,0xBB,0xC5,0x42,0xC4,0x84,0x8D,0x7A,0x65,0x7E}; - Span(const Span&); Span& operator=(const Span&); Span() : traceIdLow(0), traceIdHigh(0), spanId(0), parentSpanId(0), operationName(), flags(0), startTime(0), duration(0) { @@ -331,22 +330,21 @@ class Span { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Span& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Span &a, Span &b); +std::ostream& operator<<(std::ostream& out, const Span& obj); + typedef struct _Process__isset { _Process__isset() : tags(false) {} bool tags :1; } _Process__isset; -class Process { +class Process : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "4A5C2912BE6C88C79B33329AA651C11F"; - static const uint8_t binary_fingerprint[16]; // = {0x4A,0x5C,0x29,0x12,0xBE,0x6C,0x88,0xC7,0x9B,0x33,0x32,0x9A,0xA6,0x51,0xC1,0x1F}; - Process(const Process&); Process& operator=(const Process&); Process() : serviceName() { @@ -381,17 +379,16 @@ class Process { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Process& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Process &a, Process &b); +std::ostream& operator<<(std::ostream& out, const Process& obj); -class Batch { - public: - static const char* ascii_fingerprint; // = "245FA213AA72499F4AA5301FF5A1E955"; - static const uint8_t binary_fingerprint[16]; // = {0x24,0x5F,0xA2,0x13,0xAA,0x72,0x49,0x9F,0x4A,0xA5,0x30,0x1F,0xF5,0xA1,0xE9,0x55}; +class Batch : public virtual ::apache::thrift::TBase { + public: Batch(const Batch&); Batch& operator=(const Batch&); @@ -423,17 +420,16 @@ class Batch { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Batch& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Batch &a, Batch &b); +std::ostream& operator<<(std::ostream& out, const Batch& obj); -class BatchSubmitResponse { - public: - static const char* ascii_fingerprint; // = "5892306F7B861249AE8E27C8ED619593"; - static const uint8_t binary_fingerprint[16]; // = {0x58,0x92,0x30,0x6F,0x7B,0x86,0x12,0x49,0xAE,0x8E,0x27,0xC8,0xED,0x61,0x95,0x93}; +class BatchSubmitResponse : public virtual ::apache::thrift::TBase { + public: BatchSubmitResponse(const BatchSubmitResponse&); BatchSubmitResponse& operator=(const BatchSubmitResponse&); @@ -460,11 +456,13 @@ class BatchSubmitResponse { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj); + virtual void printTo(std::ostream& out) const; }; void swap(BatchSubmitResponse &a, BatchSubmitResponse &b); +std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj); + }} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/sampling_constants.cpp b/src/jaegertracing/thrift-gen/sampling_constants.cpp index e17b460d..02ea4941 100644 --- a/src/jaegertracing/thrift-gen/sampling_constants.cpp +++ b/src/jaegertracing/thrift-gen/sampling_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/sampling_constants.h b/src/jaegertracing/thrift-gen/sampling_constants.h index 4bb43138..94637e03 100644 --- a/src/jaegertracing/thrift-gen/sampling_constants.h +++ b/src/jaegertracing/thrift-gen/sampling_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/sampling_types.cpp b/src/jaegertracing/thrift-gen/sampling_types.cpp index 35f16a75..afde445b 100644 --- a/src/jaegertracing/thrift-gen/sampling_types.cpp +++ b/src/jaegertracing/thrift-gen/sampling_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -23,6 +23,16 @@ const char* _kSamplingStrategyTypeNames[] = { }; const std::map _SamplingStrategyType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kSamplingStrategyTypeValues, _kSamplingStrategyTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +std::ostream& operator<<(std::ostream& out, const SamplingStrategyType::type& val) { + std::map::const_iterator it = _SamplingStrategyType_VALUES_TO_NAMES.find(val); + if (it != _SamplingStrategyType_VALUES_TO_NAMES.end()) { + out << it->second; + } else { + out << static_cast(val); + } + return out; +} + ProbabilisticSamplingStrategy::~ProbabilisticSamplingStrategy() throw() { } @@ -31,12 +41,16 @@ ProbabilisticSamplingStrategy::~ProbabilisticSamplingStrategy() throw() { void ProbabilisticSamplingStrategy::__set_samplingRate(const double val) { this->samplingRate = val; } +std::ostream& operator<<(std::ostream& out, const ProbabilisticSamplingStrategy& obj) +{ + obj.printTo(out); + return out; +} -const char* ProbabilisticSamplingStrategy::ascii_fingerprint = "66FFB53A2471384C03D9F21F6FACA58F"; -const uint8_t ProbabilisticSamplingStrategy::binary_fingerprint[16] = {0x66,0xFF,0xB5,0x3A,0x24,0x71,0x38,0x4C,0x03,0xD9,0xF2,0x1F,0x6F,0xAC,0xA5,0x8F}; uint32_t ProbabilisticSamplingStrategy::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -80,7 +94,7 @@ uint32_t ProbabilisticSamplingStrategy::read(::apache::thrift::protocol::TProtoc uint32_t ProbabilisticSamplingStrategy::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("ProbabilisticSamplingStrategy"); xfer += oprot->writeFieldBegin("samplingRate", ::apache::thrift::protocol::T_DOUBLE, 1); @@ -89,7 +103,6 @@ uint32_t ProbabilisticSamplingStrategy::write(::apache::thrift::protocol::TProto xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -105,12 +118,11 @@ ProbabilisticSamplingStrategy& ProbabilisticSamplingStrategy::operator=(const Pr samplingRate = other1.samplingRate; return *this; } -std::ostream& operator<<(std::ostream& out, const ProbabilisticSamplingStrategy& obj) { - using apache::thrift::to_string; +void ProbabilisticSamplingStrategy::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "ProbabilisticSamplingStrategy("; - out << "samplingRate=" << to_string(obj.samplingRate); + out << "samplingRate=" << to_string(samplingRate); out << ")"; - return out; } @@ -121,12 +133,16 @@ RateLimitingSamplingStrategy::~RateLimitingSamplingStrategy() throw() { void RateLimitingSamplingStrategy::__set_maxTracesPerSecond(const int16_t val) { this->maxTracesPerSecond = val; } +std::ostream& operator<<(std::ostream& out, const RateLimitingSamplingStrategy& obj) +{ + obj.printTo(out); + return out; +} -const char* RateLimitingSamplingStrategy::ascii_fingerprint = "565787C31CF2D774B532CB755189BF39"; -const uint8_t RateLimitingSamplingStrategy::binary_fingerprint[16] = {0x56,0x57,0x87,0xC3,0x1C,0xF2,0xD7,0x74,0xB5,0x32,0xCB,0x75,0x51,0x89,0xBF,0x39}; uint32_t RateLimitingSamplingStrategy::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -170,7 +186,7 @@ uint32_t RateLimitingSamplingStrategy::read(::apache::thrift::protocol::TProtoco uint32_t RateLimitingSamplingStrategy::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("RateLimitingSamplingStrategy"); xfer += oprot->writeFieldBegin("maxTracesPerSecond", ::apache::thrift::protocol::T_I16, 1); @@ -179,7 +195,6 @@ uint32_t RateLimitingSamplingStrategy::write(::apache::thrift::protocol::TProtoc xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -195,12 +210,11 @@ RateLimitingSamplingStrategy& RateLimitingSamplingStrategy::operator=(const Rate maxTracesPerSecond = other3.maxTracesPerSecond; return *this; } -std::ostream& operator<<(std::ostream& out, const RateLimitingSamplingStrategy& obj) { - using apache::thrift::to_string; +void RateLimitingSamplingStrategy::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "RateLimitingSamplingStrategy("; - out << "maxTracesPerSecond=" << to_string(obj.maxTracesPerSecond); + out << "maxTracesPerSecond=" << to_string(maxTracesPerSecond); out << ")"; - return out; } @@ -215,12 +229,16 @@ void OperationSamplingStrategy::__set_operation(const std::string& val) { void OperationSamplingStrategy::__set_probabilisticSampling(const ProbabilisticSamplingStrategy& val) { this->probabilisticSampling = val; } +std::ostream& operator<<(std::ostream& out, const OperationSamplingStrategy& obj) +{ + obj.printTo(out); + return out; +} -const char* OperationSamplingStrategy::ascii_fingerprint = "70EB2FAA425B0221EA90513B35A43D26"; -const uint8_t OperationSamplingStrategy::binary_fingerprint[16] = {0x70,0xEB,0x2F,0xAA,0x42,0x5B,0x02,0x21,0xEA,0x90,0x51,0x3B,0x35,0xA4,0x3D,0x26}; uint32_t OperationSamplingStrategy::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -275,7 +293,7 @@ uint32_t OperationSamplingStrategy::read(::apache::thrift::protocol::TProtocol* uint32_t OperationSamplingStrategy::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("OperationSamplingStrategy"); xfer += oprot->writeFieldBegin("operation", ::apache::thrift::protocol::T_STRING, 1); @@ -288,7 +306,6 @@ uint32_t OperationSamplingStrategy::write(::apache::thrift::protocol::TProtocol* xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -307,13 +324,12 @@ OperationSamplingStrategy& OperationSamplingStrategy::operator=(const OperationS probabilisticSampling = other5.probabilisticSampling; return *this; } -std::ostream& operator<<(std::ostream& out, const OperationSamplingStrategy& obj) { - using apache::thrift::to_string; +void OperationSamplingStrategy::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "OperationSamplingStrategy("; - out << "operation=" << to_string(obj.operation); - out << ", " << "probabilisticSampling=" << to_string(obj.probabilisticSampling); + out << "operation=" << to_string(operation); + out << ", " << "probabilisticSampling=" << to_string(probabilisticSampling); out << ")"; - return out; } @@ -337,12 +353,16 @@ void PerOperationSamplingStrategies::__set_defaultUpperBoundTracesPerSecond(cons this->defaultUpperBoundTracesPerSecond = val; __isset.defaultUpperBoundTracesPerSecond = true; } +std::ostream& operator<<(std::ostream& out, const PerOperationSamplingStrategies& obj) +{ + obj.printTo(out); + return out; +} -const char* PerOperationSamplingStrategies::ascii_fingerprint = "886A56A82DE9A0B1E1EDA82291918978"; -const uint8_t PerOperationSamplingStrategies::binary_fingerprint[16] = {0x88,0x6A,0x56,0xA8,0x2D,0xE9,0xA0,0xB1,0xE1,0xED,0xA8,0x22,0x91,0x91,0x89,0x78}; uint32_t PerOperationSamplingStrategies::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -428,7 +448,7 @@ uint32_t PerOperationSamplingStrategies::read(::apache::thrift::protocol::TProto uint32_t PerOperationSamplingStrategies::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("PerOperationSamplingStrategies"); xfer += oprot->writeFieldBegin("defaultSamplingProbability", ::apache::thrift::protocol::T_DOUBLE, 1); @@ -458,7 +478,6 @@ uint32_t PerOperationSamplingStrategies::write(::apache::thrift::protocol::TProt } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -486,15 +505,14 @@ PerOperationSamplingStrategies& PerOperationSamplingStrategies::operator=(const __isset = other13.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const PerOperationSamplingStrategies& obj) { - using apache::thrift::to_string; +void PerOperationSamplingStrategies::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "PerOperationSamplingStrategies("; - out << "defaultSamplingProbability=" << to_string(obj.defaultSamplingProbability); - out << ", " << "defaultLowerBoundTracesPerSecond=" << to_string(obj.defaultLowerBoundTracesPerSecond); - out << ", " << "perOperationStrategies=" << to_string(obj.perOperationStrategies); - out << ", " << "defaultUpperBoundTracesPerSecond="; (obj.__isset.defaultUpperBoundTracesPerSecond ? (out << to_string(obj.defaultUpperBoundTracesPerSecond)) : (out << "")); + out << "defaultSamplingProbability=" << to_string(defaultSamplingProbability); + out << ", " << "defaultLowerBoundTracesPerSecond=" << to_string(defaultLowerBoundTracesPerSecond); + out << ", " << "perOperationStrategies=" << to_string(perOperationStrategies); + out << ", " << "defaultUpperBoundTracesPerSecond="; (__isset.defaultUpperBoundTracesPerSecond ? (out << to_string(defaultUpperBoundTracesPerSecond)) : (out << "")); out << ")"; - return out; } @@ -520,12 +538,16 @@ void SamplingStrategyResponse::__set_operationSampling(const PerOperationSamplin this->operationSampling = val; __isset.operationSampling = true; } +std::ostream& operator<<(std::ostream& out, const SamplingStrategyResponse& obj) +{ + obj.printTo(out); + return out; +} -const char* SamplingStrategyResponse::ascii_fingerprint = "D7657EDA3B19BAB27401BDBDD4E1103A"; -const uint8_t SamplingStrategyResponse::binary_fingerprint[16] = {0xD7,0x65,0x7E,0xDA,0x3B,0x19,0xBA,0xB2,0x74,0x01,0xBD,0xBD,0xD4,0xE1,0x10,0x3A}; uint32_t SamplingStrategyResponse::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -595,7 +617,7 @@ uint32_t SamplingStrategyResponse::read(::apache::thrift::protocol::TProtocol* i uint32_t SamplingStrategyResponse::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("SamplingStrategyResponse"); xfer += oprot->writeFieldBegin("strategyType", ::apache::thrift::protocol::T_I32, 1); @@ -619,7 +641,6 @@ uint32_t SamplingStrategyResponse::write(::apache::thrift::protocol::TProtocol* } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -647,15 +668,14 @@ SamplingStrategyResponse& SamplingStrategyResponse::operator=(const SamplingStra __isset = other16.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const SamplingStrategyResponse& obj) { - using apache::thrift::to_string; +void SamplingStrategyResponse::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "SamplingStrategyResponse("; - out << "strategyType=" << to_string(obj.strategyType); - out << ", " << "probabilisticSampling="; (obj.__isset.probabilisticSampling ? (out << to_string(obj.probabilisticSampling)) : (out << "")); - out << ", " << "rateLimitingSampling="; (obj.__isset.rateLimitingSampling ? (out << to_string(obj.rateLimitingSampling)) : (out << "")); - out << ", " << "operationSampling="; (obj.__isset.operationSampling ? (out << to_string(obj.operationSampling)) : (out << "")); + out << "strategyType=" << to_string(strategyType); + out << ", " << "probabilisticSampling="; (__isset.probabilisticSampling ? (out << to_string(probabilisticSampling)) : (out << "")); + out << ", " << "rateLimitingSampling="; (__isset.rateLimitingSampling ? (out << to_string(rateLimitingSampling)) : (out << "")); + out << ", " << "operationSampling="; (__isset.operationSampling ? (out << to_string(operationSampling)) : (out << "")); out << ")"; - return out; } }}} // namespace diff --git a/src/jaegertracing/thrift-gen/sampling_types.h b/src/jaegertracing/thrift-gen/sampling_types.h index aa6f2f7b..9e3de6b6 100644 --- a/src/jaegertracing/thrift-gen/sampling_types.h +++ b/src/jaegertracing/thrift-gen/sampling_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include namespace jaegertracing { namespace sampling_manager { namespace thrift { @@ -28,6 +29,8 @@ struct SamplingStrategyType { extern const std::map _SamplingStrategyType_VALUES_TO_NAMES; +std::ostream& operator<<(std::ostream& out, const SamplingStrategyType::type& val); + class ProbabilisticSamplingStrategy; class RateLimitingSamplingStrategy; @@ -39,12 +42,9 @@ class PerOperationSamplingStrategies; class SamplingStrategyResponse; -class ProbabilisticSamplingStrategy { +class ProbabilisticSamplingStrategy : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "66FFB53A2471384C03D9F21F6FACA58F"; - static const uint8_t binary_fingerprint[16]; // = {0x66,0xFF,0xB5,0x3A,0x24,0x71,0x38,0x4C,0x03,0xD9,0xF2,0x1F,0x6F,0xAC,0xA5,0x8F}; - ProbabilisticSamplingStrategy(const ProbabilisticSamplingStrategy&); ProbabilisticSamplingStrategy& operator=(const ProbabilisticSamplingStrategy&); ProbabilisticSamplingStrategy() : samplingRate(0) { @@ -70,17 +70,16 @@ class ProbabilisticSamplingStrategy { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const ProbabilisticSamplingStrategy& obj); + virtual void printTo(std::ostream& out) const; }; void swap(ProbabilisticSamplingStrategy &a, ProbabilisticSamplingStrategy &b); +std::ostream& operator<<(std::ostream& out, const ProbabilisticSamplingStrategy& obj); -class RateLimitingSamplingStrategy { - public: - static const char* ascii_fingerprint; // = "565787C31CF2D774B532CB755189BF39"; - static const uint8_t binary_fingerprint[16]; // = {0x56,0x57,0x87,0xC3,0x1C,0xF2,0xD7,0x74,0xB5,0x32,0xCB,0x75,0x51,0x89,0xBF,0x39}; +class RateLimitingSamplingStrategy : public virtual ::apache::thrift::TBase { + public: RateLimitingSamplingStrategy(const RateLimitingSamplingStrategy&); RateLimitingSamplingStrategy& operator=(const RateLimitingSamplingStrategy&); @@ -107,17 +106,16 @@ class RateLimitingSamplingStrategy { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const RateLimitingSamplingStrategy& obj); + virtual void printTo(std::ostream& out) const; }; void swap(RateLimitingSamplingStrategy &a, RateLimitingSamplingStrategy &b); +std::ostream& operator<<(std::ostream& out, const RateLimitingSamplingStrategy& obj); -class OperationSamplingStrategy { - public: - static const char* ascii_fingerprint; // = "70EB2FAA425B0221EA90513B35A43D26"; - static const uint8_t binary_fingerprint[16]; // = {0x70,0xEB,0x2F,0xAA,0x42,0x5B,0x02,0x21,0xEA,0x90,0x51,0x3B,0x35,0xA4,0x3D,0x26}; +class OperationSamplingStrategy : public virtual ::apache::thrift::TBase { + public: OperationSamplingStrategy(const OperationSamplingStrategy&); OperationSamplingStrategy& operator=(const OperationSamplingStrategy&); @@ -149,22 +147,21 @@ class OperationSamplingStrategy { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const OperationSamplingStrategy& obj); + virtual void printTo(std::ostream& out) const; }; void swap(OperationSamplingStrategy &a, OperationSamplingStrategy &b); +std::ostream& operator<<(std::ostream& out, const OperationSamplingStrategy& obj); + typedef struct _PerOperationSamplingStrategies__isset { _PerOperationSamplingStrategies__isset() : defaultUpperBoundTracesPerSecond(false) {} bool defaultUpperBoundTracesPerSecond :1; } _PerOperationSamplingStrategies__isset; -class PerOperationSamplingStrategies { +class PerOperationSamplingStrategies : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "886A56A82DE9A0B1E1EDA82291918978"; - static const uint8_t binary_fingerprint[16]; // = {0x88,0x6A,0x56,0xA8,0x2D,0xE9,0xA0,0xB1,0xE1,0xED,0xA8,0x22,0x91,0x91,0x89,0x78}; - PerOperationSamplingStrategies(const PerOperationSamplingStrategies&); PerOperationSamplingStrategies& operator=(const PerOperationSamplingStrategies&); PerOperationSamplingStrategies() : defaultSamplingProbability(0), defaultLowerBoundTracesPerSecond(0), defaultUpperBoundTracesPerSecond(0) { @@ -209,11 +206,13 @@ class PerOperationSamplingStrategies { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const PerOperationSamplingStrategies& obj); + virtual void printTo(std::ostream& out) const; }; void swap(PerOperationSamplingStrategies &a, PerOperationSamplingStrategies &b); +std::ostream& operator<<(std::ostream& out, const PerOperationSamplingStrategies& obj); + typedef struct _SamplingStrategyResponse__isset { _SamplingStrategyResponse__isset() : probabilisticSampling(false), rateLimitingSampling(false), operationSampling(false) {} bool probabilisticSampling :1; @@ -221,12 +220,9 @@ typedef struct _SamplingStrategyResponse__isset { bool operationSampling :1; } _SamplingStrategyResponse__isset; -class SamplingStrategyResponse { +class SamplingStrategyResponse : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "D7657EDA3B19BAB27401BDBDD4E1103A"; - static const uint8_t binary_fingerprint[16]; // = {0xD7,0x65,0x7E,0xDA,0x3B,0x19,0xBA,0xB2,0x74,0x01,0xBD,0xBD,0xD4,0xE1,0x10,0x3A}; - SamplingStrategyResponse(const SamplingStrategyResponse&); SamplingStrategyResponse& operator=(const SamplingStrategyResponse&); SamplingStrategyResponse() : strategyType((SamplingStrategyType::type)0) { @@ -275,11 +271,13 @@ class SamplingStrategyResponse { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const SamplingStrategyResponse& obj); + virtual void printTo(std::ostream& out) const; }; void swap(SamplingStrategyResponse &a, SamplingStrategyResponse &b); +std::ostream& operator<<(std::ostream& out, const SamplingStrategyResponse& obj); + }}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/tracetest_constants.cpp b/src/jaegertracing/thrift-gen/tracetest_constants.cpp index 1a3d418e..8738dd2c 100644 --- a/src/jaegertracing/thrift-gen/tracetest_constants.cpp +++ b/src/jaegertracing/thrift-gen/tracetest_constants.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/tracetest_constants.h b/src/jaegertracing/thrift-gen/tracetest_constants.h index ddac828a..96bf2904 100644 --- a/src/jaegertracing/thrift-gen/tracetest_constants.h +++ b/src/jaegertracing/thrift-gen/tracetest_constants.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated diff --git a/src/jaegertracing/thrift-gen/tracetest_types.cpp b/src/jaegertracing/thrift-gen/tracetest_types.cpp index ff43968e..ceb7a204 100644 --- a/src/jaegertracing/thrift-gen/tracetest_types.cpp +++ b/src/jaegertracing/thrift-gen/tracetest_types.cpp @@ -1,9 +1,8 @@ /** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * - * WARNING WARNING WARNING - * This file has been hand-patched. See - * https://github.com/jaegertracing/jaeger-client-cpp/issues/45. + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ #include "tracetest_types.h" @@ -12,854 +11,794 @@ #include -namespace jaegertracing { -namespace crossdock { -namespace thrift { +namespace jaegertracing { namespace crossdock { namespace thrift { -int _kTransportValues[] = { Transport::HTTP, - Transport::TCHANNEL, - Transport::DUMMY }; -const char* _kTransportNames[] = { "HTTP", "TCHANNEL", "DUMMY" }; -const std::map _Transport_VALUES_TO_NAMES( - ::apache::thrift::TEnumIterator(3, _kTransportValues, _kTransportNames), - ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +int _kTransportValues[] = { + Transport::HTTP, + Transport::TCHANNEL, + Transport::DUMMY +}; +const char* _kTransportNames[] = { + "HTTP", + "TCHANNEL", + "DUMMY" +}; +const std::map _Transport_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(3, _kTransportValues, _kTransportNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); -Downstream::~Downstream() throw() {} +std::ostream& operator<<(std::ostream& out, const Transport::type& val) { + std::map::const_iterator it = _Transport_VALUES_TO_NAMES.find(val); + if (it != _Transport_VALUES_TO_NAMES.end()) { + out << it->second; + } else { + out << static_cast(val); + } + return out; +} -void Downstream::__set_serviceName(const std::string& val) -{ - this->serviceName = val; + +Downstream::~Downstream() throw() { } -void Downstream::__set_serverRole(const std::string& val) -{ - this->serverRole = val; + +void Downstream::__set_serviceName(const std::string& val) { + this->serviceName = val; } -void Downstream::__set_host(const std::string& val) { this->host = val; } +void Downstream::__set_serverRole(const std::string& val) { + this->serverRole = val; +} -void Downstream::__set_port(const std::string& val) { this->port = val; } +void Downstream::__set_host(const std::string& val) { + this->host = val; +} -void Downstream::__set_transport(const Transport::type val) -{ - this->transport = val; +void Downstream::__set_port(const std::string& val) { + this->port = val; +} + +void Downstream::__set_transport(const Transport::type val) { + this->transport = val; } -void Downstream::__set_downstream(const Downstream& val) +void Downstream::__set_downstream(const std::shared_ptr& val) { + this->downstream = val; +__isset.downstream = true; +} +std::ostream& operator<<(std::ostream& out, const Downstream& obj) { - this->downstream = boost::shared_ptr(new Downstream(val)); + obj.printTo(out); + return out; } -const char* Downstream::ascii_fingerprint = "864D68E1D3FB0C71C1E979F437051051"; -const uint8_t Downstream::binary_fingerprint[16] = { 0x86, 0x4D, 0x68, 0xE1, - 0xD3, 0xFB, 0x0C, 0x71, - 0xC1, 0xE9, 0x79, 0xF4, - 0x37, 0x05, 0x10, 0x51 }; -uint32_t Downstream::read(::apache::thrift::protocol::TProtocol* iprot) -{ +uint32_t Downstream::read(::apache::thrift::protocol::TProtocol* iprot) { - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - xfer += iprot->readStructBegin(fname); + xfer += iprot->readStructBegin(fname); - using ::apache::thrift::protocol::TProtocolException; + using ::apache::thrift::protocol::TProtocolException; - bool isset_serviceName = false; - bool isset_serverRole = false; - bool isset_host = false; - bool isset_port = false; - bool isset_transport = false; + bool isset_serviceName = false; + bool isset_serverRole = false; + bool isset_host = false; + bool isset_port = false; + bool isset_transport = false; - while (true) { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->serviceName); + isset_serviceName = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->serverRole); + isset_serverRole = true; + } else { + xfer += iprot->skip(ftype); } - switch (fid) { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->serviceName); - isset_serviceName = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->serverRole); - isset_serverRole = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->host); - isset_host = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->port); - isset_port = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast0; - xfer += iprot->readI32(ecast0); - this->transport = (Transport::type)ecast0; - isset_transport = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 6: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->downstream->read(iprot); - } - else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->host); + isset_host = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readFieldEnd(); + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->port); + isset_port = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 5: + if (ftype == ::apache::thrift::protocol::T_I32) { + int32_t ecast0; + xfer += iprot->readI32(ecast0); + this->transport = (Transport::type)ecast0; + isset_transport = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 6: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->downstream->read(iprot); + this->__isset.downstream = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; } - - xfer += iprot->readStructEnd(); - - if (!isset_serviceName) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_serverRole) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_host) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_port) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_transport) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; + xfer += iprot->readFieldEnd(); + } + + xfer += iprot->readStructEnd(); + + if (!isset_serviceName) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_serverRole) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_host) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_port) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_transport) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; +} + +uint32_t Downstream::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("Downstream"); + + xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->serviceName); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("serverRole", ::apache::thrift::protocol::T_STRING, 2); + xfer += oprot->writeString(this->serverRole); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("host", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->host); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("port", ::apache::thrift::protocol::T_STRING, 4); + xfer += oprot->writeString(this->port); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldBegin("transport", ::apache::thrift::protocol::T_I32, 5); + xfer += oprot->writeI32((int32_t)this->transport); + xfer += oprot->writeFieldEnd(); + + if (this->__isset.downstream) { + xfer += oprot->writeFieldBegin("downstream", ::apache::thrift::protocol::T_STRUCT, 6); + xfer += this->downstream->write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -uint32_t Downstream::write(::apache::thrift::protocol::TProtocol* oprot) const -{ - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("Downstream"); - - xfer += oprot->writeFieldBegin( - "serviceName", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->serviceName); - xfer += oprot->writeFieldEnd(); +void swap(Downstream &a, Downstream &b) { + using ::std::swap; + swap(a.serviceName, b.serviceName); + swap(a.serverRole, b.serverRole); + swap(a.host, b.host); + swap(a.port, b.port); + swap(a.transport, b.transport); + swap(a.downstream, b.downstream); + swap(a.__isset, b.__isset); +} - xfer += oprot->writeFieldBegin( - "serverRole", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->serverRole); - xfer += oprot->writeFieldEnd(); +Downstream::Downstream(const Downstream& other1) { + serviceName = other1.serviceName; + serverRole = other1.serverRole; + host = other1.host; + port = other1.port; + transport = other1.transport; + downstream = other1.downstream; + __isset = other1.__isset; +} +Downstream& Downstream::operator=(const Downstream& other2) { + serviceName = other2.serviceName; + serverRole = other2.serverRole; + host = other2.host; + port = other2.port; + transport = other2.transport; + downstream = other2.downstream; + __isset = other2.__isset; + return *this; +} +void Downstream::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "Downstream("; + out << "serviceName=" << to_string(serviceName); + out << ", " << "serverRole=" << to_string(serverRole); + out << ", " << "host=" << to_string(host); + out << ", " << "port=" << to_string(port); + out << ", " << "transport=" << to_string(transport); + out << ", " << "downstream="; (__isset.downstream ? (out << to_string(downstream)) : (out << "")); + out << ")"; +} - xfer += - oprot->writeFieldBegin("host", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->host); - xfer += oprot->writeFieldEnd(); - xfer += - oprot->writeFieldBegin("port", ::apache::thrift::protocol::T_STRING, 4); - xfer += oprot->writeString(this->port); - xfer += oprot->writeFieldEnd(); +StartTraceRequest::~StartTraceRequest() throw() { +} - xfer += oprot->writeFieldBegin( - "transport", ::apache::thrift::protocol::T_I32, 5); - xfer += oprot->writeI32((int32_t)this->transport); - xfer += oprot->writeFieldEnd(); - if (this->downstream) { - xfer += oprot->writeFieldBegin( - "downstream", ::apache::thrift::protocol::T_STRUCT, 6); - xfer += this->downstream->write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; +void StartTraceRequest::__set_serverRole(const std::string& val) { + this->serverRole = val; } -void swap(Downstream& a, Downstream& b) -{ - using ::std::swap; - swap(a.serviceName, b.serviceName); - swap(a.serverRole, b.serverRole); - swap(a.host, b.host); - swap(a.port, b.port); - swap(a.transport, b.transport); - swap(a.downstream, b.downstream); +void StartTraceRequest::__set_sampled(const bool val) { + this->sampled = val; } -Downstream::Downstream(const Downstream& other1) -{ - serviceName = other1.serviceName; - serverRole = other1.serverRole; - host = other1.host; - port = other1.port; - transport = other1.transport; - downstream = other1.downstream; -} -Downstream& Downstream::operator=(const Downstream& other2) -{ - serviceName = other2.serviceName; - serverRole = other2.serverRole; - host = other2.host; - port = other2.port; - transport = other2.transport; - downstream = other2.downstream; - return *this; +void StartTraceRequest::__set_baggage(const std::string& val) { + this->baggage = val; } -std::ostream& operator<<(std::ostream& out, const Downstream& obj) -{ - using apache::thrift::to_string; - out << "Downstream("; - out << "serviceName=" << to_string(obj.serviceName); - out << ", " - << "serverRole=" << to_string(obj.serverRole); - out << ", " - << "host=" << to_string(obj.host); - out << ", " - << "port=" << to_string(obj.port); - out << ", " - << "transport=" << to_string(obj.transport); - out << ", " - << "downstream="; - (obj.downstream ? (out << to_string(*obj.downstream)) : (out << "")); - out << ")"; - return out; -} - -StartTraceRequest::~StartTraceRequest() throw() {} - -void StartTraceRequest::__set_serverRole(const std::string& val) -{ - this->serverRole = val; -} - -void StartTraceRequest::__set_sampled(const bool val) { this->sampled = val; } -void StartTraceRequest::__set_baggage(const std::string& val) -{ - this->baggage = val; +void StartTraceRequest::__set_downstream(const Downstream& val) { + this->downstream = val; } - -void StartTraceRequest::__set_downstream(const Downstream& val) +std::ostream& operator<<(std::ostream& out, const StartTraceRequest& obj) { - this->downstream = val; + obj.printTo(out); + return out; } -const char* StartTraceRequest::ascii_fingerprint = - "EBD7726A3B9A0D49D03E0D6A6F6C72E0"; -const uint8_t StartTraceRequest::binary_fingerprint[16] = { - 0xEB, 0xD7, 0x72, 0x6A, 0x3B, 0x9A, 0x0D, 0x49, - 0xD0, 0x3E, 0x0D, 0x6A, 0x6F, 0x6C, 0x72, 0xE0 -}; -uint32_t StartTraceRequest::read(::apache::thrift::protocol::TProtocol* iprot) -{ +uint32_t StartTraceRequest::read(::apache::thrift::protocol::TProtocol* iprot) { - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - xfer += iprot->readStructBegin(fname); + xfer += iprot->readStructBegin(fname); - using ::apache::thrift::protocol::TProtocolException; + using ::apache::thrift::protocol::TProtocolException; - bool isset_serverRole = false; - bool isset_sampled = false; - bool isset_baggage = false; - bool isset_downstream = false; + bool isset_serverRole = false; + bool isset_sampled = false; + bool isset_baggage = false; + bool isset_downstream = false; - while (true) { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->serverRole); + isset_serverRole = true; + } else { + xfer += iprot->skip(ftype); } - switch (fid) { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->serverRole); - isset_serverRole = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->sampled); - isset_sampled = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->baggage); - isset_baggage = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->downstream.read(iprot); - isset_downstream = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->sampled); + isset_sampled = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readFieldEnd(); + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->baggage); + isset_baggage = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 4: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->downstream.read(iprot); + isset_downstream = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; } + xfer += iprot->readFieldEnd(); + } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - if (!isset_serverRole) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_sampled) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_baggage) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_downstream) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; + if (!isset_serverRole) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_sampled) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_baggage) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_downstream) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; } -uint32_t -StartTraceRequest::write(::apache::thrift::protocol::TProtocol* oprot) const -{ - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("StartTraceRequest"); +uint32_t StartTraceRequest::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("StartTraceRequest"); - xfer += oprot->writeFieldBegin( - "serverRole", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->serverRole); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("serverRole", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->serverRole); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin( - "sampled", ::apache::thrift::protocol::T_BOOL, 2); - xfer += oprot->writeBool(this->sampled); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("sampled", ::apache::thrift::protocol::T_BOOL, 2); + xfer += oprot->writeBool(this->sampled); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin( - "baggage", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->baggage); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("baggage", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->baggage); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin( - "downstream", ::apache::thrift::protocol::T_STRUCT, 4); - xfer += this->downstream.write(oprot); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("downstream", ::apache::thrift::protocol::T_STRUCT, 4); + xfer += this->downstream.write(oprot); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -void swap(StartTraceRequest& a, StartTraceRequest& b) -{ - using ::std::swap; - swap(a.serverRole, b.serverRole); - swap(a.sampled, b.sampled); - swap(a.baggage, b.baggage); - swap(a.downstream, b.downstream); +void swap(StartTraceRequest &a, StartTraceRequest &b) { + using ::std::swap; + swap(a.serverRole, b.serverRole); + swap(a.sampled, b.sampled); + swap(a.baggage, b.baggage); + swap(a.downstream, b.downstream); } -StartTraceRequest::StartTraceRequest(const StartTraceRequest& other3) -{ - serverRole = other3.serverRole; - sampled = other3.sampled; - baggage = other3.baggage; - downstream = other3.downstream; +StartTraceRequest::StartTraceRequest(const StartTraceRequest& other3) { + serverRole = other3.serverRole; + sampled = other3.sampled; + baggage = other3.baggage; + downstream = other3.downstream; } -StartTraceRequest& StartTraceRequest::operator=(const StartTraceRequest& other4) -{ - serverRole = other4.serverRole; - sampled = other4.sampled; - baggage = other4.baggage; - downstream = other4.downstream; - return *this; +StartTraceRequest& StartTraceRequest::operator=(const StartTraceRequest& other4) { + serverRole = other4.serverRole; + sampled = other4.sampled; + baggage = other4.baggage; + downstream = other4.downstream; + return *this; } -std::ostream& operator<<(std::ostream& out, const StartTraceRequest& obj) -{ - using apache::thrift::to_string; - out << "StartTraceRequest("; - out << "serverRole=" << to_string(obj.serverRole); - out << ", " - << "sampled=" << to_string(obj.sampled); - out << ", " - << "baggage=" << to_string(obj.baggage); - out << ", " - << "downstream=" << to_string(obj.downstream); - out << ")"; - return out; -} - -JoinTraceRequest::~JoinTraceRequest() throw() {} - -void JoinTraceRequest::__set_serverRole(const std::string& val) -{ - this->serverRole = val; +void StartTraceRequest::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "StartTraceRequest("; + out << "serverRole=" << to_string(serverRole); + out << ", " << "sampled=" << to_string(sampled); + out << ", " << "baggage=" << to_string(baggage); + out << ", " << "downstream=" << to_string(downstream); + out << ")"; } -void JoinTraceRequest::__set_downstream(const Downstream& val) -{ - this->downstream = val; - __isset.downstream = true; + +JoinTraceRequest::~JoinTraceRequest() throw() { } -const char* JoinTraceRequest::ascii_fingerprint = - "B8479409112F7458788A09AB6826E542"; -const uint8_t JoinTraceRequest::binary_fingerprint[16] = { - 0xB8, 0x47, 0x94, 0x09, 0x11, 0x2F, 0x74, 0x58, - 0x78, 0x8A, 0x09, 0xAB, 0x68, 0x26, 0xE5, 0x42 -}; -uint32_t JoinTraceRequest::read(::apache::thrift::protocol::TProtocol* iprot) +void JoinTraceRequest::__set_serverRole(const std::string& val) { + this->serverRole = val; +} + +void JoinTraceRequest::__set_downstream(const Downstream& val) { + this->downstream = val; +__isset.downstream = true; +} +std::ostream& operator<<(std::ostream& out, const JoinTraceRequest& obj) { + obj.printTo(out); + return out; +} + - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; +uint32_t JoinTraceRequest::read(::apache::thrift::protocol::TProtocol* iprot) { - xfer += iprot->readStructBegin(fname); + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - using ::apache::thrift::protocol::TProtocolException; + xfer += iprot->readStructBegin(fname); - bool isset_serverRole = false; + using ::apache::thrift::protocol::TProtocolException; - while (true) { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; + bool isset_serverRole = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->serverRole); + isset_serverRole = true; + } else { + xfer += iprot->skip(ftype); } - switch (fid) { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->serverRole); - isset_serverRole = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->downstream.read(iprot); - this->__isset.downstream = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->downstream.read(iprot); + this->__isset.downstream = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readFieldEnd(); + break; + default: + xfer += iprot->skip(ftype); + break; } + xfer += iprot->readFieldEnd(); + } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - if (!isset_serverRole) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; + if (!isset_serverRole) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; } -uint32_t -JoinTraceRequest::write(::apache::thrift::protocol::TProtocol* oprot) const -{ - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("JoinTraceRequest"); +uint32_t JoinTraceRequest::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("JoinTraceRequest"); - xfer += oprot->writeFieldBegin( - "serverRole", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->serverRole); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("serverRole", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->serverRole); + xfer += oprot->writeFieldEnd(); - if (this->__isset.downstream) { - xfer += oprot->writeFieldBegin( - "downstream", ::apache::thrift::protocol::T_STRUCT, 2); - xfer += this->downstream.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; + if (this->__isset.downstream) { + xfer += oprot->writeFieldBegin("downstream", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->downstream.write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -void swap(JoinTraceRequest& a, JoinTraceRequest& b) -{ - using ::std::swap; - swap(a.serverRole, b.serverRole); - swap(a.downstream, b.downstream); - swap(a.__isset, b.__isset); +void swap(JoinTraceRequest &a, JoinTraceRequest &b) { + using ::std::swap; + swap(a.serverRole, b.serverRole); + swap(a.downstream, b.downstream); + swap(a.__isset, b.__isset); } -JoinTraceRequest::JoinTraceRequest(const JoinTraceRequest& other5) -{ - serverRole = other5.serverRole; - downstream = other5.downstream; - __isset = other5.__isset; +JoinTraceRequest::JoinTraceRequest(const JoinTraceRequest& other5) { + serverRole = other5.serverRole; + downstream = other5.downstream; + __isset = other5.__isset; } -JoinTraceRequest& JoinTraceRequest::operator=(const JoinTraceRequest& other6) -{ - serverRole = other6.serverRole; - downstream = other6.downstream; - __isset = other6.__isset; - return *this; +JoinTraceRequest& JoinTraceRequest::operator=(const JoinTraceRequest& other6) { + serverRole = other6.serverRole; + downstream = other6.downstream; + __isset = other6.__isset; + return *this; } -std::ostream& operator<<(std::ostream& out, const JoinTraceRequest& obj) -{ - using apache::thrift::to_string; - out << "JoinTraceRequest("; - out << "serverRole=" << to_string(obj.serverRole); - out << ", " - << "downstream="; - (obj.__isset.downstream ? (out << to_string(obj.downstream)) - : (out << "")); - out << ")"; - return out; +void JoinTraceRequest::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "JoinTraceRequest("; + out << "serverRole=" << to_string(serverRole); + out << ", " << "downstream="; (__isset.downstream ? (out << to_string(downstream)) : (out << "")); + out << ")"; } -ObservedSpan::~ObservedSpan() throw() {} -void ObservedSpan::__set_traceId(const std::string& val) -{ - this->traceId = val; +ObservedSpan::~ObservedSpan() throw() { } -void ObservedSpan::__set_sampled(const bool val) { this->sampled = val; } -void ObservedSpan::__set_baggage(const std::string& val) -{ - this->baggage = val; +void ObservedSpan::__set_traceId(const std::string& val) { + this->traceId = val; } -const char* ObservedSpan::ascii_fingerprint = - "980A53AA3FC6CDB7DBBD4C3B9EF9B8E0"; -const uint8_t ObservedSpan::binary_fingerprint[16] = { 0x98, 0x0A, 0x53, 0xAA, - 0x3F, 0xC6, 0xCD, 0xB7, - 0xDB, 0xBD, 0x4C, 0x3B, - 0x9E, 0xF9, 0xB8, 0xE0 }; +void ObservedSpan::__set_sampled(const bool val) { + this->sampled = val; +} -uint32_t ObservedSpan::read(::apache::thrift::protocol::TProtocol* iprot) +void ObservedSpan::__set_baggage(const std::string& val) { + this->baggage = val; +} +std::ostream& operator<<(std::ostream& out, const ObservedSpan& obj) { + obj.printTo(out); + return out; +} - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - xfer += iprot->readStructBegin(fname); +uint32_t ObservedSpan::read(::apache::thrift::protocol::TProtocol* iprot) { - using ::apache::thrift::protocol::TProtocolException; + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - bool isset_traceId = false; - bool isset_sampled = false; - bool isset_baggage = false; + xfer += iprot->readStructBegin(fname); - while (true) { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; + using ::apache::thrift::protocol::TProtocolException; + + bool isset_traceId = false; + bool isset_sampled = false; + bool isset_baggage = false; + + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->traceId); + isset_traceId = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_BOOL) { + xfer += iprot->readBool(this->sampled); + isset_sampled = true; + } else { + xfer += iprot->skip(ftype); } - switch (fid) { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->traceId); - isset_traceId = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->sampled); - isset_sampled = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->baggage); - isset_baggage = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->baggage); + isset_baggage = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readFieldEnd(); + break; + default: + xfer += iprot->skip(ftype); + break; } + xfer += iprot->readFieldEnd(); + } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - if (!isset_traceId) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_sampled) - throw TProtocolException(TProtocolException::INVALID_DATA); - if (!isset_baggage) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; + if (!isset_traceId) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_sampled) + throw TProtocolException(TProtocolException::INVALID_DATA); + if (!isset_baggage) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; } -uint32_t ObservedSpan::write(::apache::thrift::protocol::TProtocol* oprot) const -{ - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("ObservedSpan"); +uint32_t ObservedSpan::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("ObservedSpan"); - xfer += oprot->writeFieldBegin( - "traceId", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->traceId); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("traceId", ::apache::thrift::protocol::T_STRING, 1); + xfer += oprot->writeString(this->traceId); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin( - "sampled", ::apache::thrift::protocol::T_BOOL, 2); - xfer += oprot->writeBool(this->sampled); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("sampled", ::apache::thrift::protocol::T_BOOL, 2); + xfer += oprot->writeBool(this->sampled); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldBegin( - "baggage", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->baggage); - xfer += oprot->writeFieldEnd(); + xfer += oprot->writeFieldBegin("baggage", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->baggage); + xfer += oprot->writeFieldEnd(); - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; } -void swap(ObservedSpan& a, ObservedSpan& b) -{ - using ::std::swap; - swap(a.traceId, b.traceId); - swap(a.sampled, b.sampled); - swap(a.baggage, b.baggage); +void swap(ObservedSpan &a, ObservedSpan &b) { + using ::std::swap; + swap(a.traceId, b.traceId); + swap(a.sampled, b.sampled); + swap(a.baggage, b.baggage); } -ObservedSpan::ObservedSpan(const ObservedSpan& other7) -{ - traceId = other7.traceId; - sampled = other7.sampled; - baggage = other7.baggage; +ObservedSpan::ObservedSpan(const ObservedSpan& other7) { + traceId = other7.traceId; + sampled = other7.sampled; + baggage = other7.baggage; } -ObservedSpan& ObservedSpan::operator=(const ObservedSpan& other8) -{ - traceId = other8.traceId; - sampled = other8.sampled; - baggage = other8.baggage; - return *this; +ObservedSpan& ObservedSpan::operator=(const ObservedSpan& other8) { + traceId = other8.traceId; + sampled = other8.sampled; + baggage = other8.baggage; + return *this; } -std::ostream& operator<<(std::ostream& out, const ObservedSpan& obj) -{ - using apache::thrift::to_string; - out << "ObservedSpan("; - out << "traceId=" << to_string(obj.traceId); - out << ", " - << "sampled=" << to_string(obj.sampled); - out << ", " - << "baggage=" << to_string(obj.baggage); - out << ")"; - return out; +void ObservedSpan::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "ObservedSpan("; + out << "traceId=" << to_string(traceId); + out << ", " << "sampled=" << to_string(sampled); + out << ", " << "baggage=" << to_string(baggage); + out << ")"; } -TraceResponse::~TraceResponse() throw() {} -void TraceResponse::__set_span(const ObservedSpan& val) -{ - this->span = val; - __isset.span = true; +TraceResponse::~TraceResponse() throw() { } -void TraceResponse::__set_downstream(const TraceResponse& val) -{ - this->downstream = boost::shared_ptr(new TraceResponse(val)); + +void TraceResponse::__set_span(const ObservedSpan& val) { + this->span = val; +__isset.span = true; } -void TraceResponse::__set_notImplementedError(const std::string& val) +void TraceResponse::__set_downstream(const std::shared_ptr& val) { + this->downstream = val; +__isset.downstream = true; +} + +void TraceResponse::__set_notImplementedError(const std::string& val) { + this->notImplementedError = val; +} +std::ostream& operator<<(std::ostream& out, const TraceResponse& obj) { - this->notImplementedError = val; + obj.printTo(out); + return out; } -const char* TraceResponse::ascii_fingerprint = - "BE76F8F59F14519CE6831037A5CDA9EE"; -const uint8_t TraceResponse::binary_fingerprint[16] = { - 0xBE, 0x76, 0xF8, 0xF5, 0x9F, 0x14, 0x51, 0x9C, - 0xE6, 0x83, 0x10, 0x37, 0xA5, 0xCD, 0xA9, 0xEE -}; -uint32_t TraceResponse::read(::apache::thrift::protocol::TProtocol* iprot) -{ +uint32_t TraceResponse::read(::apache::thrift::protocol::TProtocol* iprot) { - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); + uint32_t xfer = 0; + std::string fname; + ::apache::thrift::protocol::TType ftype; + int16_t fid; - xfer += iprot->readStructBegin(fname); + xfer += iprot->readStructBegin(fname); - using ::apache::thrift::protocol::TProtocolException; + using ::apache::thrift::protocol::TProtocolException; - bool isset_notImplementedError = false; + bool isset_notImplementedError = false; - while (true) { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; + while (true) + { + xfer += iprot->readFieldBegin(fname, ftype, fid); + if (ftype == ::apache::thrift::protocol::T_STOP) { + break; + } + switch (fid) + { + case 1: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->span.read(iprot); + this->__isset.span = true; + } else { + xfer += iprot->skip(ftype); } - switch (fid) { - case 1: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->span.read(iprot); - this->__isset.span = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->downstream->read(iprot); - } - else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->notImplementedError); - isset_notImplementedError = true; - } - else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; + break; + case 2: + if (ftype == ::apache::thrift::protocol::T_STRUCT) { + xfer += this->downstream->read(iprot); + this->__isset.downstream = true; + } else { + xfer += iprot->skip(ftype); } - xfer += iprot->readFieldEnd(); + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_STRING) { + xfer += iprot->readString(this->notImplementedError); + isset_notImplementedError = true; + } else { + xfer += iprot->skip(ftype); + } + break; + default: + xfer += iprot->skip(ftype); + break; } + xfer += iprot->readFieldEnd(); + } - xfer += iprot->readStructEnd(); + xfer += iprot->readStructEnd(); - if (!isset_notImplementedError) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; + if (!isset_notImplementedError) + throw TProtocolException(TProtocolException::INVALID_DATA); + return xfer; } -uint32_t -TraceResponse::write(::apache::thrift::protocol::TProtocol* oprot) const -{ - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("TraceResponse"); - - if (this->__isset.span) { - xfer += oprot->writeFieldBegin( - "span", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->span.write(oprot); - xfer += oprot->writeFieldEnd(); - } - if (this->downstream) { - xfer += oprot->writeFieldBegin( - "downstream", ::apache::thrift::protocol::T_STRUCT, 2); - xfer += this->downstream->write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldBegin( - "notImplementedError", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->notImplementedError); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - -void swap(TraceResponse& a, TraceResponse& b) -{ - using ::std::swap; - swap(a.span, b.span); - swap(a.downstream, b.downstream); - swap(a.notImplementedError, b.notImplementedError); - swap(a.__isset, b.__isset); -} +uint32_t TraceResponse::write(::apache::thrift::protocol::TProtocol* oprot) const { + uint32_t xfer = 0; + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); + xfer += oprot->writeStructBegin("TraceResponse"); -TraceResponse::TraceResponse(const TraceResponse& other9) -{ - span = other9.span; - downstream = other9.downstream; - notImplementedError = other9.notImplementedError; - __isset = other9.__isset; -} -TraceResponse& TraceResponse::operator=(const TraceResponse& other10) -{ - span = other10.span; - downstream = other10.downstream; - notImplementedError = other10.notImplementedError; - __isset = other10.__isset; - return *this; -} -std::ostream& operator<<(std::ostream& out, const TraceResponse& obj) -{ - using apache::thrift::to_string; - out << "TraceResponse("; - out << "span="; - (obj.__isset.span ? (out << to_string(obj.span)) : (out << "")); - out << ", " - << "downstream="; - (obj.downstream ? (out << to_string(*obj.downstream)) : (out << "")); - out << ", " - << "notImplementedError=" << to_string(obj.notImplementedError); - out << ")"; - return out; -} - -} // namespace thrift -} // namespace crossdock -} // namespace jaegertracing + if (this->__isset.span) { + xfer += oprot->writeFieldBegin("span", ::apache::thrift::protocol::T_STRUCT, 1); + xfer += this->span.write(oprot); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.downstream) { + xfer += oprot->writeFieldBegin("downstream", ::apache::thrift::protocol::T_STRUCT, 2); + xfer += this->downstream->write(oprot); + xfer += oprot->writeFieldEnd(); + } + xfer += oprot->writeFieldBegin("notImplementedError", ::apache::thrift::protocol::T_STRING, 3); + xfer += oprot->writeString(this->notImplementedError); + xfer += oprot->writeFieldEnd(); + + xfer += oprot->writeFieldStop(); + xfer += oprot->writeStructEnd(); + return xfer; +} + +void swap(TraceResponse &a, TraceResponse &b) { + using ::std::swap; + swap(a.span, b.span); + swap(a.downstream, b.downstream); + swap(a.notImplementedError, b.notImplementedError); + swap(a.__isset, b.__isset); +} + +TraceResponse::TraceResponse(const TraceResponse& other9) { + span = other9.span; + downstream = other9.downstream; + notImplementedError = other9.notImplementedError; + __isset = other9.__isset; +} +TraceResponse& TraceResponse::operator=(const TraceResponse& other10) { + span = other10.span; + downstream = other10.downstream; + notImplementedError = other10.notImplementedError; + __isset = other10.__isset; + return *this; +} +void TraceResponse::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; + out << "TraceResponse("; + out << "span="; (__isset.span ? (out << to_string(span)) : (out << "")); + out << ", " << "downstream="; (__isset.downstream ? (out << to_string(downstream)) : (out << "")); + out << ", " << "notImplementedError=" << to_string(notImplementedError); + out << ")"; +} + +}}} // namespace diff --git a/src/jaegertracing/thrift-gen/tracetest_types.h b/src/jaegertracing/thrift-gen/tracetest_types.h index aa0ea674..a44f3a37 100644 --- a/src/jaegertracing/thrift-gen/tracetest_types.h +++ b/src/jaegertracing/thrift-gen/tracetest_types.h @@ -1,32 +1,37 @@ /** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * - * WARNING WARNING WARNING - * This file has been hand-patched. See - * https://github.com/jaegertracing/jaeger-client-cpp/issues/45. + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ #ifndef tracetest_TYPES_H #define tracetest_TYPES_H #include -#include #include +#include +#include #include #include -#include +#include -namespace jaegertracing { -namespace crossdock { -namespace thrift { + +namespace jaegertracing { namespace crossdock { namespace thrift { struct Transport { - enum type { HTTP = 0, TCHANNEL = 1, DUMMY = 2 }; + enum type { + HTTP = 0, + TCHANNEL = 1, + DUMMY = 2 + }; }; extern const std::map _Transport_VALUES_TO_NAMES; +std::ostream& operator<<(std::ostream& out, const Transport::type& val); + class Downstream; class StartTraceRequest; @@ -37,309 +42,278 @@ class ObservedSpan; class TraceResponse; -class Downstream { - public: - static const char* - ascii_fingerprint; // = "864D68E1D3FB0C71C1E979F437051051"; - static const uint8_t binary_fingerprint - [16]; // = - // {0x86,0x4D,0x68,0xE1,0xD3,0xFB,0x0C,0x71,0xC1,0xE9,0x79,0xF4,0x37,0x05,0x10,0x51}; - - Downstream(const Downstream&); - Downstream& operator=(const Downstream&); - Downstream() - : serviceName() - , serverRole() - , host() - , port() - , transport((Transport::type)0) - { - } - - virtual ~Downstream() throw(); - std::string serviceName; - std::string serverRole; - std::string host; - std::string port; - Transport::type transport; - boost::shared_ptr downstream; - - void __set_serviceName(const std::string& val); - - void __set_serverRole(const std::string& val); - - void __set_host(const std::string& val); - - void __set_port(const std::string& val); - - void __set_transport(const Transport::type val); - - void __set_downstream(const Downstream& val); - - bool operator==(const Downstream& rhs) const - { - if (!(serviceName == rhs.serviceName)) - return false; - if (!(serverRole == rhs.serverRole)) - return false; - if (!(host == rhs.host)) - return false; - if (!(port == rhs.port)) - return false; - if (!(transport == rhs.transport)) - return false; - if (static_cast(downstream) != static_cast(rhs.downstream)) - return false; - if (downstream && rhs.downstream && !(*downstream == *rhs.downstream)) - return false; - return true; - } - bool operator!=(const Downstream& rhs) const { return !(*this == rhs); } - - bool operator<(const Downstream&) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - friend std::ostream& operator<<(std::ostream& out, const Downstream& obj); +typedef struct _Downstream__isset { + _Downstream__isset() : downstream(false) {} + bool downstream :1; +} _Downstream__isset; + +class Downstream : public virtual ::apache::thrift::TBase { + public: + + Downstream(const Downstream&); + Downstream& operator=(const Downstream&); + Downstream() : serviceName(), serverRole(), host(), port(), transport((Transport::type)0) { + } + + virtual ~Downstream() throw(); + std::string serviceName; + std::string serverRole; + std::string host; + std::string port; + Transport::type transport; + std::shared_ptr downstream; + + _Downstream__isset __isset; + + void __set_serviceName(const std::string& val); + + void __set_serverRole(const std::string& val); + + void __set_host(const std::string& val); + + void __set_port(const std::string& val); + + void __set_transport(const Transport::type val); + + void __set_downstream(const std::shared_ptr& val); + + bool operator == (const Downstream & rhs) const + { + if (!(serviceName == rhs.serviceName)) + return false; + if (!(serverRole == rhs.serverRole)) + return false; + if (!(host == rhs.host)) + return false; + if (!(port == rhs.port)) + return false; + if (!(transport == rhs.transport)) + return false; + if (__isset.downstream != rhs.__isset.downstream) + return false; + else if (__isset.downstream && !(*downstream == *rhs.downstream)) + return false; + return true; + } + bool operator != (const Downstream &rhs) const { + return !(*this == rhs); + } + + bool operator < (const Downstream & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; }; -void swap(Downstream& a, Downstream& b); - -class StartTraceRequest { - public: - static const char* - ascii_fingerprint; // = "EBD7726A3B9A0D49D03E0D6A6F6C72E0"; - static const uint8_t binary_fingerprint - [16]; // = - // {0xEB,0xD7,0x72,0x6A,0x3B,0x9A,0x0D,0x49,0xD0,0x3E,0x0D,0x6A,0x6F,0x6C,0x72,0xE0}; - - StartTraceRequest(const StartTraceRequest&); - StartTraceRequest& operator=(const StartTraceRequest&); - StartTraceRequest() - : serverRole() - , sampled(0) - , baggage() - { - } - - virtual ~StartTraceRequest() throw(); - std::string serverRole; - bool sampled; - std::string baggage; - Downstream downstream; - - void __set_serverRole(const std::string& val); - - void __set_sampled(const bool val); - - void __set_baggage(const std::string& val); - - void __set_downstream(const Downstream& val); - - bool operator==(const StartTraceRequest& rhs) const - { - if (!(serverRole == rhs.serverRole)) - return false; - if (!(sampled == rhs.sampled)) - return false; - if (!(baggage == rhs.baggage)) - return false; - if (!(downstream == rhs.downstream)) - return false; - return true; - } - bool operator!=(const StartTraceRequest& rhs) const - { - return !(*this == rhs); - } - - bool operator<(const StartTraceRequest&) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - friend std::ostream& operator<<(std::ostream& out, - const StartTraceRequest& obj); +void swap(Downstream &a, Downstream &b); + +std::ostream& operator<<(std::ostream& out, const Downstream& obj); + + +class StartTraceRequest : public virtual ::apache::thrift::TBase { + public: + + StartTraceRequest(const StartTraceRequest&); + StartTraceRequest& operator=(const StartTraceRequest&); + StartTraceRequest() : serverRole(), sampled(0), baggage() { + } + + virtual ~StartTraceRequest() throw(); + std::string serverRole; + bool sampled; + std::string baggage; + Downstream downstream; + + void __set_serverRole(const std::string& val); + + void __set_sampled(const bool val); + + void __set_baggage(const std::string& val); + + void __set_downstream(const Downstream& val); + + bool operator == (const StartTraceRequest & rhs) const + { + if (!(serverRole == rhs.serverRole)) + return false; + if (!(sampled == rhs.sampled)) + return false; + if (!(baggage == rhs.baggage)) + return false; + if (!(downstream == rhs.downstream)) + return false; + return true; + } + bool operator != (const StartTraceRequest &rhs) const { + return !(*this == rhs); + } + + bool operator < (const StartTraceRequest & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; }; -void swap(StartTraceRequest& a, StartTraceRequest& b); +void swap(StartTraceRequest &a, StartTraceRequest &b); + +std::ostream& operator<<(std::ostream& out, const StartTraceRequest& obj); typedef struct _JoinTraceRequest__isset { - _JoinTraceRequest__isset() - : downstream(false) - { - } - bool downstream : 1; + _JoinTraceRequest__isset() : downstream(false) {} + bool downstream :1; } _JoinTraceRequest__isset; -class JoinTraceRequest { - public: - static const char* - ascii_fingerprint; // = "B8479409112F7458788A09AB6826E542"; - static const uint8_t binary_fingerprint - [16]; // = - // {0xB8,0x47,0x94,0x09,0x11,0x2F,0x74,0x58,0x78,0x8A,0x09,0xAB,0x68,0x26,0xE5,0x42}; - - JoinTraceRequest(const JoinTraceRequest&); - JoinTraceRequest& operator=(const JoinTraceRequest&); - JoinTraceRequest() - : serverRole() - { - } - - virtual ~JoinTraceRequest() throw(); - std::string serverRole; - Downstream downstream; - - _JoinTraceRequest__isset __isset; - - void __set_serverRole(const std::string& val); - - void __set_downstream(const Downstream& val); - - bool operator==(const JoinTraceRequest& rhs) const - { - if (!(serverRole == rhs.serverRole)) - return false; - if (__isset.downstream != rhs.__isset.downstream) - return false; - else if (__isset.downstream && !(downstream == rhs.downstream)) - return false; - return true; - } - bool operator!=(const JoinTraceRequest& rhs) const - { - return !(*this == rhs); - } - - bool operator<(const JoinTraceRequest&) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - friend std::ostream& operator<<(std::ostream& out, - const JoinTraceRequest& obj); +class JoinTraceRequest : public virtual ::apache::thrift::TBase { + public: + + JoinTraceRequest(const JoinTraceRequest&); + JoinTraceRequest& operator=(const JoinTraceRequest&); + JoinTraceRequest() : serverRole() { + } + + virtual ~JoinTraceRequest() throw(); + std::string serverRole; + Downstream downstream; + + _JoinTraceRequest__isset __isset; + + void __set_serverRole(const std::string& val); + + void __set_downstream(const Downstream& val); + + bool operator == (const JoinTraceRequest & rhs) const + { + if (!(serverRole == rhs.serverRole)) + return false; + if (__isset.downstream != rhs.__isset.downstream) + return false; + else if (__isset.downstream && !(downstream == rhs.downstream)) + return false; + return true; + } + bool operator != (const JoinTraceRequest &rhs) const { + return !(*this == rhs); + } + + bool operator < (const JoinTraceRequest & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; }; -void swap(JoinTraceRequest& a, JoinTraceRequest& b); - -class ObservedSpan { - public: - static const char* - ascii_fingerprint; // = "980A53AA3FC6CDB7DBBD4C3B9EF9B8E0"; - static const uint8_t binary_fingerprint - [16]; // = - // {0x98,0x0A,0x53,0xAA,0x3F,0xC6,0xCD,0xB7,0xDB,0xBD,0x4C,0x3B,0x9E,0xF9,0xB8,0xE0}; - - ObservedSpan(const ObservedSpan&); - ObservedSpan& operator=(const ObservedSpan&); - ObservedSpan() - : traceId() - , sampled(0) - , baggage() - { - } - - virtual ~ObservedSpan() throw(); - std::string traceId; - bool sampled; - std::string baggage; - - void __set_traceId(const std::string& val); - - void __set_sampled(const bool val); - - void __set_baggage(const std::string& val); - - bool operator==(const ObservedSpan& rhs) const - { - if (!(traceId == rhs.traceId)) - return false; - if (!(sampled == rhs.sampled)) - return false; - if (!(baggage == rhs.baggage)) - return false; - return true; - } - bool operator!=(const ObservedSpan& rhs) const { return !(*this == rhs); } - - bool operator<(const ObservedSpan&) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - friend std::ostream& operator<<(std::ostream& out, const ObservedSpan& obj); +void swap(JoinTraceRequest &a, JoinTraceRequest &b); + +std::ostream& operator<<(std::ostream& out, const JoinTraceRequest& obj); + + +class ObservedSpan : public virtual ::apache::thrift::TBase { + public: + + ObservedSpan(const ObservedSpan&); + ObservedSpan& operator=(const ObservedSpan&); + ObservedSpan() : traceId(), sampled(0), baggage() { + } + + virtual ~ObservedSpan() throw(); + std::string traceId; + bool sampled; + std::string baggage; + + void __set_traceId(const std::string& val); + + void __set_sampled(const bool val); + + void __set_baggage(const std::string& val); + + bool operator == (const ObservedSpan & rhs) const + { + if (!(traceId == rhs.traceId)) + return false; + if (!(sampled == rhs.sampled)) + return false; + if (!(baggage == rhs.baggage)) + return false; + return true; + } + bool operator != (const ObservedSpan &rhs) const { + return !(*this == rhs); + } + + bool operator < (const ObservedSpan & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; }; -void swap(ObservedSpan& a, ObservedSpan& b); +void swap(ObservedSpan &a, ObservedSpan &b); + +std::ostream& operator<<(std::ostream& out, const ObservedSpan& obj); typedef struct _TraceResponse__isset { - _TraceResponse__isset() - : span(false) - { - } - bool span : 1; + _TraceResponse__isset() : span(false), downstream(false) {} + bool span :1; + bool downstream :1; } _TraceResponse__isset; -class TraceResponse { - public: - static const char* - ascii_fingerprint; // = "BE76F8F59F14519CE6831037A5CDA9EE"; - static const uint8_t binary_fingerprint - [16]; // = - // {0xBE,0x76,0xF8,0xF5,0x9F,0x14,0x51,0x9C,0xE6,0x83,0x10,0x37,0xA5,0xCD,0xA9,0xEE}; - - TraceResponse(const TraceResponse&); - TraceResponse& operator=(const TraceResponse&); - TraceResponse() - : notImplementedError() - { - } - - virtual ~TraceResponse() throw(); - ObservedSpan span; - boost::shared_ptr downstream; - std::string notImplementedError; - - _TraceResponse__isset __isset; - - void __set_span(const ObservedSpan& val); - - void __set_downstream(const TraceResponse& val); - - void __set_notImplementedError(const std::string& val); - - bool operator==(const TraceResponse& rhs) const - { - if (__isset.span != rhs.__isset.span) - return false; - else if (__isset.span && !(span == rhs.span)) - return false; - if (static_cast(downstream) != static_cast(rhs.downstream)) - return false; - else if (downstream && rhs.downstream && - !(*downstream == *rhs.downstream)) - return false; - if (!(notImplementedError == rhs.notImplementedError)) - return false; - return true; - } - bool operator!=(const TraceResponse& rhs) const { return !(*this == rhs); } - - bool operator<(const TraceResponse&) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - friend std::ostream& operator<<(std::ostream& out, - const TraceResponse& obj); +class TraceResponse : public virtual ::apache::thrift::TBase { + public: + + TraceResponse(const TraceResponse&); + TraceResponse& operator=(const TraceResponse&); + TraceResponse() : notImplementedError() { + } + + virtual ~TraceResponse() throw(); + ObservedSpan span; + std::shared_ptr downstream; + std::string notImplementedError; + + _TraceResponse__isset __isset; + + void __set_span(const ObservedSpan& val); + + void __set_downstream(const std::shared_ptr& val); + + void __set_notImplementedError(const std::string& val); + + bool operator == (const TraceResponse & rhs) const + { + if (__isset.span != rhs.__isset.span) + return false; + else if (__isset.span && !(span == rhs.span)) + return false; + if (__isset.downstream != rhs.__isset.downstream) + return false; + else if (__isset.downstream && !(*downstream == *rhs.downstream)) + return false; + if (!(notImplementedError == rhs.notImplementedError)) + return false; + return true; + } + bool operator != (const TraceResponse &rhs) const { + return !(*this == rhs); + } + + bool operator < (const TraceResponse & ) const; + + uint32_t read(::apache::thrift::protocol::TProtocol* iprot); + uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; + + virtual void printTo(std::ostream& out) const; }; -void swap(TraceResponse& a, TraceResponse& b); +void swap(TraceResponse &a, TraceResponse &b); + +std::ostream& operator<<(std::ostream& out, const TraceResponse& obj); -} // namespace thrift -} // namespace crossdock -} // namespace jaegertracing +}}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/zipkincore_constants.cpp b/src/jaegertracing/thrift-gen/zipkincore_constants.cpp index 6cf27b9d..3b463710 100644 --- a/src/jaegertracing/thrift-gen/zipkincore_constants.cpp +++ b/src/jaegertracing/thrift-gen/zipkincore_constants.cpp @@ -1,48 +1,49 @@ /** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * - * WARNING WARNING WARNING - * This file has been hand-patched. See - * https://github.com/jaegertracing/jaeger-client-cpp/issues/45. + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ #include "zipkincore_constants.h" -namespace twitter { -namespace zipkin { -namespace thrift { +namespace twitter { namespace zipkin { namespace thrift { const zipkincoreConstants g_zipkincore_constants; -zipkincoreConstants::zipkincoreConstants() -{ - CLIENT_SEND = "cs"; +zipkincoreConstants::zipkincoreConstants() { + CLIENT_SEND = "cs"; - CLIENT_RECV = "cr"; + CLIENT_RECV = "cr"; - SERVER_SEND = "ss"; + SERVER_SEND = "ss"; - SERVER_RECV = "sr"; + SERVER_RECV = "sr"; - WIRE_SEND = "ws"; + MESSAGE_SEND = "ms"; - WIRE_RECV = "wr"; + MESSAGE_RECV = "mr"; - CLIENT_SEND_FRAGMENT = "csf"; + WIRE_SEND = "ws"; - CLIENT_RECV_FRAGMENT = "crf"; + WIRE_RECV = "wr"; - SERVER_SEND_FRAGMENT = "ssf"; + CLIENT_SEND_FRAGMENT = "csf"; - SERVER_RECV_FRAGMENT = "srf"; + CLIENT_RECV_FRAGMENT = "crf"; - LOCAL_COMPONENT = "lc"; + SERVER_SEND_FRAGMENT = "ssf"; - CLIENT_ADDR = "ca"; + SERVER_RECV_FRAGMENT = "srf"; + + LOCAL_COMPONENT = "lc"; + + CLIENT_ADDR = "ca"; + + SERVER_ADDR = "sa"; + + MESSAGE_ADDR = "ma"; - SERVER_ADDR = "sa"; } -} // namespace thrift -} // namespace zipkin -} // namespace twitter +}}} // namespace diff --git a/src/jaegertracing/thrift-gen/zipkincore_constants.h b/src/jaegertracing/thrift-gen/zipkincore_constants.h index 6ed678f6..b759e069 100644 --- a/src/jaegertracing/thrift-gen/zipkincore_constants.h +++ b/src/jaegertracing/thrift-gen/zipkincore_constants.h @@ -1,42 +1,40 @@ /** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * - * WARNING WARNING WARNING - * This file has been hand-patched. See - * https://github.com/jaegertracing/jaeger-client-cpp/issues/45. + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated */ #ifndef zipkincore_CONSTANTS_H #define zipkincore_CONSTANTS_H #include "zipkincore_types.h" -namespace twitter { -namespace zipkin { -namespace thrift { +namespace twitter { namespace zipkin { namespace thrift { class zipkincoreConstants { - public: - zipkincoreConstants(); + public: + zipkincoreConstants(); - std::string CLIENT_SEND; - std::string CLIENT_RECV; - std::string SERVER_SEND; - std::string SERVER_RECV; - std::string WIRE_SEND; - std::string WIRE_RECV; - std::string CLIENT_SEND_FRAGMENT; - std::string CLIENT_RECV_FRAGMENT; - std::string SERVER_SEND_FRAGMENT; - std::string SERVER_RECV_FRAGMENT; - std::string LOCAL_COMPONENT; - std::string CLIENT_ADDR; - std::string SERVER_ADDR; + std::string CLIENT_SEND; + std::string CLIENT_RECV; + std::string SERVER_SEND; + std::string SERVER_RECV; + std::string MESSAGE_SEND; + std::string MESSAGE_RECV; + std::string WIRE_SEND; + std::string WIRE_RECV; + std::string CLIENT_SEND_FRAGMENT; + std::string CLIENT_RECV_FRAGMENT; + std::string SERVER_SEND_FRAGMENT; + std::string SERVER_RECV_FRAGMENT; + std::string LOCAL_COMPONENT; + std::string CLIENT_ADDR; + std::string SERVER_ADDR; + std::string MESSAGE_ADDR; }; extern const zipkincoreConstants g_zipkincore_constants; -} // namespace thrift -} // namespace zipkin -} // namespace twitter +}}} // namespace #endif diff --git a/src/jaegertracing/thrift-gen/zipkincore_types.cpp b/src/jaegertracing/thrift-gen/zipkincore_types.cpp index fc305574..de44dbbb 100644 --- a/src/jaegertracing/thrift-gen/zipkincore_types.cpp +++ b/src/jaegertracing/thrift-gen/zipkincore_types.cpp @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -33,6 +33,16 @@ const char* _kAnnotationTypeNames[] = { }; const std::map _AnnotationType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(7, _kAnnotationTypeValues, _kAnnotationTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); +std::ostream& operator<<(std::ostream& out, const AnnotationType::type& val) { + std::map::const_iterator it = _AnnotationType_VALUES_TO_NAMES.find(val); + if (it != _AnnotationType_VALUES_TO_NAMES.end()) { + out << it->second; + } else { + out << static_cast(val); + } + return out; +} + Endpoint::~Endpoint() throw() { } @@ -54,12 +64,16 @@ void Endpoint::__set_ipv6(const std::string& val) { this->ipv6 = val; __isset.ipv6 = true; } +std::ostream& operator<<(std::ostream& out, const Endpoint& obj) +{ + obj.printTo(out); + return out; +} -const char* Endpoint::ascii_fingerprint = "66357C747F937372BB32913F3D70EB58"; -const uint8_t Endpoint::binary_fingerprint[16] = {0x66,0x35,0x7C,0x74,0x7F,0x93,0x73,0x72,0xBB,0x32,0x91,0x3F,0x3D,0x70,0xEB,0x58}; uint32_t Endpoint::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -124,7 +138,7 @@ uint32_t Endpoint::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Endpoint::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Endpoint"); xfer += oprot->writeFieldBegin("ipv4", ::apache::thrift::protocol::T_I32, 1); @@ -146,7 +160,6 @@ uint32_t Endpoint::write(::apache::thrift::protocol::TProtocol* oprot) const { } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -174,15 +187,14 @@ Endpoint& Endpoint::operator=(const Endpoint& other1) { __isset = other1.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const Endpoint& obj) { - using apache::thrift::to_string; +void Endpoint::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Endpoint("; - out << "ipv4=" << to_string(obj.ipv4); - out << ", " << "port=" << to_string(obj.port); - out << ", " << "service_name=" << to_string(obj.service_name); - out << ", " << "ipv6="; (obj.__isset.ipv6 ? (out << to_string(obj.ipv6)) : (out << "")); + out << "ipv4=" << to_string(ipv4); + out << ", " << "port=" << to_string(port); + out << ", " << "service_name=" << to_string(service_name); + out << ", " << "ipv6="; (__isset.ipv6 ? (out << to_string(ipv6)) : (out << "")); out << ")"; - return out; } @@ -202,12 +214,16 @@ void Annotation::__set_host(const Endpoint& val) { this->host = val; __isset.host = true; } +std::ostream& operator<<(std::ostream& out, const Annotation& obj) +{ + obj.printTo(out); + return out; +} -const char* Annotation::ascii_fingerprint = "77D655C35F1C5F96E5B8E73F413F441D"; -const uint8_t Annotation::binary_fingerprint[16] = {0x77,0xD6,0x55,0xC3,0x5F,0x1C,0x5F,0x96,0xE5,0xB8,0xE7,0x3F,0x41,0x3F,0x44,0x1D}; uint32_t Annotation::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -264,7 +280,7 @@ uint32_t Annotation::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Annotation::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Annotation"); xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 1); @@ -282,7 +298,6 @@ uint32_t Annotation::write(::apache::thrift::protocol::TProtocol* oprot) const { } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -307,14 +322,13 @@ Annotation& Annotation::operator=(const Annotation& other3) { __isset = other3.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const Annotation& obj) { - using apache::thrift::to_string; +void Annotation::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Annotation("; - out << "timestamp=" << to_string(obj.timestamp); - out << ", " << "value=" << to_string(obj.value); - out << ", " << "host="; (obj.__isset.host ? (out << to_string(obj.host)) : (out << "")); + out << "timestamp=" << to_string(timestamp); + out << ", " << "value=" << to_string(value); + out << ", " << "host="; (__isset.host ? (out << to_string(host)) : (out << "")); out << ")"; - return out; } @@ -338,12 +352,16 @@ void BinaryAnnotation::__set_host(const Endpoint& val) { this->host = val; __isset.host = true; } +std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj) +{ + obj.printTo(out); + return out; +} -const char* BinaryAnnotation::ascii_fingerprint = "2958175D0B61AE00D73A812C2A801378"; -const uint8_t BinaryAnnotation::binary_fingerprint[16] = {0x29,0x58,0x17,0x5D,0x0B,0x61,0xAE,0x00,0xD7,0x3A,0x81,0x2C,0x2A,0x80,0x13,0x78}; uint32_t BinaryAnnotation::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -410,7 +428,7 @@ uint32_t BinaryAnnotation::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t BinaryAnnotation::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("BinaryAnnotation"); xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); @@ -432,7 +450,6 @@ uint32_t BinaryAnnotation::write(::apache::thrift::protocol::TProtocol* oprot) c } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -460,15 +477,14 @@ BinaryAnnotation& BinaryAnnotation::operator=(const BinaryAnnotation& other6) { __isset = other6.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj) { - using apache::thrift::to_string; +void BinaryAnnotation::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "BinaryAnnotation("; - out << "key=" << to_string(obj.key); - out << ", " << "value=" << to_string(obj.value); - out << ", " << "annotation_type=" << to_string(obj.annotation_type); - out << ", " << "host="; (obj.__isset.host ? (out << to_string(obj.host)) : (out << "")); + out << "key=" << to_string(key); + out << ", " << "value=" << to_string(value); + out << ", " << "annotation_type=" << to_string(annotation_type); + out << ", " << "host="; (__isset.host ? (out << to_string(host)) : (out << "")); out << ")"; - return out; } @@ -520,12 +536,16 @@ void Span::__set_trace_id_high(const int64_t val) { this->trace_id_high = val; __isset.trace_id_high = true; } +std::ostream& operator<<(std::ostream& out, const Span& obj) +{ + obj.printTo(out); + return out; +} -const char* Span::ascii_fingerprint = "C330BF2126606A01410464497BC83FE1"; -const uint8_t Span::binary_fingerprint[16] = {0xC3,0x30,0xBF,0x21,0x26,0x60,0x6A,0x01,0x41,0x04,0x64,0x49,0x7B,0xC8,0x3F,0xE1}; uint32_t Span::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -662,7 +682,7 @@ uint32_t Span::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Span"); xfer += oprot->writeFieldBegin("trace_id", ::apache::thrift::protocol::T_I64, 1); @@ -728,7 +748,6 @@ uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const { } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -774,21 +793,20 @@ Span& Span::operator=(const Span& other20) { __isset = other20.__isset; return *this; } -std::ostream& operator<<(std::ostream& out, const Span& obj) { - using apache::thrift::to_string; +void Span::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Span("; - out << "trace_id=" << to_string(obj.trace_id); - out << ", " << "name=" << to_string(obj.name); - out << ", " << "id=" << to_string(obj.id); - out << ", " << "parent_id="; (obj.__isset.parent_id ? (out << to_string(obj.parent_id)) : (out << "")); - out << ", " << "annotations=" << to_string(obj.annotations); - out << ", " << "binary_annotations=" << to_string(obj.binary_annotations); - out << ", " << "debug="; (obj.__isset.debug ? (out << to_string(obj.debug)) : (out << "")); - out << ", " << "timestamp="; (obj.__isset.timestamp ? (out << to_string(obj.timestamp)) : (out << "")); - out << ", " << "duration="; (obj.__isset.duration ? (out << to_string(obj.duration)) : (out << "")); - out << ", " << "trace_id_high="; (obj.__isset.trace_id_high ? (out << to_string(obj.trace_id_high)) : (out << "")); + out << "trace_id=" << to_string(trace_id); + out << ", " << "name=" << to_string(name); + out << ", " << "id=" << to_string(id); + out << ", " << "parent_id="; (__isset.parent_id ? (out << to_string(parent_id)) : (out << "")); + out << ", " << "annotations=" << to_string(annotations); + out << ", " << "binary_annotations=" << to_string(binary_annotations); + out << ", " << "debug="; (__isset.debug ? (out << to_string(debug)) : (out << "")); + out << ", " << "timestamp="; (__isset.timestamp ? (out << to_string(timestamp)) : (out << "")); + out << ", " << "duration="; (__isset.duration ? (out << to_string(duration)) : (out << "")); + out << ", " << "trace_id_high="; (__isset.trace_id_high ? (out << to_string(trace_id_high)) : (out << "")); out << ")"; - return out; } @@ -799,12 +817,16 @@ Response::~Response() throw() { void Response::__set_ok(const bool val) { this->ok = val; } +std::ostream& operator<<(std::ostream& out, const Response& obj) +{ + obj.printTo(out); + return out; +} -const char* Response::ascii_fingerprint = "5892306F7B861249AE8E27C8ED619593"; -const uint8_t Response::binary_fingerprint[16] = {0x58,0x92,0x30,0x6F,0x7B,0x86,0x12,0x49,0xAE,0x8E,0x27,0xC8,0xED,0x61,0x95,0x93}; uint32_t Response::read(::apache::thrift::protocol::TProtocol* iprot) { + ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); uint32_t xfer = 0; std::string fname; ::apache::thrift::protocol::TType ftype; @@ -848,7 +870,7 @@ uint32_t Response::read(::apache::thrift::protocol::TProtocol* iprot) { uint32_t Response::write(::apache::thrift::protocol::TProtocol* oprot) const { uint32_t xfer = 0; - oprot->incrementRecursionDepth(); + ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot); xfer += oprot->writeStructBegin("Response"); xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1); @@ -857,7 +879,6 @@ uint32_t Response::write(::apache::thrift::protocol::TProtocol* oprot) const { xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -873,12 +894,11 @@ Response& Response::operator=(const Response& other22) { ok = other22.ok; return *this; } -std::ostream& operator<<(std::ostream& out, const Response& obj) { - using apache::thrift::to_string; +void Response::printTo(std::ostream& out) const { + using ::apache::thrift::to_string; out << "Response("; - out << "ok=" << to_string(obj.ok); + out << "ok=" << to_string(ok); out << ")"; - return out; } }}} // namespace diff --git a/src/jaegertracing/thrift-gen/zipkincore_types.h b/src/jaegertracing/thrift-gen/zipkincore_types.h index 7bf50cf3..a4ad3d85 100644 --- a/src/jaegertracing/thrift-gen/zipkincore_types.h +++ b/src/jaegertracing/thrift-gen/zipkincore_types.h @@ -1,5 +1,5 @@ /** - * Autogenerated by Thrift Compiler (0.9.2) + * Autogenerated by Thrift Compiler (0.11.0) * * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING * @generated @@ -11,10 +11,11 @@ #include #include +#include #include #include -#include +#include namespace twitter { namespace zipkin { namespace thrift { @@ -33,6 +34,8 @@ struct AnnotationType { extern const std::map _AnnotationType_VALUES_TO_NAMES; +std::ostream& operator<<(std::ostream& out, const AnnotationType::type& val); + class Endpoint; class Annotation; @@ -51,12 +54,9 @@ typedef struct _Endpoint__isset { bool ipv6 :1; } _Endpoint__isset; -class Endpoint { +class Endpoint : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "66357C747F937372BB32913F3D70EB58"; - static const uint8_t binary_fingerprint[16]; // = {0x66,0x35,0x7C,0x74,0x7F,0x93,0x73,0x72,0xBB,0x32,0x91,0x3F,0x3D,0x70,0xEB,0x58}; - Endpoint(const Endpoint&); Endpoint& operator=(const Endpoint&); Endpoint() : ipv4(0), port(0), service_name(), ipv6() { @@ -101,11 +101,13 @@ class Endpoint { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Endpoint& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Endpoint &a, Endpoint &b); +std::ostream& operator<<(std::ostream& out, const Endpoint& obj); + typedef struct _Annotation__isset { _Annotation__isset() : timestamp(false), value(false), host(false) {} bool timestamp :1; @@ -113,12 +115,9 @@ typedef struct _Annotation__isset { bool host :1; } _Annotation__isset; -class Annotation { +class Annotation : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "77D655C35F1C5F96E5B8E73F413F441D"; - static const uint8_t binary_fingerprint[16]; // = {0x77,0xD6,0x55,0xC3,0x5F,0x1C,0x5F,0x96,0xE5,0xB8,0xE7,0x3F,0x41,0x3F,0x44,0x1D}; - Annotation(const Annotation&); Annotation& operator=(const Annotation&); Annotation() : timestamp(0), value() { @@ -158,11 +157,13 @@ class Annotation { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Annotation& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Annotation &a, Annotation &b); +std::ostream& operator<<(std::ostream& out, const Annotation& obj); + typedef struct _BinaryAnnotation__isset { _BinaryAnnotation__isset() : key(false), value(false), annotation_type(false), host(false) {} bool key :1; @@ -171,12 +172,9 @@ typedef struct _BinaryAnnotation__isset { bool host :1; } _BinaryAnnotation__isset; -class BinaryAnnotation { +class BinaryAnnotation : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "2958175D0B61AE00D73A812C2A801378"; - static const uint8_t binary_fingerprint[16]; // = {0x29,0x58,0x17,0x5D,0x0B,0x61,0xAE,0x00,0xD7,0x3A,0x81,0x2C,0x2A,0x80,0x13,0x78}; - BinaryAnnotation(const BinaryAnnotation&); BinaryAnnotation& operator=(const BinaryAnnotation&); BinaryAnnotation() : key(), value(), annotation_type((AnnotationType::type)0) { @@ -221,11 +219,13 @@ class BinaryAnnotation { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj); + virtual void printTo(std::ostream& out) const; }; void swap(BinaryAnnotation &a, BinaryAnnotation &b); +std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj); + typedef struct _Span__isset { _Span__isset() : trace_id(false), name(false), id(false), parent_id(false), annotations(false), binary_annotations(false), debug(true), timestamp(false), duration(false), trace_id_high(false) {} bool trace_id :1; @@ -240,12 +240,9 @@ typedef struct _Span__isset { bool trace_id_high :1; } _Span__isset; -class Span { +class Span : public virtual ::apache::thrift::TBase { public: - static const char* ascii_fingerprint; // = "C330BF2126606A01410464497BC83FE1"; - static const uint8_t binary_fingerprint[16]; // = {0xC3,0x30,0xBF,0x21,0x26,0x60,0x6A,0x01,0x41,0x04,0x64,0x49,0x7B,0xC8,0x3F,0xE1}; - Span(const Span&); Span& operator=(const Span&); Span() : trace_id(0), name(), id(0), parent_id(0), debug(false), timestamp(0), duration(0), trace_id_high(0) { @@ -328,17 +325,16 @@ class Span { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Span& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Span &a, Span &b); +std::ostream& operator<<(std::ostream& out, const Span& obj); -class Response { - public: - static const char* ascii_fingerprint; // = "5892306F7B861249AE8E27C8ED619593"; - static const uint8_t binary_fingerprint[16]; // = {0x58,0x92,0x30,0x6F,0x7B,0x86,0x12,0x49,0xAE,0x8E,0x27,0xC8,0xED,0x61,0x95,0x93}; +class Response : public virtual ::apache::thrift::TBase { + public: Response(const Response&); Response& operator=(const Response&); @@ -365,11 +361,13 @@ class Response { uint32_t read(::apache::thrift::protocol::TProtocol* iprot); uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - friend std::ostream& operator<<(std::ostream& out, const Response& obj); + virtual void printTo(std::ostream& out) const; }; void swap(Response &a, Response &b); +std::ostream& operator<<(std::ostream& out, const Response& obj); + }}} // namespace #endif diff --git a/src/jaegertracing/utils/Regex.cpp b/src/jaegertracing/utils/Regex.cpp deleted file mode 100644 index aa881676..00000000 --- a/src/jaegertracing/utils/Regex.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/* - * Copyright (c) 2017 Uber Technologies, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * 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. - */ - -#include "jaegertracing/utils/Regex.h" diff --git a/src/jaegertracing/utils/Regex.h b/src/jaegertracing/utils/Regex.h deleted file mode 100644 index a83d40eb..00000000 --- a/src/jaegertracing/utils/Regex.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2017 Uber Technologies, Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * 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. - */ - -#ifndef JAEGERTRACING_UTILS_REGEX_H -#define JAEGERTRACING_UTILS_REGEX_H - -#if (!defined(__GNUC__) || defined(__clang__) || __GNUC__ > 4 || \ - __GNUC_MINOR__ > 8) -#define JAEGERTRACING_USE_STD_REGEX 1 -#else -#define JAEGERTRACING_USE_STD_REGEX 0 -#endif - -#if JAEGERTRACING_USE_STD_REGEX -#include -#else -#include -#endif - -#if JAEGERTRACING_USE_STD_REGEX -namespace regex_namespace = std; -#else -namespace regex_namespace = boost; -#endif - -#endif // JAEGERTRACING_UTILS_REGEX_H diff --git a/src/jaegertracing/utils/UDPClient.cpp b/src/jaegertracing/utils/UDPClient.cpp index 5c6e8a42..da5a0178 100644 --- a/src/jaegertracing/utils/UDPClient.cpp +++ b/src/jaegertracing/utils/UDPClient.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Uber Technologies, Inc. + * Copyright (c) 2017-2018 Uber Technologies, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -36,7 +36,7 @@ UDPClient::UDPClient(const net::IPAddress& serverAddr, int maxPacketSize) _socket.open(AF_INET, SOCK_DGRAM); _socket.connect(_serverAddr); - boost::shared_ptr protocolFactory( + std::shared_ptr protocolFactory( new TCompactProtocolFactory()); auto protocol = protocolFactory->getProtocol(_buffer); _client.reset(new agent::thrift::AgentClient(protocol)); diff --git a/src/jaegertracing/utils/UDPClient.h b/src/jaegertracing/utils/UDPClient.h index aba417ef..56836f5f 100644 --- a/src/jaegertracing/utils/UDPClient.h +++ b/src/jaegertracing/utils/UDPClient.h @@ -75,7 +75,7 @@ class UDPClient : public agent::thrift::AgentIf { private: int _maxPacketSize; - boost::shared_ptr _buffer; + std::shared_ptr _buffer; net::Socket _socket; net::IPAddress _serverAddr; std::unique_ptr _client;