diff --git a/.gitignore b/.gitignore index 62578103..3894c86d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,8 @@ cmake_install.cmake Makefile /generated CMakeCache.txt +libjaegertracing.so.* +compile_commands.json # vim swap files *.swo diff --git a/CMakeLists.txt b/CMakeLists.txt index a2d72b22..2a59bb7c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,7 +49,7 @@ hunter_add_package(Boost COMPONENTS regex) find_package(Boost ${hunter_config} REQUIRED regex) hunter_add_package(thrift) -find_package(thrift 0.9.2 ${hunter_config} EXACT REQUIRED) +find_package(thrift 0.11.0 ${hunter_config} EXACT REQUIRED) hunter_add_package(opentracing-cpp) # Not `${hunter_config}` because OpenTracing provides its own @@ -124,4 +124,3 @@ if (BUILD_TESTING) endif() add_subdirectory(src/jaegertracing) -add_subdirectory(crossdock) diff --git a/README.md b/README.md index 6d3d01e2..c2d847ee 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,8 @@ The code can be re-generated with git submodule init git submodule update - find idl/thrift/ -type f -name \*.thrift -exec thrift -gen cpp -out src/jaegertracing/thrift-gen {} \; + sed -i '/zipkin/d' idl/thrift/agent.thrift + find idl/thrift/ -type f -name \*.thrift -not -name tracetest.thrift -not -name zipkincore.thrift -exec thrift -gen cpp -out src/jaegertracing/thrift-gen {} \; but at time of writing (Thrift 0.11.0) the resulting code is invalid due to https://issues.apache.org/jira/browse/THRIFT-4484 diff --git a/crossdock/CMakeLists.txt b/crossdock/CMakeLists.txt deleted file mode 100644 index 79465909..00000000 --- a/crossdock/CMakeLists.txt +++ /dev/null @@ -1,38 +0,0 @@ -cmake_minimum_required(VERSION 3.3) - -project(jaegertracing_crossdock LANGUAGES CXX) - -if(JAEGERTRACING_BUILD_CROSSDOCK) - add_executable(crossdock Server.cpp) - 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} "${CMAKE_CURRENT_BINARY_DIR}/jaeger-docker-compose.yml") - find_program(DOCKER_COMPOSE_EXE docker-compose) - if (NOT DOCKER_COMPOSE_EXE) - message(WARNING "cannot build crossdock support requested by -DJAEGERTRACING_BUILD_CROSSDOCK: docker-compose not found") - else() - set(DOCKER_COMPOSE_CMD ${DOCKER_COMPOSE_EXE} - -f "${CMAKE_CURRENT_SOURCE_DIR}/docker-compose.yml" - -f "${CMAKE_CURRENT_BINARY_DIR}/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) - message(STATUS "crossdock enabled, use 'make crossdock-run'") - endif() -endif() diff --git a/crossdock/Dockerfile b/crossdock/Dockerfile deleted file mode 100644 index 76c56e83..00000000 --- a/crossdock/Dockerfile +++ /dev/null @@ -1,18 +0,0 @@ -FROM gcc:7.2 - -WORKDIR / -RUN curl -O https://cmake.org/files/v3.10/cmake-3.10.0-rc5-Linux-x86_64.sh && bash cmake-3.10.0-rc5-Linux-x86_64.sh --skip-license - -COPY . /app/jaegertracing -RUN rm -rf /app/jaegertracing/build && \ - mkdir /app/jaegertracing/build && \ - cd /app/jaegertracing/build && \ - cmake -DCMAKE_BUILD_TYPE=Debug -DJAEGERTRACING_BUILD_CROSSDOCK=ON .. && \ - make crossdock -j3 - -ENV AGENT_HOST_PORT=jaeger-agent:5775 -ENV SAMPLING_SERVER_URL=http://test_driver:5778/sampling - -EXPOSE 8080-8082 - -CMD ["/app/jaegertracing/build/crossdock"] diff --git a/crossdock/Server.cpp b/crossdock/Server.cpp deleted file mode 100644 index fb924c5d..00000000 --- a/crossdock/Server.cpp +++ /dev/null @@ -1,789 +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 "Server.h" - -#include -#include -#include -#include -#include - -#include - -#include "jaegertracing/Tracer.h" -#include "jaegertracing/net/IPAddress.h" -#include "jaegertracing/net/Socket.h" -#include "jaegertracing/net/http/Request.h" -#include "jaegertracing/net/http/Response.h" - -namespace jaegertracing { -namespace crossdock { -namespace thrift { - -#define JSON_FROM_FIELD(var, field) \ - { \ - json[#field] = var.field; \ - } - -#define FIELD_FROM_JSON(var, field) \ - { \ - var.__set_##field(json.at(#field)); \ - } - -void to_json(nlohmann::json& json, const Transport::type& transport) -{ - json = _Transport_VALUES_TO_NAMES.at(static_cast(transport)); -} - -void from_json(const nlohmann::json& json, Transport::type& transport) -{ - const auto str = json.get(); - if (str == "HTTP") { - transport = Transport::HTTP; - return; - } - if (str == "TCHANNEL") { - transport = Transport::TCHANNEL; - return; - } - if (str == "DUMMY") { - transport = Transport::DUMMY; - return; - } - std::ostringstream oss; - oss << "Invalid transport value " << str; - throw std::invalid_argument(oss.str()); -} - -void to_json(nlohmann::json& json, const Downstream& downstream) -{ - JSON_FROM_FIELD(downstream, serviceName); - JSON_FROM_FIELD(downstream, serverRole); - JSON_FROM_FIELD(downstream, host); - JSON_FROM_FIELD(downstream, port); - JSON_FROM_FIELD(downstream, transport); - if (downstream.downstream) { - json["downstream"] = *downstream.downstream; - } -} - -void from_json(const nlohmann::json& json, Downstream& downstream) -{ - FIELD_FROM_JSON(downstream, serviceName); - FIELD_FROM_JSON(downstream, serverRole); - FIELD_FROM_JSON(downstream, host); - FIELD_FROM_JSON(downstream, port); - 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()); - } -} - -void to_json(nlohmann::json& json, const StartTraceRequest& request) -{ - JSON_FROM_FIELD(request, serverRole); - JSON_FROM_FIELD(request, sampled); - JSON_FROM_FIELD(request, baggage); - JSON_FROM_FIELD(request, downstream); -} - -void from_json(const nlohmann::json& json, StartTraceRequest& request) -{ - FIELD_FROM_JSON(request, serverRole); - FIELD_FROM_JSON(request, sampled); - FIELD_FROM_JSON(request, baggage); - FIELD_FROM_JSON(request, downstream); -} - -void to_json(nlohmann::json& json, const JoinTraceRequest& request) -{ - JSON_FROM_FIELD(request, serverRole); - if (request.__isset.downstream) { - json["downstream"] = request.downstream; - } -} - -void from_json(const nlohmann::json& json, JoinTraceRequest& request) -{ - FIELD_FROM_JSON(request, serverRole); - auto itr = json.find("downstream"); - if (itr != std::end(json) && !itr->is_null()) { - request.__set_downstream(itr->get()); - } -} - -void to_json(nlohmann::json& json, const ObservedSpan& observedSpan) -{ - JSON_FROM_FIELD(observedSpan, traceId); - JSON_FROM_FIELD(observedSpan, sampled); - JSON_FROM_FIELD(observedSpan, baggage); -} - -void from_json(const nlohmann::json& json, ObservedSpan& observedSpan) -{ - FIELD_FROM_JSON(observedSpan, traceId); - FIELD_FROM_JSON(observedSpan, sampled); - FIELD_FROM_JSON(observedSpan, baggage); -} - -void to_json(nlohmann::json& json, const TraceResponse& response) -{ - if (response.__isset.span) { - JSON_FROM_FIELD(response, span); - } - if (response.downstream) { - json["downstream"] = *response.downstream; - } - JSON_FROM_FIELD(response, notImplementedError); -} - -void from_json(const nlohmann::json& json, TraceResponse& response) -{ - auto itr = json.find("span"); - if (itr != std::end(json) && !itr->is_null()) { - response.__set_span(itr->get()); - } - itr = json.find("downstream"); - if (itr != std::end(json) && !itr->is_null()) { - response.__set_downstream(itr->get()); - } - FIELD_FROM_JSON(response, notImplementedError); -} - -#undef FIELD_FROM_JSON -#undef JSON_FROM_FIELD - -} // namespace thrift - -namespace { - -constexpr auto kBaggageKey = "crossdock-baggage-key"; -constexpr auto kDefaultTracerServiceName = "crossdock-cpp"; - -std::string escape(const std::string& str) -{ - std::string result; - result.reserve(str.size()); - for (auto&& ch : str) { - switch (ch) { - case '\n': { - result += "\\n"; - } break; - case '\r': { - result += "\\r"; - } break; - default: { - result += ch; - } break; - } - } - return result; -} - -std::string bufferedRead(net::Socket& socket) -{ - constexpr auto kBufferSize = 256; - std::array buffer; - std::string data; - auto numRead = ::read(socket.handle(), &buffer[0], buffer.size()); - data.append(&buffer[0], numRead); - while (numRead == kBufferSize) { - numRead = ::read(socket.handle(), &buffer[0], buffer.size()); - data.append(&buffer[0], numRead); - } - return data; -} - -class RequestReader : public opentracing::HTTPHeadersReader { - public: - explicit RequestReader(const net::http::Request& request) - : _request(request) - { - } - - opentracing::expected ForeachKey( - std::function(opentracing::string_view, - opentracing::string_view)> f) - const override - { - for (auto&& header : _request.headers()) { - const auto result = f(header.key(), header.value()); - if (!result) { - return result; - } - } - return opentracing::make_expected(); - } - - private: - const net::http::Request& _request; -}; - -class RequestWriter : public opentracing::HTTPHeadersWriter { - public: - explicit RequestWriter(std::ostream& requestStream) - : _requestStream(requestStream) - { - } - - opentracing::expected - Set(opentracing::string_view key, - opentracing::string_view value) const override - { - _requestStream << key << ": " << value << "\r\n"; - return opentracing::make_expected(); - } - - private: - std::ostream& _requestStream; -}; - -thrift::ObservedSpan observeSpan(const opentracing::SpanContext& ctx) -{ - const auto& sc = static_cast(ctx); - thrift::ObservedSpan observedSpan; - std::ostringstream oss; - oss << sc.traceID(); - observedSpan.__set_traceId(oss.str()); - observedSpan.__set_sampled(sc.isSampled()); - auto itr = sc.baggage().find(kBaggageKey); - if (itr != std::end(sc.baggage())) { - observedSpan.__set_baggage(itr->second); - } - return observedSpan; -} - -thrift::TraceResponse callDownstreamHTTP(const opentracing::SpanContext& ctx, - const thrift::Downstream& target, - opentracing::Tracer& tracer, - logging::Logger& logger) -{ - thrift::JoinTraceRequest request; - request.__set_serverRole(target.serverRole); - if (target.downstream) { - request.__set_downstream(*target.downstream); - } - - const auto requestJSON = nlohmann::json(request).dump(); - net::Socket socket; - socket.open(AF_INET, SOCK_STREAM); - const auto authority = target.host + ':' + target.port; - socket.connect("http://" + authority); - std::ostringstream oss; - oss << "POST /join_trace HTTP/1.1\r\n" - "Host: " - << authority << "\r\n"; - RequestWriter writer(oss); - tracer.Inject(ctx, writer); - oss << "Connection: close\r\n" - "Content-Type: application/json\r\n" - "Content-Length: " - << requestJSON.size() << "\r\n\r\n" - << requestJSON; - const auto message = oss.str(); - logger.info("Sending request downstream: " + escape(message)); - const auto numWritten = - ::write(socket.handle(), &message[0], message.size()); - (void)numWritten; - - const auto responseStr = bufferedRead(socket); - logger.info("Received downstream response: " + escape(responseStr)); - std::istringstream iss(responseStr); - auto response = net::http::Response::parse(iss); - return nlohmann::json::parse(response.body()); -} - -thrift::TraceResponse callDownstream(const opentracing::SpanContext& ctx, - const std::string& /* role */, - const thrift::Downstream& downstream, - opentracing::Tracer& tracer, - logging::Logger& logger) -{ - thrift::TraceResponse response; - - switch (downstream.transport) { - case thrift::Transport::HTTP: { - response = callDownstreamHTTP(ctx, downstream, tracer, logger); - } break; - case thrift::Transport::TCHANNEL: { - response.__set_notImplementedError( - "TCHANNEL transport not implemented"); - } break; - case thrift::Transport::DUMMY: { - response.__set_notImplementedError("DUMMY transport not implemented"); - } break; - default: { - throw std::invalid_argument("Unrecognized protocol " + - std::to_string(downstream.transport)); - } break; - } - - return response; -} - -thrift::TraceResponse prepareResponse(const opentracing::SpanContext& ctx, - const std::string& role, - const thrift::Downstream* downstream, - opentracing::Tracer& tracer, - logging::Logger& logger) -{ - const auto observedSpan = observeSpan(ctx); - thrift::TraceResponse response; - response.__set_span(observedSpan); - if (downstream) { - response.__set_downstream( - callDownstream(ctx, role, *downstream, tracer, logger)); - } - return response; -} - -struct GenerateTracesRequest { - using StrMap = std::unordered_map; - - std::string _type; - std::string _operation; - StrMap _tags; - int _count; -}; - -void from_json(const nlohmann::json& json, GenerateTracesRequest& request) -{ - request._type = json.at("type"); - request._operation = json.at("operation"); - request._tags = json.at("tags").get(); - request._count = json.at("count"); -} - -} // anonymous namespace - -using Handler = std::function; - -class Server::SocketListener { - public: - SocketListener(const net::IPAddress& ip, - const std::shared_ptr& logger, - Handler handler) - : _ip(ip) - , _logger(logger) - , _handler(handler) - , _running(false) - { - assert(_logger); - } - - ~SocketListener() { stop(); } - - void start() - { - std::promise started; - _thread = std::thread([this, &started]() { start(_ip, started); }); - started.get_future().get(); - } - - void stop() noexcept - { - if (_running) { - _running = false; - _thread.join(); - _socket.close(); - } - } - - private: - void start(const net::IPAddress& ip, std::promise& started) - { - _socket.open(AF_INET, SOCK_STREAM); - const auto enable = 1; - ::setsockopt(_socket.handle(), - SOL_SOCKET, - SO_REUSEADDR, - &enable, - sizeof(enable)); - _socket.bind(ip); - _socket.listen(); - _running = true; - started.set_value(); - - using TaskList = std::deque>; - TaskList tasks; - - while (_running) { - auto client = _socket.accept(); - auto future = std::async( - std::launch::async, - [this](net::Socket&& socket) { - net::Socket client(std::move(socket)); - auto requestStr = bufferedRead(client); - _logger->info("Received request: " + escape(requestStr)); - - try { - std::istringstream iss(requestStr); - const auto request = net::http::Request::parse(iss); - const auto responseStr = _handler(request); - const auto numWritten = ::write(client.handle(), - &responseStr[0], - responseStr.size()); - if (numWritten != - static_cast(responseStr.size())) { - std::ostringstream oss; - oss << "Unable to write entire response" - ", numWritten=" - << numWritten - << ", responseSize=" << responseStr.size(); - _logger->error(oss.str()); - } - } catch (...) { - utils::ErrorUtil::logError(*_logger, "Server error"); - constexpr auto message = - "HTTP/1.1 500 Internal Server Error\r\n\r\n"; - constexpr auto messageSize = sizeof(message) - 1; - const auto numWritten = - ::write(client.handle(), message, messageSize); - (void)numWritten; - } - - client.close(); - }, - std::move(client)); - tasks.emplace_back(std::move(future)); - } - - std::for_each(std::begin(tasks), - std::end(tasks), - [](TaskList::value_type& future) { future.get(); }); - } - - net::IPAddress _ip; - net::Socket _socket; - std::shared_ptr _logger; - Handler _handler; - std::atomic _running; - std::thread _thread; -}; - -class Server::EndToEndHandler { - public: - using TracerPtr = std::shared_ptr; - - EndToEndHandler(const std::string& agentHostPort, - const std::string& samplingServerURL) - : _agentHostPort(agentHostPort) - , _samplingServerURL(samplingServerURL) - { - } - - TracerPtr findOrMakeTracer(std::string samplerType) - { - if (samplerType.empty()) { - samplerType = kSamplerTypeRemote; - } - - std::lock_guard lock(_mutex); - auto itr = _tracers.find(samplerType); - if (itr != std::end(_tracers)) { - return itr->second; - } - return init(samplerType); - } - - private: - Config makeEndToEndConfig(const std::string& samplerType) const - { - return Config(false, - samplers::Config(samplerType, - 1.0, - _samplingServerURL, - samplers::Config::kDefaultMaxOperations, - std::chrono::seconds(5)), - reporters::Config(reporters::Config::kDefaultQueueSize, - std::chrono::seconds(1), - false, - _agentHostPort)); - } - - TracerPtr init(const std::string& samplerType) - { - const auto config = makeEndToEndConfig(samplerType); - auto tracer = Tracer::make(kDefaultTracerServiceName, config); - _tracers[config.sampler().type()] = tracer; - return tracer; - } - - std::string _agentHostPort; - std::string _samplingServerURL; - std::unordered_map _tracers; - std::mutex _mutex; -}; - -Server::Server(const net::IPAddress& clientIP, - const net::IPAddress& serverIP, - const std::string& agentHostPort, - const std::string& samplingServerURL) - : _logger(logging::consoleLogger()) - , _tracer(Tracer::make(kDefaultTracerServiceName, Config(), _logger)) - , _clientListener( - new SocketListener(clientIP, - _logger, - [this](const net::http::Request& request) { - return handleRequest(request); - })) - , _serverListener( - new SocketListener(serverIP, - _logger, - [this](const net::http::Request& request) { - return handleRequest(request); - })) - , _handler(new EndToEndHandler(agentHostPort, samplingServerURL)) -{ -} - -Server::~Server() = default; - -void Server::serve() -{ - _clientListener->start(); - _serverListener->start(); -} - -template -std::string Server::handleJSON( - const net::http::Request& request, - std::function handler) -{ - RequestReader reader(request); - auto result = _tracer->Extract(reader); - if (!result) { - std::ostringstream oss; - oss << "Cannot read request body: opentracing error code " - << result.error().value(); - const auto message = oss.str(); - oss.str(""); - oss.clear(); - oss << "HTTP/1.1 400 Bad Request\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - } - - std::unique_ptr ctx(result->release()); - opentracing::StartSpanOptions options; - options.start_system_timestamp = std::chrono::system_clock::now(); - options.start_steady_timestamp = std::chrono::steady_clock::now(); - if (ctx) { - options.references.emplace_back(std::make_pair( - opentracing::SpanReferenceType::ChildOfRef, ctx.get())); - } - auto span = _tracer->StartSpanWithOptions("post", options); - - RequestType thriftRequest; - try { - thriftRequest = nlohmann::json::parse(request.body()); - } catch (const std::exception& ex) { - std::ostringstream oss; - oss << "Cannot parse request JSON: " << ex.what() - << ", json: " << request.body(); - const auto message = oss.str(); - oss.str(""); - oss.clear(); - oss << "HTTP/1.1 500 Internal Server Error\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } catch (...) { - std::ostringstream oss; - oss << "Cannot parse request JSON, json: " << request.body(); - const auto message = oss.str(); - oss.str(""); - oss.clear(); - oss << "HTTP/1.1 500 Internal Server Error\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } - - const auto thriftResponse = handler(thriftRequest, span->context()); - try { - const auto message = nlohmann::json(thriftResponse).dump(); - std::ostringstream oss; - oss << "HTTP/1.1 200 OK\r\n" - "Content-Type: application/json\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } catch (const std::exception& ex) { - std::ostringstream oss; - oss << "Cannot marshal response to JSON: " << ex.what(); - const auto message = oss.str(); - oss.str(""); - oss.clear(); - oss << "HTTP/1.1 500 Internal Server Error\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } catch (...) { - std::ostringstream oss; - oss << "Cannot marshal response to JSON"; - const auto message = oss.str(); - oss.str(""); - oss.clear(); - oss << "HTTP/1.1 500 Internal Server Error\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } -} - -std::string Server::handleRequest(const net::http::Request& request) -{ - if (request.target() == "/") { - return "HTTP/1.1 200 OK\r\n\r\n"; - } - if (request.target() == "/start_trace") { - return handleJSON( - request, - [this](const thrift::StartTraceRequest& request, - const opentracing::SpanContext& /* ctx */) { - return startTrace(request); - }); - } - if (request.target() == "/join_trace") { - return handleJSON( - request, - [this](const thrift::JoinTraceRequest& request, - const opentracing::SpanContext& ctx) { - return joinTrace(request, ctx); - }); - } - if (request.target() == "/create_traces") { - return generateTraces(request); - } - return "HTTP/1.1 404 Not Found\r\n\r\n"; -} - -thrift::TraceResponse -Server::startTrace(const crossdock::thrift::StartTraceRequest& request) -{ - auto span = _tracer->StartSpan(request.serverRole); - if (request.sampled) { - span->SetTag("sampling.priority", 1); - } - span->SetBaggageItem(kBaggageKey, request.baggage); - - return prepareResponse(span->context(), - request.serverRole, - &request.downstream, - *_tracer, - *_logger); -} - -thrift::TraceResponse -Server::joinTrace(const crossdock::thrift::JoinTraceRequest& request, - const opentracing::SpanContext& ctx) -{ - return prepareResponse(ctx, - request.serverRole, - request.__isset.downstream ? &request.downstream - : nullptr, - *_tracer, - *_logger); -} - -std::string Server::generateTraces(const net::http::Request& requestHTTP) -{ - GenerateTracesRequest request; - try { - request = nlohmann::json::parse(requestHTTP.body()); - } catch (const std::exception& ex) { - std::ostringstream oss; - oss << "JSON payload is invalid: " << ex.what(); - const auto message = oss.str(); - oss.str(""); - oss.clear(); - oss << "HTTP/1.1 400 Bad Request\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } catch (...) { - const std::string message("JSON payload is invalid"); - std::ostringstream oss; - oss << "HTTP/1.1 400 Bad Request\r\n" - "Content-Length: " - << message.size() << "\r\n\r\n" - << message; - return oss.str(); - } - - auto tracer = _handler->findOrMakeTracer(request._type); - if (!tracer) { - const std::string message("Tracer is not initialized"); - std::ostringstream oss; - oss << "HTTP/1.1 500 Internal Server Error\r\n" - "Content-Length: " - << message.size() << "\r\n" - << message; - return oss.str(); - } - - for (auto i = 0; i < request._count; ++i) { - auto span = tracer->StartSpan(request._operation); - for (auto&& pair : request._tags) { - span->SetTag(pair.first, pair.second); - } - span->Finish(); - } - - return "HTTP/1.1 200 OK\r\n\r\n"; -} - -} // namespace crossdock -} // namespace jaegertracing - -int main() -{ - const auto rawAgentHostPort = std::getenv("AGENT_HOST_PORT"); - const std::string agentHostPort(rawAgentHostPort ? rawAgentHostPort : ""); - if (agentHostPort.empty()) { - std::cerr << "env AGENT_HOST_PORT is not specified!\n"; - return 1; - } - - const auto rawSamplingServerURL = std::getenv("SAMPLING_SERVER_URL"); - const std::string samplingServerURL( - rawSamplingServerURL ? rawSamplingServerURL : ""); - if (samplingServerURL.empty()) { - std::cerr << "env SAMPLING_SERVER_URL is not specified!\n"; - return 1; - } - - jaegertracing::crossdock::Server server( - jaegertracing::net::IPAddress::v4("0.0.0.0:8080"), - jaegertracing::net::IPAddress::v4("0.0.0.0:8081"), - agentHostPort, - samplingServerURL); - server.serve(); - - std::this_thread::sleep_for(std::chrono::hours(1)); - return 0; -} diff --git a/crossdock/Server.h b/crossdock/Server.h deleted file mode 100644 index f88b8ae6..00000000 --- a/crossdock/Server.h +++ /dev/null @@ -1,86 +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_CROSSDOCK_SERVER_H -#define JAEGERTRACING_CROSSDOCK_SERVER_H - -#include - -#include - -#include "jaegertracing/thrift-gen/tracetest_types.h" - -namespace jaegertracing { -namespace logging { - -class Logger; - -} // namespace logging - -namespace net { - -class IPAddress; - -namespace http { - -class Request; - -} // namespace http -} // namespace net - -namespace crossdock { - -class Server { - public: - Server(const net::IPAddress& clientIP, - const net::IPAddress& serverIP, - const std::string& agentHostPort, - const std::string& samplingServerURL); - - ~Server(); - - void serve(); - - private: - template - std::string handleJSON( - const net::http::Request& request, - std::function handler); - - std::string handleRequest(const net::http::Request& request); - - thrift::TraceResponse startTrace(const thrift::StartTraceRequest& request); - - thrift::TraceResponse joinTrace(const thrift::JoinTraceRequest& request, - const opentracing::SpanContext& ctx); - - std::string generateTraces(const net::http::Request& request); - - class SocketListener; - class EndToEndHandler; - - std::shared_ptr _logger; - std::shared_ptr _tracer; - std::unique_ptr _clientListener; - std::unique_ptr _serverListener; - std::unique_ptr _handler; -}; - -} // namespace crossdock -} // namespace jaegertracing - -#endif // JAEGERTRACING_CROSSDOCK_SERVER_H diff --git a/crossdock/docker-compose.yml b/crossdock/docker-compose.yml deleted file mode 100644 index 1ab6faf2..00000000 --- a/crossdock/docker-compose.yml +++ /dev/null @@ -1,54 +0,0 @@ -version: '2' - -services: - crossdock: - image: crossdock/crossdock - links: - - test_driver - - go - - cpp - environment: - - WAIT_FOR=test_driver,go,cpp - - WAIT_FOR_TIMEOUT=60s - - - CALL_TIMEOUT=60s - - - AXIS_CLIENT=go - - AXIS_S1NAME=go,cpp - - AXIS_SAMPLED=true,false - - AXIS_S2NAME=go,cpp - - AXIS_S2TRANSPORT=http - - AXIS_S3NAME=go,cpp - - AXIS_S3TRANSPORT=http - - - BEHAVIOR_TRACE=client,s1name,sampled,s2name,s2transport,s3name,s3transport - - - AXIS_TESTDRIVER=test_driver - - AXIS_SERVICES=cpp - - - BEHAVIOR_ENDTOEND=testdriver,services - - - REPORT=compact - - go: - image: jaegertracing/xdock-go - ports: - - "8080-8082" - - cpp: - depends_on: - - test_driver - build: - context: .. - dockerfile: crossdock/Dockerfile - ports: - - "8080-8082" - - test_driver: - image: jaegertracing/test-driver - depends_on: - - jaeger-query - - jaeger-collector - - jaeger-agent - ports: - - "8080" diff --git a/src/jaegertracing/.gitignore b/src/jaegertracing/.gitignore index 51b5bc66..1ab6b4b4 100644 --- a/src/jaegertracing/.gitignore +++ b/src/jaegertracing/.gitignore @@ -1,2 +1,3 @@ Constants.h thrift-gen/*.skeleton.cpp +/shortlived diff --git a/src/jaegertracing/CMakeLists.txt b/src/jaegertracing/CMakeLists.txt index 26b7896e..3b5d2e09 100644 --- a/src/jaegertracing/CMakeLists.txt +++ b/src/jaegertracing/CMakeLists.txt @@ -70,8 +70,6 @@ set(SRC thrift-gen/Collector.cpp thrift-gen/Dependency.cpp thrift-gen/SamplingManager.cpp - thrift-gen/TracedService.cpp - thrift-gen/ZipkinCollector.cpp thrift-gen/agent_constants.cpp thrift-gen/agent_types.cpp thrift-gen/aggregation_validator_constants.cpp @@ -84,10 +82,6 @@ set(SRC thrift-gen/jaeger_types.cpp thrift-gen/sampling_constants.cpp thrift-gen/sampling_types.cpp - thrift-gen/tracetest_constants.cpp - thrift-gen/tracetest_types.cpp - thrift-gen/zipkincore_constants.cpp - thrift-gen/zipkincore_types.cpp utils/ErrorUtil.cpp utils/HexParsing.cpp utils/RateLimiter.cpp diff --git a/src/jaegertracing/Constants.h.in b/src/jaegertracing/Constants.h.in index c5b90f55..da5f0c66 100644 --- a/src/jaegertracing/Constants.h.in +++ b/src/jaegertracing/Constants.h.in @@ -40,4 +40,6 @@ static constexpr auto kSamplerTypeLowerBound = "lowerbound"; } // namespace jaegertracing +#include "jaegertracing/jaeger_smartptr.h" + #endif // JAEGERTRACING_CONSTANTS_H diff --git a/src/jaegertracing/UDPTransport.cpp b/src/jaegertracing/UDPTransport.cpp index 57952ddc..4278dc93 100644 --- a/src/jaegertracing/UDPTransport.cpp +++ b/src/jaegertracing/UDPTransport.cpp @@ -16,6 +16,7 @@ #include "jaegertracing/UDPTransport.h" +#include "jaegertracing/jaeger_smartptr.h" #include "jaegertracing/Span.h" #include "jaegertracing/Tag.h" #include "jaegertracing/Tracer.h" @@ -32,6 +33,8 @@ namespace net { class IPAddress; } // namespace net +using namespace jaegertracing::stdcxx; + namespace { constexpr auto kEmitBatchOverhead = 30; @@ -39,7 +42,7 @@ constexpr auto kEmitBatchOverhead = 30; template int calcSizeOfSerializedThrift(const ThriftType& base, int maxPacketSize) { - boost::shared_ptr buffer( + 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 6712eeb2..69059adc 100644 --- a/src/jaegertracing/UDPTransport.h +++ b/src/jaegertracing/UDPTransport.h @@ -47,7 +47,7 @@ class UDPTransport : public Transport { int _maxSpanBytes; int _byteBufferSize; std::vector _spanBuffer; - boost::shared_ptr _protocol; + jaegertracing::stdcxx::shared_ptr _protocol; thrift::Process _process; int _processByteSize; }; diff --git a/src/jaegertracing/jaeger_smartptr.h b/src/jaegertracing/jaeger_smartptr.h new file mode 100644 index 00000000..f82c5387 --- /dev/null +++ b/src/jaegertracing/jaeger_smartptr.h @@ -0,0 +1,39 @@ +#ifndef JAEGER_SMARTPTR_H +#define JAEGER_SMARTPTR_H + +#if defined(JAEGER_USE_BOOST_SMART_PTR) +#include +#else +#include +#endif + +namespace jaegertracing { namespace stdcxx { + +/* Borrowed from Apache Thrift */ +#if defined(JAEGER_USE_BOOST_SMART_PTR) + + using ::boost::const_pointer_cast; + using ::boost::dynamic_pointer_cast; + using ::boost::enable_shared_from_this; + using ::boost::make_shared; + using ::boost::scoped_ptr; + using ::boost::shared_ptr; + using ::boost::static_pointer_cast; + using ::boost::weak_ptr; + +#else + + using ::std::const_pointer_cast; + using ::std::dynamic_pointer_cast; + using ::std::enable_shared_from_this; + using ::std::make_shared; + template using scoped_ptr = std::unique_ptr; + using ::std::shared_ptr; + using ::std::static_pointer_cast; + using ::std::weak_ptr; + +#endif + +}} + +#endif diff --git a/src/jaegertracing/testutils/MockAgent.cpp b/src/jaegertracing/testutils/MockAgent.cpp index 57091c15..174e8bdf 100644 --- a/src/jaegertracing/testutils/MockAgent.cpp +++ b/src/jaegertracing/testutils/MockAgent.cpp @@ -31,6 +31,8 @@ #include "jaegertracing/utils/Regex.h" #include "jaegertracing/utils/UDPClient.h" +using namespace jaegertracing::stdcxx; + namespace jaegertracing { namespace testutils { namespace { @@ -90,14 +92,19 @@ void MockAgent::serveUDP(std::promise& started) apache::thrift::protocol::TCompactProtocolFactory; using TMemoryBuffer = apache::thrift::transport::TMemoryBuffer; +#if defined(JAEGER_USE_BOOST_SMART_PTR) // 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(); }); +#else + std::shared_ptr iface { shared_from_this() }; +#endif + agent::thrift::AgentProcessor handler(iface); TCompactProtocolFactory protocolFactory; - boost::shared_ptr trans( + shared_ptr trans( new TMemoryBuffer(net::kUDPPacketMaxLength)); // Notify main thread that setup is done. diff --git a/src/jaegertracing/testutils/MockAgent.h b/src/jaegertracing/testutils/MockAgent.h index ae063f17..5a567532 100644 --- a/src/jaegertracing/testutils/MockAgent.h +++ b/src/jaegertracing/testutils/MockAgent.h @@ -40,13 +40,6 @@ namespace baggage { class Restriction; } // namespace baggage } // namespace jaegertracing -namespace twitter { -namespace zipkin { -namespace thrift { -class Span; -} // namespace thrift -} // namespace zipkin -} // namespace twitter namespace jaegertracing { namespace testutils { @@ -70,12 +63,6 @@ class MockAgent : public agent::thrift::AgentIf, void close(); - void - emitZipkinBatch(const std::vector&) override - { - throw std::logic_error("emitZipkinBatch not implemented"); - } - void emitBatch(const thrift::Batch& batch) override; bool isServingUDP() const { return _servingUDP; } diff --git a/src/jaegertracing/thrift-gen/Agent.cpp b/src/jaegertracing/thrift-gen/Agent.cpp index 22ca2375..4a907ac2 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 @@ -9,120 +9,13 @@ namespace jaegertracing { namespace agent { namespace thrift { -Agent_emitZipkinBatch_args::~Agent_emitZipkinBatch_args() throw() { -} - - -uint32_t Agent_emitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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_LIST) { - { - this->spans.clear(); - uint32_t _size0; - ::apache::thrift::protocol::TType _etype3; - xfer += iprot->readListBegin(_etype3, _size0); - this->spans.resize(_size0); - uint32_t _i4; - for (_i4 = 0; _i4 < _size0; ++_i4) - { - xfer += this->spans[_i4].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.spans = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t Agent_emitZipkinBatch_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("Agent_emitZipkinBatch_args"); - - xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->spans.size())); - std::vector< ::twitter::zipkin::thrift::Span> ::const_iterator _iter5; - for (_iter5 = this->spans.begin(); _iter5 != this->spans.end(); ++_iter5) - { - xfer += (*_iter5).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -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(); - xfer += oprot->writeStructBegin("Agent_emitZipkinBatch_pargs"); - - xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->spans)).size())); - std::vector< ::twitter::zipkin::thrift::Span> ::const_iterator _iter6; - for (_iter6 = (*(this->spans)).begin(); _iter6 != (*(this->spans)).end(); ++_iter6) - { - xfer += (*_iter6).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - 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 +56,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 +65,6 @@ uint32_t Agent_emitBatch_args::write(::apache::thrift::protocol::TProtocol* opro xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } @@ -183,7 +75,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,29 +84,9 @@ uint32_t Agent_emitBatch_pargs::write(::apache::thrift::protocol::TProtocol* opr xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); return xfer; } -void AgentClient::emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) -{ - send_emitZipkinBatch(spans); -} - -void AgentClient::send_emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) -{ - int32_t cseqid = 0; - 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(); -} - void AgentClient::emitBatch(const ::jaegertracing::thrift::Batch& batch) { send_emitBatch(batch); @@ -253,43 +125,6 @@ bool AgentProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, return true; } -void AgentProcessor::process_emitZipkinBatch(int32_t, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol*, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("Agent.emitZipkinBatch", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Agent.emitZipkinBatch"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "Agent.emitZipkinBatch"); - } - - Agent_emitZipkinBatch_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "Agent.emitZipkinBatch", bytes); - } - - try { - iface_->emitZipkinBatch(args.spans); - } catch (const std::exception&) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "Agent.emitZipkinBatch"); - } - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->asyncComplete(ctx, "Agent.emitZipkinBatch"); - } - - return; -} - void AgentProcessor::process_emitBatch(int32_t, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol*, void* callContext) { void* ctx = NULL; @@ -327,11 +162,34 @@ 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::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..88fab42a 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,14 +8,19 @@ #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() {} - virtual void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) = 0; virtual void emitBatch(const ::jaegertracing::thrift::Batch& batch) = 0; }; @@ -31,7 +36,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,77 +45,17 @@ 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 { public: virtual ~AgentNull() {} - void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & /* spans */) { - return; - } void emitBatch(const ::jaegertracing::thrift::Batch& /* batch */) { return; } }; -typedef struct _Agent_emitZipkinBatch_args__isset { - _Agent_emitZipkinBatch_args__isset() : spans(false) {} - bool spans :1; -} _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() { - } - - virtual ~Agent_emitZipkinBatch_args() throw(); - std::vector< ::twitter::zipkin::thrift::Span> spans; - - _Agent_emitZipkinBatch_args__isset __isset; - - void __set_spans(const std::vector< ::twitter::zipkin::thrift::Span> & val); - - bool operator == (const Agent_emitZipkinBatch_args & rhs) const - { - if (!(spans == rhs.spans)) - return false; - return true; - } - bool operator != (const Agent_emitZipkinBatch_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Agent_emitZipkinBatch_args & ) 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 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 { _Agent_emitBatch_args__isset() : batch(false) {} bool batch :1; @@ -119,9 +64,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,75 +91,66 @@ 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); - 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: - 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*); typedef std::map ProcessMap; ProcessMap processMap_; - 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,36 +159,27 @@ 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: - void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->emitZipkinBatch(spans); - } - ifaces_[i]->emitZipkinBatch(spans); - } - void emitBatch(const ::jaegertracing::thrift::Batch& batch) { size_t sz = ifaces_.size(); size_t i = 0; @@ -267,6 +191,48 @@ 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 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 deleted file mode 100644 index 10b5fd2c..00000000 --- a/src/jaegertracing/thrift-gen/TracedService.cpp +++ /dev/null @@ -1,633 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "TracedService.h" - -namespace jaegertracing { namespace crossdock { namespace thrift { - - -TracedService_startTrace_args::~TracedService_startTrace_args() throw() { -} - - -uint32_t TracedService_startTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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->request.read(iprot); - this->__isset.request = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t TracedService_startTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("TracedService_startTrace_args"); - - xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->request.write(oprot); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -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(); - xfer += oprot->writeStructBegin("TracedService_startTrace_pargs"); - - xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += (*(this->request)).write(oprot); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -TracedService_startTrace_result::~TracedService_startTrace_result() throw() { -} - - -uint32_t TracedService_startTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->success.read(iprot); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t TracedService_startTrace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("TracedService_startTrace_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); - xfer += this->success.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -TracedService_startTrace_presult::~TracedService_startTrace_presult() throw() { -} - - -uint32_t TracedService_startTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += (*(this->success)).read(iprot); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - - -TracedService_joinTrace_args::~TracedService_joinTrace_args() throw() { -} - - -uint32_t TracedService_joinTrace_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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->request.read(iprot); - this->__isset.request = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t TracedService_joinTrace_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("TracedService_joinTrace_args"); - - xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += this->request.write(oprot); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -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(); - xfer += oprot->writeStructBegin("TracedService_joinTrace_pargs"); - - xfer += oprot->writeFieldBegin("request", ::apache::thrift::protocol::T_STRUCT, 1); - xfer += (*(this->request)).write(oprot); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -TracedService_joinTrace_result::~TracedService_joinTrace_result() throw() { -} - - -uint32_t TracedService_joinTrace_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->success.read(iprot); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t TracedService_joinTrace_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("TracedService_joinTrace_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_STRUCT, 0); - xfer += this->success.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -TracedService_joinTrace_presult::~TracedService_joinTrace_presult() throw() { -} - - -uint32_t TracedService_joinTrace_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += (*(this->success)).read(iprot); - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -void TracedServiceClient::startTrace(TraceResponse& _return, const StartTraceRequest& request) -{ - send_startTrace(request); - recv_startTrace(_return); -} - -void TracedServiceClient::send_startTrace(const StartTraceRequest& request) -{ - int32_t cseqid = 0; - 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(); -} - -void TracedServiceClient::recv_startTrace(TraceResponse& _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - 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(); - } - 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 - return; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "startTrace failed: unknown result"); -} - -void TracedServiceClient::joinTrace(TraceResponse& _return, const JoinTraceRequest& request) -{ - send_joinTrace(request); - recv_joinTrace(_return); -} - -void TracedServiceClient::send_joinTrace(const JoinTraceRequest& request) -{ - int32_t cseqid = 0; - 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(); -} - -void TracedServiceClient::recv_joinTrace(TraceResponse& _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - 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(); - } - 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 - return; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "joinTrace failed: unknown result"); -} - -bool TracedServiceProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { - ProcessMap::iterator pfn; - pfn = processMap_.find(fname); - if (pfn == processMap_.end()) { - iprot->skip(::apache::thrift::protocol::T_STRUCT); - iprot->readMessageEnd(); - iprot->getTransport()->readEnd(); - ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); - oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return true; - } - (this->*(pfn->second))(seqid, iprot, oprot, callContext); - return true; -} - -void TracedServiceProcessor::process_startTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("TracedService.startTrace", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "TracedService.startTrace"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "TracedService.startTrace"); - } - - TracedService_startTrace_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "TracedService.startTrace", bytes); - } - - TracedService_startTrace_result result; - try { - iface_->startTrace(result.success, args.request); - result.__isset.success = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "TracedService.startTrace"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("startTrace", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "TracedService.startTrace"); - } - - oprot->writeMessageBegin("startTrace", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "TracedService.startTrace", bytes); - } -} - -void TracedServiceProcessor::process_joinTrace(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("TracedService.joinTrace", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "TracedService.joinTrace"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "TracedService.joinTrace"); - } - - TracedService_joinTrace_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "TracedService.joinTrace", bytes); - } - - TracedService_joinTrace_result result; - try { - iface_->joinTrace(result.success, args.request); - result.__isset.success = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "TracedService.joinTrace"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("joinTrace", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "TracedService.joinTrace"); - } - - oprot->writeMessageBegin("joinTrace", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "TracedService.joinTrace", bytes); - } -} - -::boost::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)); - return processor; -} -}}} // namespace - diff --git a/src/jaegertracing/thrift-gen/TracedService.h b/src/jaegertracing/thrift-gen/TracedService.h deleted file mode 100644 index 3d1ae6b7..00000000 --- a/src/jaegertracing/thrift-gen/TracedService.h +++ /dev/null @@ -1,402 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef TracedService_H -#define TracedService_H - -#include -#include "tracetest_types.h" - -namespace jaegertracing { namespace crossdock { namespace thrift { - -class TracedServiceIf { - public: - virtual ~TracedServiceIf() {} - virtual void startTrace(TraceResponse& _return, const StartTraceRequest& request) = 0; - virtual void joinTrace(TraceResponse& _return, const JoinTraceRequest& request) = 0; -}; - -class TracedServiceIfFactory { - public: - typedef TracedServiceIf Handler; - - virtual ~TracedServiceIfFactory() {} - - virtual TracedServiceIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; - virtual void releaseHandler(TracedServiceIf* /* handler */) = 0; -}; - -class TracedServiceIfSingletonFactory : virtual public TracedServiceIfFactory { - public: - TracedServiceIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} - virtual ~TracedServiceIfSingletonFactory() {} - - virtual TracedServiceIf* getHandler(const ::apache::thrift::TConnectionInfo&) { - return iface_.get(); - } - virtual void releaseHandler(TracedServiceIf* /* handler */) {} - - protected: - boost::shared_ptr iface_; -}; - -class TracedServiceNull : virtual public TracedServiceIf { - public: - virtual ~TracedServiceNull() {} - void startTrace(TraceResponse& /* _return */, const StartTraceRequest& /* request */) { - return; - } - void joinTrace(TraceResponse& /* _return */, const JoinTraceRequest& /* request */) { - return; - } -}; - -typedef struct _TracedService_startTrace_args__isset { - _TracedService_startTrace_args__isset() : request(false) {} - bool request :1; -} _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() { - } - - virtual ~TracedService_startTrace_args() throw(); - StartTraceRequest request; - - _TracedService_startTrace_args__isset __isset; - - void __set_request(const StartTraceRequest& val); - - bool operator == (const TracedService_startTrace_args & rhs) const - { - if (!(request == rhs.request)) - return false; - return true; - } - bool operator != (const TracedService_startTrace_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TracedService_startTrace_args & ) 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 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 { - _TracedService_startTrace_result__isset() : success(false) {} - bool success :1; -} _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() { - } - - virtual ~TracedService_startTrace_result() throw(); - TraceResponse success; - - _TracedService_startTrace_result__isset __isset; - - void __set_success(const TraceResponse& val); - - bool operator == (const TracedService_startTrace_result & rhs) const - { - if (!(success == rhs.success)) - return false; - return true; - } - bool operator != (const TracedService_startTrace_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TracedService_startTrace_result & ) 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 TracedService_startTrace_result& obj); -}; - -typedef struct _TracedService_startTrace_presult__isset { - _TracedService_startTrace_presult__isset() : success(false) {} - bool success :1; -} _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; - - _TracedService_startTrace_presult__isset __isset; - - 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 { - _TracedService_joinTrace_args__isset() : request(false) {} - bool request :1; -} _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() { - } - - virtual ~TracedService_joinTrace_args() throw(); - JoinTraceRequest request; - - _TracedService_joinTrace_args__isset __isset; - - void __set_request(const JoinTraceRequest& val); - - bool operator == (const TracedService_joinTrace_args & rhs) const - { - if (!(request == rhs.request)) - return false; - return true; - } - bool operator != (const TracedService_joinTrace_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TracedService_joinTrace_args & ) 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 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 { - _TracedService_joinTrace_result__isset() : success(false) {} - bool success :1; -} _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() { - } - - virtual ~TracedService_joinTrace_result() throw(); - TraceResponse success; - - _TracedService_joinTrace_result__isset __isset; - - void __set_success(const TraceResponse& val); - - bool operator == (const TracedService_joinTrace_result & rhs) const - { - if (!(success == rhs.success)) - return false; - return true; - } - bool operator != (const TracedService_joinTrace_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const TracedService_joinTrace_result & ) 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 TracedService_joinTrace_result& obj); -}; - -typedef struct _TracedService_joinTrace_presult__isset { - _TracedService_joinTrace_presult__isset() : success(false) {} - bool success :1; -} _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; - - _TracedService_joinTrace_presult__isset __isset; - - 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) { - setProtocol(prot); - } - TracedServiceClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { - setProtocol(iprot,oprot); - } - private: - void setProtocol(boost::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) { - piprot_=iprot; - poprot_=oprot; - iprot_ = iprot.get(); - oprot_ = oprot.get(); - } - public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { - return piprot_; - } - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() { - return poprot_; - } - void startTrace(TraceResponse& _return, const StartTraceRequest& request); - void send_startTrace(const StartTraceRequest& request); - void recv_startTrace(TraceResponse& _return); - void joinTrace(TraceResponse& _return, const JoinTraceRequest& request); - 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::protocol::TProtocol* iprot_; - ::apache::thrift::protocol::TProtocol* oprot_; -}; - -class TracedServiceProcessor : public ::apache::thrift::TDispatchProcessor { - protected: - boost::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*); - typedef std::map ProcessMap; - ProcessMap processMap_; - 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) : - iface_(iface) { - processMap_["startTrace"] = &TracedServiceProcessor::process_startTrace; - processMap_["joinTrace"] = &TracedServiceProcessor::process_joinTrace; - } - - virtual ~TracedServiceProcessor() {} -}; - -class TracedServiceProcessorFactory : public ::apache::thrift::TProcessorFactory { - public: - TracedServiceProcessorFactory(const ::boost::shared_ptr< TracedServiceIfFactory >& handlerFactory) : - handlerFactory_(handlerFactory) {} - - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); - - protected: - ::boost::shared_ptr< TracedServiceIfFactory > handlerFactory_; -}; - -class TracedServiceMultiface : virtual public TracedServiceIf { - public: - TracedServiceMultiface(std::vector >& ifaces) : ifaces_(ifaces) { - } - virtual ~TracedServiceMultiface() {} - protected: - std::vector > ifaces_; - TracedServiceMultiface() {} - void add(boost::shared_ptr iface) { - ifaces_.push_back(iface); - } - public: - void startTrace(TraceResponse& _return, const StartTraceRequest& request) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->startTrace(_return, request); - } - ifaces_[i]->startTrace(_return, request); - return; - } - - void joinTrace(TraceResponse& _return, const JoinTraceRequest& request) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->joinTrace(_return, request); - } - ifaces_[i]->joinTrace(_return, request); - return; - } - -}; - -}}} // namespace - -#endif diff --git a/src/jaegertracing/thrift-gen/ZipkinCollector.cpp b/src/jaegertracing/thrift-gen/ZipkinCollector.cpp deleted file mode 100644 index 6cf5d8e8..00000000 --- a/src/jaegertracing/thrift-gen/ZipkinCollector.cpp +++ /dev/null @@ -1,395 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "ZipkinCollector.h" - -namespace twitter { namespace zipkin { namespace thrift { - - -ZipkinCollector_submitZipkinBatch_args::~ZipkinCollector_submitZipkinBatch_args() throw() { -} - - -uint32_t ZipkinCollector_submitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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_LIST) { - { - this->spans.clear(); - uint32_t _size23; - ::apache::thrift::protocol::TType _etype26; - xfer += iprot->readListBegin(_etype26, _size23); - this->spans.resize(_size23); - uint32_t _i27; - for (_i27 = 0; _i27 < _size23; ++_i27) - { - xfer += this->spans[_i27].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.spans = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t ZipkinCollector_submitZipkinBatch_args::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("ZipkinCollector_submitZipkinBatch_args"); - - xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->spans.size())); - std::vector ::const_iterator _iter28; - for (_iter28 = this->spans.begin(); _iter28 != this->spans.end(); ++_iter28) - { - xfer += (*_iter28).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -ZipkinCollector_submitZipkinBatch_pargs::~ZipkinCollector_submitZipkinBatch_pargs() throw() { -} - - -uint32_t ZipkinCollector_submitZipkinBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("ZipkinCollector_submitZipkinBatch_pargs"); - - xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 1); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast((*(this->spans)).size())); - std::vector ::const_iterator _iter29; - for (_iter29 = (*(this->spans)).begin(); _iter29 != (*(this->spans)).end(); ++_iter29) - { - xfer += (*_iter29).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - - -ZipkinCollector_submitZipkinBatch_result::~ZipkinCollector_submitZipkinBatch_result() throw() { -} - - -uint32_t ZipkinCollector_submitZipkinBatch_result::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->success.clear(); - uint32_t _size30; - ::apache::thrift::protocol::TType _etype33; - xfer += iprot->readListBegin(_etype33, _size30); - this->success.resize(_size30); - uint32_t _i34; - for (_i34 = 0; _i34 < _size30; ++_i34) - { - xfer += this->success[_i34].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t ZipkinCollector_submitZipkinBatch_result::write(::apache::thrift::protocol::TProtocol* oprot) const { - - uint32_t xfer = 0; - - xfer += oprot->writeStructBegin("ZipkinCollector_submitZipkinBatch_result"); - - if (this->__isset.success) { - xfer += oprot->writeFieldBegin("success", ::apache::thrift::protocol::T_LIST, 0); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->success.size())); - std::vector ::const_iterator _iter35; - for (_iter35 = this->success.begin(); _iter35 != this->success.end(); ++_iter35) - { - xfer += (*_iter35).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -ZipkinCollector_submitZipkinBatch_presult::~ZipkinCollector_submitZipkinBatch_presult() throw() { -} - - -uint32_t ZipkinCollector_submitZipkinBatch_presult::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - while (true) - { - xfer += iprot->readFieldBegin(fname, ftype, fid); - if (ftype == ::apache::thrift::protocol::T_STOP) { - break; - } - switch (fid) - { - case 0: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - (*(this->success)).clear(); - uint32_t _size36; - ::apache::thrift::protocol::TType _etype39; - xfer += iprot->readListBegin(_etype39, _size36); - (*(this->success)).resize(_size36); - uint32_t _i40; - for (_i40 = 0; _i40 < _size36; ++_i40) - { - xfer += (*(this->success))[_i40].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.success = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -void ZipkinCollectorClient::submitZipkinBatch(std::vector & _return, const std::vector & spans) -{ - send_submitZipkinBatch(spans); - recv_submitZipkinBatch(_return); -} - -void ZipkinCollectorClient::send_submitZipkinBatch(const std::vector & spans) -{ - int32_t cseqid = 0; - 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(); -} - -void ZipkinCollectorClient::recv_submitZipkinBatch(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - 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(); - } - 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 - return; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitZipkinBatch failed: unknown result"); -} - -bool ZipkinCollectorProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { - ProcessMap::iterator pfn; - pfn = processMap_.find(fname); - if (pfn == processMap_.end()) { - iprot->skip(::apache::thrift::protocol::T_STRUCT); - iprot->readMessageEnd(); - iprot->getTransport()->readEnd(); - ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); - oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return true; - } - (this->*(pfn->second))(seqid, iprot, oprot, callContext); - return true; -} - -void ZipkinCollectorProcessor::process_submitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = NULL; - if (this->eventHandler_.get() != NULL) { - ctx = this->eventHandler_->getContext("ZipkinCollector.submitZipkinBatch", callContext); - } - ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ZipkinCollector.submitZipkinBatch"); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preRead(ctx, "ZipkinCollector.submitZipkinBatch"); - } - - ZipkinCollector_submitZipkinBatch_args args; - args.read(iprot); - iprot->readMessageEnd(); - uint32_t bytes = iprot->getTransport()->readEnd(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postRead(ctx, "ZipkinCollector.submitZipkinBatch", bytes); - } - - ZipkinCollector_submitZipkinBatch_result result; - try { - iface_->submitZipkinBatch(result.success, args.spans); - result.__isset.success = true; - } catch (const std::exception& e) { - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->handlerError(ctx, "ZipkinCollector.submitZipkinBatch"); - } - - ::apache::thrift::TApplicationException x(e.what()); - oprot->writeMessageBegin("submitZipkinBatch", ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return; - } - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->preWrite(ctx, "ZipkinCollector.submitZipkinBatch"); - } - - oprot->writeMessageBegin("submitZipkinBatch", ::apache::thrift::protocol::T_REPLY, seqid); - result.write(oprot); - oprot->writeMessageEnd(); - bytes = oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - - if (this->eventHandler_.get() != NULL) { - this->eventHandler_->postWrite(ctx, "ZipkinCollector.submitZipkinBatch", bytes); - } -} - -::boost::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)); - return processor; -} -}}} // namespace - diff --git a/src/jaegertracing/thrift-gen/ZipkinCollector.h b/src/jaegertracing/thrift-gen/ZipkinCollector.h deleted file mode 100644 index cb128c63..00000000 --- a/src/jaegertracing/thrift-gen/ZipkinCollector.h +++ /dev/null @@ -1,263 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef ZipkinCollector_H -#define ZipkinCollector_H - -#include -#include "zipkincore_types.h" - -namespace twitter { namespace zipkin { namespace thrift { - -class ZipkinCollectorIf { - public: - virtual ~ZipkinCollectorIf() {} - virtual void submitZipkinBatch(std::vector & _return, const std::vector & spans) = 0; -}; - -class ZipkinCollectorIfFactory { - public: - typedef ZipkinCollectorIf Handler; - - virtual ~ZipkinCollectorIfFactory() {} - - virtual ZipkinCollectorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; - virtual void releaseHandler(ZipkinCollectorIf* /* handler */) = 0; -}; - -class ZipkinCollectorIfSingletonFactory : virtual public ZipkinCollectorIfFactory { - public: - ZipkinCollectorIfSingletonFactory(const boost::shared_ptr& iface) : iface_(iface) {} - virtual ~ZipkinCollectorIfSingletonFactory() {} - - virtual ZipkinCollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) { - return iface_.get(); - } - virtual void releaseHandler(ZipkinCollectorIf* /* handler */) {} - - protected: - boost::shared_ptr iface_; -}; - -class ZipkinCollectorNull : virtual public ZipkinCollectorIf { - public: - virtual ~ZipkinCollectorNull() {} - void submitZipkinBatch(std::vector & /* _return */, const std::vector & /* spans */) { - return; - } -}; - -typedef struct _ZipkinCollector_submitZipkinBatch_args__isset { - _ZipkinCollector_submitZipkinBatch_args__isset() : spans(false) {} - bool spans :1; -} _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() { - } - - virtual ~ZipkinCollector_submitZipkinBatch_args() throw(); - std::vector spans; - - _ZipkinCollector_submitZipkinBatch_args__isset __isset; - - void __set_spans(const std::vector & val); - - bool operator == (const ZipkinCollector_submitZipkinBatch_args & rhs) const - { - if (!(spans == rhs.spans)) - return false; - return true; - } - bool operator != (const ZipkinCollector_submitZipkinBatch_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const ZipkinCollector_submitZipkinBatch_args & ) 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 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 { - _ZipkinCollector_submitZipkinBatch_result__isset() : success(false) {} - bool success :1; -} _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() { - } - - virtual ~ZipkinCollector_submitZipkinBatch_result() throw(); - std::vector success; - - _ZipkinCollector_submitZipkinBatch_result__isset __isset; - - void __set_success(const std::vector & val); - - bool operator == (const ZipkinCollector_submitZipkinBatch_result & rhs) const - { - if (!(success == rhs.success)) - return false; - return true; - } - bool operator != (const ZipkinCollector_submitZipkinBatch_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const ZipkinCollector_submitZipkinBatch_result & ) 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 ZipkinCollector_submitZipkinBatch_result& obj); -}; - -typedef struct _ZipkinCollector_submitZipkinBatch_presult__isset { - _ZipkinCollector_submitZipkinBatch_presult__isset() : success(false) {} - bool success :1; -} _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; - - _ZipkinCollector_submitZipkinBatch_presult__isset __isset; - - 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) { - setProtocol(prot); - } - ZipkinCollectorClient(boost::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) { - setProtocol(iprot,oprot); - } - private: - void setProtocol(boost::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) { - piprot_=iprot; - poprot_=oprot; - iprot_ = iprot.get(); - oprot_ = oprot.get(); - } - public: - boost::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() { - return piprot_; - } - boost::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::protocol::TProtocol* iprot_; - ::apache::thrift::protocol::TProtocol* oprot_; -}; - -class ZipkinCollectorProcessor : public ::apache::thrift::TDispatchProcessor { - protected: - boost::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*); - typedef std::map ProcessMap; - 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) : - iface_(iface) { - processMap_["submitZipkinBatch"] = &ZipkinCollectorProcessor::process_submitZipkinBatch; - } - - virtual ~ZipkinCollectorProcessor() {} -}; - -class ZipkinCollectorProcessorFactory : public ::apache::thrift::TProcessorFactory { - public: - ZipkinCollectorProcessorFactory(const ::boost::shared_ptr< ZipkinCollectorIfFactory >& handlerFactory) : - handlerFactory_(handlerFactory) {} - - ::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo); - - protected: - ::boost::shared_ptr< ZipkinCollectorIfFactory > handlerFactory_; -}; - -class ZipkinCollectorMultiface : virtual public ZipkinCollectorIf { - public: - ZipkinCollectorMultiface(std::vector >& ifaces) : ifaces_(ifaces) { - } - virtual ~ZipkinCollectorMultiface() {} - protected: - std::vector > ifaces_; - ZipkinCollectorMultiface() {} - void add(boost::shared_ptr iface) { - ifaces_.push_back(iface); - } - public: - void submitZipkinBatch(std::vector & _return, const std::vector & spans) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->submitZipkinBatch(_return, spans); - } - ifaces_[i]->submitZipkinBatch(_return, spans); - return; - } - -}; - -}}} // 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..ceacc73b 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,12 +11,12 @@ #include #include +#include #include #include -#include +#include #include "jaeger_types.h" -#include "zipkincore_types.h" namespace jaegertracing { namespace agent { namespace thrift { 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 deleted file mode 100644 index 1a3d418e..00000000 --- a/src/jaegertracing/thrift-gen/tracetest_constants.cpp +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "tracetest_constants.h" - -namespace jaegertracing { namespace crossdock { namespace thrift { - -const tracetestConstants g_tracetest_constants; - -tracetestConstants::tracetestConstants() { -} - -}}} // namespace - diff --git a/src/jaegertracing/thrift-gen/tracetest_constants.h b/src/jaegertracing/thrift-gen/tracetest_constants.h deleted file mode 100644 index ddac828a..00000000 --- a/src/jaegertracing/thrift-gen/tracetest_constants.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef tracetest_CONSTANTS_H -#define tracetest_CONSTANTS_H - -#include "tracetest_types.h" - -namespace jaegertracing { namespace crossdock { namespace thrift { - -class tracetestConstants { - public: - tracetestConstants(); - -}; - -extern const tracetestConstants g_tracetest_constants; - -}}} // namespace - -#endif diff --git a/src/jaegertracing/thrift-gen/tracetest_types.cpp b/src/jaegertracing/thrift-gen/tracetest_types.cpp deleted file mode 100644 index 206004e0..00000000 --- a/src/jaegertracing/thrift-gen/tracetest_types.cpp +++ /dev/null @@ -1,777 +0,0 @@ -/** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) - * - * WARNING WARNING WARNING - * This file has been hand-patched. See https://github.com/jaegertracing/cpp-client/issues/45 . - */ -#include "tracetest_types.h" - -#include -#include - -#include - -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)); - - -Downstream::~Downstream() throw() { -} - - -void Downstream::__set_serviceName(const std::string& val) { - this->serviceName = val; -} - -void Downstream::__set_serverRole(const std::string& val) { - this->serverRole = val; -} - -void Downstream::__set_host(const std::string& val) { - this->host = 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) { - this->downstream = boost::shared_ptr(new Downstream(val)); -} - -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 xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - 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; - - 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); - } - 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; - } - 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; - oprot->incrementRecursionDepth(); - 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->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 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); -} - -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; -} -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; -} - -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 xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - 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; - } - 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; - } - xfer += iprot->readFieldEnd(); - } - - 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; -} - -uint32_t StartTraceRequest::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - 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("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("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; -} - -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::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 JoinTraceRequest::__set_downstream(const Downstream& val) { - this->downstream = val; -__isset.downstream = true; -} - -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) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - 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); - } - 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; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - 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"); - - 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; -} - -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::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; -} - - -ObservedSpan::~ObservedSpan() throw() { -} - - -void ObservedSpan::__set_traceId(const std::string& val) { - this->traceId = val; -} - -void ObservedSpan::__set_sampled(const bool val) { - this->sampled = val; -} - -void ObservedSpan::__set_baggage(const std::string& val) { - this->baggage = 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}; - -uint32_t ObservedSpan::read(::apache::thrift::protocol::TProtocol* iprot) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - 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); - } - 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; - } - xfer += iprot->readFieldEnd(); - } - - 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; -} - -uint32_t ObservedSpan::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - 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("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->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - 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); -} - -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; -} -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; -} - - -TraceResponse::~TraceResponse() throw() { -} - - -void TraceResponse::__set_span(const ObservedSpan& val) { - this->span = val; -__isset.span = true; -} - -void TraceResponse::__set_downstream(const TraceResponse& val) { - this->downstream = boost::shared_ptr(new TraceResponse(val)); -} - -void TraceResponse::__set_notImplementedError(const std::string& val) { - this->notImplementedError = val; -} - -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 xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - bool isset_notImplementedError = 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_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; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - 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); -} - -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 diff --git a/src/jaegertracing/thrift-gen/tracetest_types.h b/src/jaegertracing/thrift-gen/tracetest_types.h deleted file mode 100644 index 71981c19..00000000 --- a/src/jaegertracing/thrift-gen/tracetest_types.h +++ /dev/null @@ -1,314 +0,0 @@ -/** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) - * - * WARNING WARNING WARNING - * This file has been hand-patched. See https://github.com/jaegertracing/cpp-client/issues/45 . - */ -#ifndef tracetest_TYPES_H -#define tracetest_TYPES_H - -#include - -#include -#include -#include -#include - -#include - - -namespace jaegertracing { namespace crossdock { namespace thrift { - -struct Transport { - enum type { - HTTP = 0, - TCHANNEL = 1, - DUMMY = 2 - }; -}; - -extern const std::map _Transport_VALUES_TO_NAMES; - -class Downstream; - -class StartTraceRequest; - -class JoinTraceRequest; - -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); -}; - -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(StartTraceRequest &a, StartTraceRequest &b); - -typedef struct _JoinTraceRequest__isset { - _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); -}; - -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(ObservedSpan &a, ObservedSpan &b); - -typedef struct _TraceResponse__isset { - _TraceResponse__isset() : span(false) {} - bool span :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); -}; - -void swap(TraceResponse &a, TraceResponse &b); - -}}} // namespace - -#endif diff --git a/src/jaegertracing/thrift-gen/zipkincore_constants.cpp b/src/jaegertracing/thrift-gen/zipkincore_constants.cpp deleted file mode 100644 index 1c0c5704..00000000 --- a/src/jaegertracing/thrift-gen/zipkincore_constants.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) - * - * WARNING WARNING WARNING - * This file has been hand-patched. See https://github.com/jaegertracing/cpp-client/issues/45 . - */ -#include "zipkincore_constants.h" - -namespace twitter { namespace zipkin { namespace thrift { - -const zipkincoreConstants g_zipkincore_constants; - -zipkincoreConstants::zipkincoreConstants() { - CLIENT_SEND = "cs"; - - CLIENT_RECV = "cr"; - - SERVER_SEND = "ss"; - - SERVER_RECV = "sr"; - - WIRE_SEND = "ws"; - - WIRE_RECV = "wr"; - - CLIENT_SEND_FRAGMENT = "csf"; - - CLIENT_RECV_FRAGMENT = "crf"; - - SERVER_SEND_FRAGMENT = "ssf"; - - SERVER_RECV_FRAGMENT = "srf"; - - LOCAL_COMPONENT = "lc"; - - CLIENT_ADDR = "ca"; - - SERVER_ADDR = "sa"; - -} - -}}} // namespace - diff --git a/src/jaegertracing/thrift-gen/zipkincore_constants.h b/src/jaegertracing/thrift-gen/zipkincore_constants.h deleted file mode 100644 index 4e8084d5..00000000 --- a/src/jaegertracing/thrift-gen/zipkincore_constants.h +++ /dev/null @@ -1,37 +0,0 @@ -/** - * MODIFIED from code autogenerated by Thrift Compiler (0.9.2) - * - * WARNING WARNING WARNING - * This file has been hand-patched. See https://github.com/jaegertracing/cpp-client/issues/45 . - */ -#ifndef zipkincore_CONSTANTS_H -#define zipkincore_CONSTANTS_H - -#include "zipkincore_types.h" - -namespace twitter { namespace zipkin { namespace thrift { - -class 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; -}; - -extern const zipkincoreConstants g_zipkincore_constants; - -}}} // namespace - -#endif diff --git a/src/jaegertracing/thrift-gen/zipkincore_types.cpp b/src/jaegertracing/thrift-gen/zipkincore_types.cpp deleted file mode 100644 index fc305574..00000000 --- a/src/jaegertracing/thrift-gen/zipkincore_types.cpp +++ /dev/null @@ -1,884 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#include "zipkincore_types.h" - -#include -#include - -#include - -namespace twitter { namespace zipkin { namespace thrift { - -int _kAnnotationTypeValues[] = { - AnnotationType::BOOL, - AnnotationType::BYTES, - AnnotationType::I16, - AnnotationType::I32, - AnnotationType::I64, - AnnotationType::DOUBLE, - AnnotationType::STRING -}; -const char* _kAnnotationTypeNames[] = { - "BOOL", - "BYTES", - "I16", - "I32", - "I64", - "DOUBLE", - "STRING" -}; -const std::map _AnnotationType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(7, _kAnnotationTypeValues, _kAnnotationTypeNames), ::apache::thrift::TEnumIterator(-1, NULL, NULL)); - - -Endpoint::~Endpoint() throw() { -} - - -void Endpoint::__set_ipv4(const int32_t val) { - this->ipv4 = val; -} - -void Endpoint::__set_port(const int16_t val) { - this->port = val; -} - -void Endpoint::__set_service_name(const std::string& val) { - this->service_name = val; -} - -void Endpoint::__set_ipv6(const std::string& val) { - this->ipv6 = val; -__isset.ipv6 = true; -} - -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) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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_I32) { - xfer += iprot->readI32(this->ipv4); - this->__isset.ipv4 = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_I16) { - xfer += iprot->readI16(this->port); - this->__isset.port = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->service_name); - this->__isset.service_name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readBinary(this->ipv6); - this->__isset.ipv6 = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t Endpoint::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("Endpoint"); - - xfer += oprot->writeFieldBegin("ipv4", ::apache::thrift::protocol::T_I32, 1); - xfer += oprot->writeI32(this->ipv4); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("port", ::apache::thrift::protocol::T_I16, 2); - xfer += oprot->writeI16(this->port); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("service_name", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->service_name); - xfer += oprot->writeFieldEnd(); - - if (this->__isset.ipv6) { - xfer += oprot->writeFieldBegin("ipv6", ::apache::thrift::protocol::T_STRING, 4); - xfer += oprot->writeBinary(this->ipv6); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - -void swap(Endpoint &a, Endpoint &b) { - using ::std::swap; - swap(a.ipv4, b.ipv4); - swap(a.port, b.port); - swap(a.service_name, b.service_name); - swap(a.ipv6, b.ipv6); - swap(a.__isset, b.__isset); -} - -Endpoint::Endpoint(const Endpoint& other0) { - ipv4 = other0.ipv4; - port = other0.port; - service_name = other0.service_name; - ipv6 = other0.ipv6; - __isset = other0.__isset; -} -Endpoint& Endpoint::operator=(const Endpoint& other1) { - ipv4 = other1.ipv4; - port = other1.port; - service_name = other1.service_name; - ipv6 = other1.ipv6; - __isset = other1.__isset; - return *this; -} -std::ostream& operator<<(std::ostream& out, const Endpoint& obj) { - 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 << ")"; - return out; -} - - -Annotation::~Annotation() throw() { -} - - -void Annotation::__set_timestamp(const int64_t val) { - this->timestamp = val; -} - -void Annotation::__set_value(const std::string& val) { - this->value = val; -} - -void Annotation::__set_host(const Endpoint& val) { - this->host = val; -__isset.host = true; -} - -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) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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_I64) { - xfer += iprot->readI64(this->timestamp); - this->__isset.timestamp = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->value); - this->__isset.value = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->host.read(iprot); - this->__isset.host = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t Annotation::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("Annotation"); - - xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 1); - xfer += oprot->writeI64(this->timestamp); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeString(this->value); - xfer += oprot->writeFieldEnd(); - - if (this->__isset.host) { - xfer += oprot->writeFieldBegin("host", ::apache::thrift::protocol::T_STRUCT, 3); - xfer += this->host.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - -void swap(Annotation &a, Annotation &b) { - using ::std::swap; - swap(a.timestamp, b.timestamp); - swap(a.value, b.value); - swap(a.host, b.host); - swap(a.__isset, b.__isset); -} - -Annotation::Annotation(const Annotation& other2) { - timestamp = other2.timestamp; - value = other2.value; - host = other2.host; - __isset = other2.__isset; -} -Annotation& Annotation::operator=(const Annotation& other3) { - timestamp = other3.timestamp; - value = other3.value; - host = other3.host; - __isset = other3.__isset; - return *this; -} -std::ostream& operator<<(std::ostream& out, const Annotation& obj) { - 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 << ")"; - return out; -} - - -BinaryAnnotation::~BinaryAnnotation() throw() { -} - - -void BinaryAnnotation::__set_key(const std::string& val) { - this->key = val; -} - -void BinaryAnnotation::__set_value(const std::string& val) { - this->value = val; -} - -void BinaryAnnotation::__set_annotation_type(const AnnotationType::type val) { - this->annotation_type = val; -} - -void BinaryAnnotation::__set_host(const Endpoint& val) { - this->host = val; -__isset.host = true; -} - -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) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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->key); - this->__isset.key = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 2: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readBinary(this->value); - this->__isset.value = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_I32) { - int32_t ecast4; - xfer += iprot->readI32(ecast4); - this->annotation_type = (AnnotationType::type)ecast4; - this->__isset.annotation_type = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_STRUCT) { - xfer += this->host.read(iprot); - this->__isset.host = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t BinaryAnnotation::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("BinaryAnnotation"); - - xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1); - xfer += oprot->writeString(this->key); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("value", ::apache::thrift::protocol::T_STRING, 2); - xfer += oprot->writeBinary(this->value); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("annotation_type", ::apache::thrift::protocol::T_I32, 3); - xfer += oprot->writeI32((int32_t)this->annotation_type); - xfer += oprot->writeFieldEnd(); - - if (this->__isset.host) { - xfer += oprot->writeFieldBegin("host", ::apache::thrift::protocol::T_STRUCT, 4); - xfer += this->host.write(oprot); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - -void swap(BinaryAnnotation &a, BinaryAnnotation &b) { - using ::std::swap; - swap(a.key, b.key); - swap(a.value, b.value); - swap(a.annotation_type, b.annotation_type); - swap(a.host, b.host); - swap(a.__isset, b.__isset); -} - -BinaryAnnotation::BinaryAnnotation(const BinaryAnnotation& other5) { - key = other5.key; - value = other5.value; - annotation_type = other5.annotation_type; - host = other5.host; - __isset = other5.__isset; -} -BinaryAnnotation& BinaryAnnotation::operator=(const BinaryAnnotation& other6) { - key = other6.key; - value = other6.value; - annotation_type = other6.annotation_type; - host = other6.host; - __isset = other6.__isset; - return *this; -} -std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj) { - 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 << ")"; - return out; -} - - -Span::~Span() throw() { -} - - -void Span::__set_trace_id(const int64_t val) { - this->trace_id = val; -} - -void Span::__set_name(const std::string& val) { - this->name = val; -} - -void Span::__set_id(const int64_t val) { - this->id = val; -} - -void Span::__set_parent_id(const int64_t val) { - this->parent_id = val; -__isset.parent_id = true; -} - -void Span::__set_annotations(const std::vector & val) { - this->annotations = val; -} - -void Span::__set_binary_annotations(const std::vector & val) { - this->binary_annotations = val; -} - -void Span::__set_debug(const bool val) { - this->debug = val; -__isset.debug = true; -} - -void Span::__set_timestamp(const int64_t val) { - this->timestamp = val; -__isset.timestamp = true; -} - -void Span::__set_duration(const int64_t val) { - this->duration = val; -__isset.duration = true; -} - -void Span::__set_trace_id_high(const int64_t val) { - this->trace_id_high = val; -__isset.trace_id_high = true; -} - -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) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - - 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_I64) { - xfer += iprot->readI64(this->trace_id); - this->__isset.trace_id = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 3: - if (ftype == ::apache::thrift::protocol::T_STRING) { - xfer += iprot->readString(this->name); - this->__isset.name = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 4: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->id); - this->__isset.id = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 5: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->parent_id); - this->__isset.parent_id = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 6: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->annotations.clear(); - uint32_t _size7; - ::apache::thrift::protocol::TType _etype10; - xfer += iprot->readListBegin(_etype10, _size7); - this->annotations.resize(_size7); - uint32_t _i11; - for (_i11 = 0; _i11 < _size7; ++_i11) - { - xfer += this->annotations[_i11].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.annotations = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 8: - if (ftype == ::apache::thrift::protocol::T_LIST) { - { - this->binary_annotations.clear(); - uint32_t _size12; - ::apache::thrift::protocol::TType _etype15; - xfer += iprot->readListBegin(_etype15, _size12); - this->binary_annotations.resize(_size12); - uint32_t _i16; - for (_i16 = 0; _i16 < _size12; ++_i16) - { - xfer += this->binary_annotations[_i16].read(iprot); - } - xfer += iprot->readListEnd(); - } - this->__isset.binary_annotations = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 9: - if (ftype == ::apache::thrift::protocol::T_BOOL) { - xfer += iprot->readBool(this->debug); - this->__isset.debug = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 10: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->timestamp); - this->__isset.timestamp = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 11: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->duration); - this->__isset.duration = true; - } else { - xfer += iprot->skip(ftype); - } - break; - case 12: - if (ftype == ::apache::thrift::protocol::T_I64) { - xfer += iprot->readI64(this->trace_id_high); - this->__isset.trace_id_high = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - return xfer; -} - -uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("Span"); - - xfer += oprot->writeFieldBegin("trace_id", ::apache::thrift::protocol::T_I64, 1); - xfer += oprot->writeI64(this->trace_id); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("name", ::apache::thrift::protocol::T_STRING, 3); - xfer += oprot->writeString(this->name); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("id", ::apache::thrift::protocol::T_I64, 4); - xfer += oprot->writeI64(this->id); - xfer += oprot->writeFieldEnd(); - - if (this->__isset.parent_id) { - xfer += oprot->writeFieldBegin("parent_id", ::apache::thrift::protocol::T_I64, 5); - xfer += oprot->writeI64(this->parent_id); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldBegin("annotations", ::apache::thrift::protocol::T_LIST, 6); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->annotations.size())); - std::vector ::const_iterator _iter17; - for (_iter17 = this->annotations.begin(); _iter17 != this->annotations.end(); ++_iter17) - { - xfer += (*_iter17).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("binary_annotations", ::apache::thrift::protocol::T_LIST, 8); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->binary_annotations.size())); - std::vector ::const_iterator _iter18; - for (_iter18 = this->binary_annotations.begin(); _iter18 != this->binary_annotations.end(); ++_iter18) - { - xfer += (*_iter18).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - if (this->__isset.debug) { - xfer += oprot->writeFieldBegin("debug", ::apache::thrift::protocol::T_BOOL, 9); - xfer += oprot->writeBool(this->debug); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.timestamp) { - xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 10); - xfer += oprot->writeI64(this->timestamp); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.duration) { - xfer += oprot->writeFieldBegin("duration", ::apache::thrift::protocol::T_I64, 11); - xfer += oprot->writeI64(this->duration); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.trace_id_high) { - xfer += oprot->writeFieldBegin("trace_id_high", ::apache::thrift::protocol::T_I64, 12); - xfer += oprot->writeI64(this->trace_id_high); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - -void swap(Span &a, Span &b) { - using ::std::swap; - swap(a.trace_id, b.trace_id); - swap(a.name, b.name); - swap(a.id, b.id); - swap(a.parent_id, b.parent_id); - swap(a.annotations, b.annotations); - swap(a.binary_annotations, b.binary_annotations); - swap(a.debug, b.debug); - swap(a.timestamp, b.timestamp); - swap(a.duration, b.duration); - swap(a.trace_id_high, b.trace_id_high); - swap(a.__isset, b.__isset); -} - -Span::Span(const Span& other19) { - trace_id = other19.trace_id; - name = other19.name; - id = other19.id; - parent_id = other19.parent_id; - annotations = other19.annotations; - binary_annotations = other19.binary_annotations; - debug = other19.debug; - timestamp = other19.timestamp; - duration = other19.duration; - trace_id_high = other19.trace_id_high; - __isset = other19.__isset; -} -Span& Span::operator=(const Span& other20) { - trace_id = other20.trace_id; - name = other20.name; - id = other20.id; - parent_id = other20.parent_id; - annotations = other20.annotations; - binary_annotations = other20.binary_annotations; - debug = other20.debug; - timestamp = other20.timestamp; - duration = other20.duration; - trace_id_high = other20.trace_id_high; - __isset = other20.__isset; - return *this; -} -std::ostream& operator<<(std::ostream& out, const Span& obj) { - 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 << ")"; - return out; -} - - -Response::~Response() throw() { -} - - -void Response::__set_ok(const bool val) { - this->ok = val; -} - -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) { - - uint32_t xfer = 0; - std::string fname; - ::apache::thrift::protocol::TType ftype; - int16_t fid; - - xfer += iprot->readStructBegin(fname); - - using ::apache::thrift::protocol::TProtocolException; - - bool isset_ok = 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_BOOL) { - xfer += iprot->readBool(this->ok); - isset_ok = true; - } else { - xfer += iprot->skip(ftype); - } - break; - default: - xfer += iprot->skip(ftype); - break; - } - xfer += iprot->readFieldEnd(); - } - - xfer += iprot->readStructEnd(); - - if (!isset_ok) - throw TProtocolException(TProtocolException::INVALID_DATA); - return xfer; -} - -uint32_t Response::write(::apache::thrift::protocol::TProtocol* oprot) const { - uint32_t xfer = 0; - oprot->incrementRecursionDepth(); - xfer += oprot->writeStructBegin("Response"); - - xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1); - xfer += oprot->writeBool(this->ok); - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - oprot->decrementRecursionDepth(); - return xfer; -} - -void swap(Response &a, Response &b) { - using ::std::swap; - swap(a.ok, b.ok); -} - -Response::Response(const Response& other21) { - ok = other21.ok; -} -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; - out << "Response("; - out << "ok=" << to_string(obj.ok); - out << ")"; - return out; -} - -}}} // namespace diff --git a/src/jaegertracing/thrift-gen/zipkincore_types.h b/src/jaegertracing/thrift-gen/zipkincore_types.h deleted file mode 100644 index 7bf50cf3..00000000 --- a/src/jaegertracing/thrift-gen/zipkincore_types.h +++ /dev/null @@ -1,375 +0,0 @@ -/** - * Autogenerated by Thrift Compiler (0.9.2) - * - * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING - * @generated - */ -#ifndef zipkincore_TYPES_H -#define zipkincore_TYPES_H - -#include - -#include -#include -#include -#include - -#include - - -namespace twitter { namespace zipkin { namespace thrift { - -struct AnnotationType { - enum type { - BOOL = 0, - BYTES = 1, - I16 = 2, - I32 = 3, - I64 = 4, - DOUBLE = 5, - STRING = 6 - }; -}; - -extern const std::map _AnnotationType_VALUES_TO_NAMES; - -class Endpoint; - -class Annotation; - -class BinaryAnnotation; - -class Span; - -class Response; - -typedef struct _Endpoint__isset { - _Endpoint__isset() : ipv4(false), port(false), service_name(false), ipv6(false) {} - bool ipv4 :1; - bool port :1; - bool service_name :1; - bool ipv6 :1; -} _Endpoint__isset; - -class Endpoint { - 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() { - } - - virtual ~Endpoint() throw(); - int32_t ipv4; - int16_t port; - std::string service_name; - std::string ipv6; - - _Endpoint__isset __isset; - - void __set_ipv4(const int32_t val); - - void __set_port(const int16_t val); - - void __set_service_name(const std::string& val); - - void __set_ipv6(const std::string& val); - - bool operator == (const Endpoint & rhs) const - { - if (!(ipv4 == rhs.ipv4)) - return false; - if (!(port == rhs.port)) - return false; - if (!(service_name == rhs.service_name)) - return false; - if (__isset.ipv6 != rhs.__isset.ipv6) - return false; - else if (__isset.ipv6 && !(ipv6 == rhs.ipv6)) - return false; - return true; - } - bool operator != (const Endpoint &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Endpoint & ) 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 Endpoint& obj); -}; - -void swap(Endpoint &a, Endpoint &b); - -typedef struct _Annotation__isset { - _Annotation__isset() : timestamp(false), value(false), host(false) {} - bool timestamp :1; - bool value :1; - bool host :1; -} _Annotation__isset; - -class Annotation { - 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() { - } - - virtual ~Annotation() throw(); - int64_t timestamp; - std::string value; - Endpoint host; - - _Annotation__isset __isset; - - void __set_timestamp(const int64_t val); - - void __set_value(const std::string& val); - - void __set_host(const Endpoint& val); - - bool operator == (const Annotation & rhs) const - { - if (!(timestamp == rhs.timestamp)) - return false; - if (!(value == rhs.value)) - return false; - if (__isset.host != rhs.__isset.host) - return false; - else if (__isset.host && !(host == rhs.host)) - return false; - return true; - } - bool operator != (const Annotation &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Annotation & ) 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 Annotation& obj); -}; - -void swap(Annotation &a, Annotation &b); - -typedef struct _BinaryAnnotation__isset { - _BinaryAnnotation__isset() : key(false), value(false), annotation_type(false), host(false) {} - bool key :1; - bool value :1; - bool annotation_type :1; - bool host :1; -} _BinaryAnnotation__isset; - -class BinaryAnnotation { - 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) { - } - - virtual ~BinaryAnnotation() throw(); - std::string key; - std::string value; - AnnotationType::type annotation_type; - Endpoint host; - - _BinaryAnnotation__isset __isset; - - void __set_key(const std::string& val); - - void __set_value(const std::string& val); - - void __set_annotation_type(const AnnotationType::type val); - - void __set_host(const Endpoint& val); - - bool operator == (const BinaryAnnotation & rhs) const - { - if (!(key == rhs.key)) - return false; - if (!(value == rhs.value)) - return false; - if (!(annotation_type == rhs.annotation_type)) - return false; - if (__isset.host != rhs.__isset.host) - return false; - else if (__isset.host && !(host == rhs.host)) - return false; - return true; - } - bool operator != (const BinaryAnnotation &rhs) const { - return !(*this == rhs); - } - - bool operator < (const BinaryAnnotation & ) 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 BinaryAnnotation& obj); -}; - -void swap(BinaryAnnotation &a, BinaryAnnotation &b); - -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; - bool name :1; - bool id :1; - bool parent_id :1; - bool annotations :1; - bool binary_annotations :1; - bool debug :1; - bool timestamp :1; - bool duration :1; - bool trace_id_high :1; -} _Span__isset; - -class Span { - 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) { - } - - virtual ~Span() throw(); - int64_t trace_id; - std::string name; - int64_t id; - int64_t parent_id; - std::vector annotations; - std::vector binary_annotations; - bool debug; - int64_t timestamp; - int64_t duration; - int64_t trace_id_high; - - _Span__isset __isset; - - void __set_trace_id(const int64_t val); - - void __set_name(const std::string& val); - - void __set_id(const int64_t val); - - void __set_parent_id(const int64_t val); - - void __set_annotations(const std::vector & val); - - void __set_binary_annotations(const std::vector & val); - - void __set_debug(const bool val); - - void __set_timestamp(const int64_t val); - - void __set_duration(const int64_t val); - - void __set_trace_id_high(const int64_t val); - - bool operator == (const Span & rhs) const - { - if (!(trace_id == rhs.trace_id)) - return false; - if (!(name == rhs.name)) - return false; - if (!(id == rhs.id)) - return false; - if (__isset.parent_id != rhs.__isset.parent_id) - return false; - else if (__isset.parent_id && !(parent_id == rhs.parent_id)) - return false; - if (!(annotations == rhs.annotations)) - return false; - if (!(binary_annotations == rhs.binary_annotations)) - return false; - if (__isset.debug != rhs.__isset.debug) - return false; - else if (__isset.debug && !(debug == rhs.debug)) - return false; - if (__isset.timestamp != rhs.__isset.timestamp) - return false; - else if (__isset.timestamp && !(timestamp == rhs.timestamp)) - return false; - if (__isset.duration != rhs.__isset.duration) - return false; - else if (__isset.duration && !(duration == rhs.duration)) - return false; - if (__isset.trace_id_high != rhs.__isset.trace_id_high) - return false; - else if (__isset.trace_id_high && !(trace_id_high == rhs.trace_id_high)) - return false; - return true; - } - bool operator != (const Span &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Span & ) 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 Span& obj); -}; - -void swap(Span &a, Span &b); - - -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}; - - Response(const Response&); - Response& operator=(const Response&); - Response() : ok(0) { - } - - virtual ~Response() throw(); - bool ok; - - void __set_ok(const bool val); - - bool operator == (const Response & rhs) const - { - if (!(ok == rhs.ok)) - return false; - return true; - } - bool operator != (const Response &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Response & ) 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 Response& obj); -}; - -void swap(Response &a, Response &b); - -}}} // namespace - -#endif diff --git a/src/jaegertracing/utils/UDPClient.cpp b/src/jaegertracing/utils/UDPClient.cpp index 5c6e8a42..22c4624e 100644 --- a/src/jaegertracing/utils/UDPClient.cpp +++ b/src/jaegertracing/utils/UDPClient.cpp @@ -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( + jaegertracing::stdcxx::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 c4cce724..acf998ff 100644 --- a/src/jaegertracing/utils/UDPClient.h +++ b/src/jaegertracing/utils/UDPClient.h @@ -25,6 +25,8 @@ #include #include +#include "jaegertracing/jaeger_smartptr.h" + #include "jaegertracing/net/IPAddress.h" #include "jaegertracing/net/Socket.h" #include "jaegertracing/thrift-gen/Agent.h" @@ -38,12 +40,6 @@ class UDPClient : public agent::thrift::AgentIf { ~UDPClient() { close(); } - void emitZipkinBatch( - const std::vector& spans) override - { - throw std::logic_error("emitZipkinBatch not implemented"); - } - void emitBatch(const thrift::Batch& batch) override { _buffer->resetBuffer(); @@ -75,7 +71,7 @@ class UDPClient : public agent::thrift::AgentIf { private: int _maxPacketSize; - boost::shared_ptr _buffer; + jaegertracing::stdcxx::shared_ptr _buffer; net::Socket _socket; net::IPAddress _serverAddr; std::unique_ptr _client; diff --git a/src/jaegertracing/utils/UDPClientTest.cpp b/src/jaegertracing/utils/UDPClientTest.cpp index 22fa7fdc..d3542637 100644 --- a/src/jaegertracing/utils/UDPClientTest.cpp +++ b/src/jaegertracing/utils/UDPClientTest.cpp @@ -17,7 +17,6 @@ #include "jaegertracing/net/IPAddress.h" #include "jaegertracing/net/Socket.h" #include "jaegertracing/thrift-gen/jaeger_types.h" -#include "jaegertracing/thrift-gen/zipkincore_types.h" #include "jaegertracing/utils/UDPClient.h" #include #include @@ -29,32 +28,6 @@ namespace jaegertracing { namespace utils { -TEST(UDPClient, testZipkinMessage) -{ - net::IPAddress serverAddr; - std::promise started; - std::thread serverThread([&serverAddr, &started]() { - net::Socket socket; - socket.open(AF_INET, SOCK_DGRAM); - socket.bind(net::IPAddress::v4("127.0.0.1", 0)); - ::sockaddr_storage addrStorage; - ::socklen_t addrLen = sizeof(addrStorage); - const auto returnCode = - ::getsockname(socket.handle(), - reinterpret_cast<::sockaddr*>(&addrStorage), - &addrLen); - ASSERT_EQ(0, returnCode); - serverAddr = net::IPAddress(addrStorage, addrLen); - started.set_value(); - }); - - started.get_future().wait(); - UDPClient udpClient(serverAddr, 0); - using ZipkinBatch = std::vector; - ASSERT_THROW(udpClient.emitZipkinBatch(ZipkinBatch()), std::logic_error); - serverThread.join(); -} - TEST(UDPClient, testBigMessage) { net::IPAddress serverAddr;