summaryrefslogtreecommitdiffstats
path: root/src/jaegertracing/opentelemetry-cpp/exporters/jaeger
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-21 11:54:28 +0000
commite6918187568dbd01842d8d1d2c808ce16a894239 (patch)
tree64f88b554b444a49f656b6c656111a145cbbaa28 /src/jaegertracing/opentelemetry-cpp/exporters/jaeger
parentInitial commit. (diff)
downloadceph-e6918187568dbd01842d8d1d2c808ce16a894239.tar.xz
ceph-e6918187568dbd01842d8d1d2c808ce16a894239.zip
Adding upstream version 18.2.2.upstream/18.2.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/jaegertracing/opentelemetry-cpp/exporters/jaeger')
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/BUILD217
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/CMakeLists.txt95
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/README.md61
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h93
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h119
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.cc61
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.h40
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.cc113
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.h53
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.cc37
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.h39
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/jaeger_exporter.cc111
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/recordable.cc365
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/sender.h32
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.cc99
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.h78
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/transport.h30
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.cc86
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.h57
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_exporter_test.cc175
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_recordable_test.cc334
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.cpp380
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.h309
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp47
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.cpp481
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.h299
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp42
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.cpp481
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.h299
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp42
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/agent_types.h28
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.cpp1354
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.h481
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.cpp49
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.h40
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.cpp913
-rw-r--r--src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.h493
37 files changed, 8033 insertions, 0 deletions
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/BUILD b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/BUILD
new file mode 100644
index 000000000..cc1babae0
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/BUILD
@@ -0,0 +1,217 @@
+package(default_visibility = ["//visibility:public"])
+
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake", "configure_make", "configure_make_variant")
+
+constraint_setting(
+ name = "incompatible_setting",
+)
+
+constraint_value(
+ name = "incompatible",
+ constraint_setting = ":incompatible_setting",
+)
+
+config_setting(
+ name = "windows",
+ constraint_values = [
+ "@bazel_tools//platforms:windows",
+ ],
+ tags = ["jaeger"],
+ visibility = ["//visibility:private"],
+)
+
+THRIFT_CACHE_ENTRIES = {
+ "CMAKE_BUILD_TYPE": "Release",
+ "BUILD_COMPILER": "OFF",
+ "BUILD_CPP": "ON",
+ "BUILD_LIBRARIES": "ON",
+ "BUILD_NODEJS": "OFF",
+ "BUILD_PYTHON": "OFF",
+ "BUILD_JAVASCRIPT": "OFF",
+ "BUILD_C_GLIB": "OFF",
+ "BUILD_JAVA": "OFF",
+ "BUILD_TESTING": "OFF",
+ "BUILD_TUTORIALS": "OFF",
+ "WITH_HASKELL": "OFF",
+}
+
+THRIFT_CACHE_ENTRIES_WIN = {
+ "CMAKE_BUILD_TYPE": "Release",
+ "BUILD_COMPILER": "OFF",
+ "BUILD_CPP": "ON",
+ "BUILD_LIBRARIES": "ON",
+ "BUILD_NODEJS": "OFF",
+ "BUILD_PYTHON": "OFF",
+ "BUILD_JAVASCRIPT": "OFF",
+ "BUILD_C_GLIB": "OFF",
+ "BUILD_JAVA": "OFF",
+ "BUILD_TESTING": "OFF",
+ "BUILD_TUTORIALS": "OFF",
+ "WITH_HASKELL": "OFF",
+ "WITH_STDTHREADS": "ON",
+ "WITH_BOOSTTHREADS": "OFF",
+ "WITH_BOOST_FUNCTIONAL": "OFF",
+ "WITH_BOOST_SMART_PTR": "OFF",
+ "BUILD_SHARED_LIBS": "OFF",
+ "CMAKE_TOOLCHAIN_FILE": "$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake",
+}
+
+cmake(
+ name = "thrift",
+ cache_entries = select({
+ "@bazel_tools//platforms:osx": THRIFT_CACHE_ENTRIES,
+ "@bazel_tools//platforms:linux": THRIFT_CACHE_ENTRIES,
+ "@bazel_tools//platforms:windows": THRIFT_CACHE_ENTRIES_WIN,
+ }),
+ copts = [
+ "-Ilibs/exporters/jaeger/openssl/include",
+ "-fexceptions",
+ ],
+ generate_args = select({
+ "@bazel_tools//platforms:osx": [],
+ "@bazel_tools//platforms:linux": [],
+ "@bazel_tools//platforms:windows": [
+ "-G \"NMake Makefiles\"",
+ ],
+ }),
+ install = True,
+ lib_source = "@com_github_thrift//:all_srcs",
+ out_lib_dir = select({
+ "@bazel_tools//platforms:osx": "lib",
+ "@bazel_tools//platforms:linux": "lib",
+ "@bazel_tools//platforms:windows": "bin",
+ }),
+ out_static_libs = select({
+ "@bazel_tools//platforms:osx": [
+ "libthrift.a",
+ "libthriftz.a",
+ ],
+ "@bazel_tools//platforms:linux": [
+ "libthrift.a",
+ "libthriftz.a",
+ ],
+ "@bazel_tools//platforms:windows": [
+ "thriftmd.lib",
+ ],
+ }),
+ tags = ["jaeger"],
+ visibility = ["//visibility:private"],
+ deps = [],
+)
+
+THRIFT_GEN_DEPS = [
+ ":thrift",
+ "//ext/src/http/client/curl:http_client_curl",
+]
+
+THRIFT_GEN_DEPS_WIN = THRIFT_GEN_DEPS + [
+ "@boost_all_hdrs//:boost_all_hdrs",
+]
+
+cc_library(
+ name = "jaeger_thrift_gencpp",
+ srcs = [
+ "thrift-gen/Agent.cpp",
+ "thrift-gen/Collector.cpp",
+ "thrift-gen/ZipkinCollector.cpp",
+ "thrift-gen/jaeger_types.cpp",
+ "thrift-gen/zipkincore_constants.cpp",
+ "thrift-gen/zipkincore_types.cpp",
+ ],
+ hdrs = [
+ "thrift-gen/Agent.h",
+ "thrift-gen/Collector.h",
+ "thrift-gen/ZipkinCollector.h",
+ "thrift-gen/agent_types.h",
+ "thrift-gen/jaeger_types.h",
+ "thrift-gen/zipkincore_constants.h",
+ "thrift-gen/zipkincore_types.h",
+ ],
+ copts = [
+ "-fexceptions",
+ ],
+ strip_include_prefix = "thrift-gen",
+ tags = ["jaeger"],
+ deps = select({
+ "@bazel_tools//platforms:osx": THRIFT_GEN_DEPS,
+ "@bazel_tools//platforms:linux": THRIFT_GEN_DEPS,
+ "@bazel_tools//platforms:windows": THRIFT_GEN_DEPS_WIN,
+ }),
+)
+
+cc_library(
+ name = "jaeger_exporter",
+ srcs = [
+ ],
+ hdrs = [
+ "src/THttpTransport.h",
+ "src/TUDPTransport.h",
+ "src/http_transport.h",
+ "src/sender.h",
+ "src/thrift_sender.h",
+ "src/transport.h",
+ "src/udp_transport.h",
+ ],
+ copts = ["-fexceptions"],
+ strip_include_prefix = "src",
+ tags = ["jaeger"],
+ deps = [
+ ":jaeger_thrift_gencpp",
+ ],
+)
+
+cc_library(
+ name = "opentelemetry_exporter_jaeger_trace",
+ srcs = [
+ "src/THttpTransport.cc",
+ "src/TUDPTransport.cc",
+ "src/http_transport.cc",
+ "src/jaeger_exporter.cc",
+ "src/recordable.cc",
+ "src/thrift_sender.cc",
+ "src/udp_transport.cc",
+ ],
+ hdrs = [
+ "include/opentelemetry/exporters/jaeger/jaeger_exporter.h",
+ "include/opentelemetry/exporters/jaeger/recordable.h",
+ ],
+ copts = ["-fexceptions"],
+ strip_include_prefix = "include",
+ tags = ["jaeger"],
+ deps = [
+ ":jaeger_exporter",
+ "//sdk/src/common:global_log_handler",
+ ],
+)
+
+cc_test(
+ name = "jaeger_recordable_test",
+ srcs = ["test/jaeger_recordable_test.cc"],
+ copts = ["-fexceptions"],
+ tags = [
+ "jaeger",
+ "test",
+ ],
+ deps = [
+ ":opentelemetry_exporter_jaeger_trace",
+ "//sdk/src/resource",
+ "@com_google_googletest//:gtest_main",
+ ],
+)
+
+cc_test(
+ name = "jaeger_exporter_test",
+ srcs = ["test/jaeger_exporter_test.cc"],
+ copts = ["-fexceptions"],
+ defines = ["BAZEL_BUILD"],
+ tags = [
+ "jaeger",
+ "test",
+ ],
+ deps = [
+ ":opentelemetry_exporter_jaeger_trace",
+ "//sdk/src/resource",
+ "//sdk/src/trace",
+ "@com_google_googletest//:gtest_main",
+ ],
+)
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/CMakeLists.txt b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/CMakeLists.txt
new file mode 100644
index 000000000..a95c0cc94
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/CMakeLists.txt
@@ -0,0 +1,95 @@
+include_directories(thrift-gen)
+
+find_package(Thrift REQUIRED)
+# vcpkg config recipe points to THRIFT_INCLUDE_DIR=...\thrift . Ensure that the
+# include dir for thrift-gen code is 1 level-up from that:
+include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}/..)
+
+set(JAEGER_THRIFT_GENCPP_SOURCES
+ thrift-gen/Agent.cpp thrift-gen/jaeger_types.cpp thrift-gen/Collector.cpp
+ thrift-gen/zipkincore_types.cpp)
+
+set(JAEGER_EXPORTER_SOURCES
+ src/jaeger_exporter.cc
+ src/thrift_sender.cc
+ src/udp_transport.cc
+ src/recordable.cc
+ src/TUDPTransport.cc
+ src/http_transport.cc
+ src/THttpTransport.cc)
+
+add_library(opentelemetry_exporter_jaeger_trace ${JAEGER_EXPORTER_SOURCES}
+ ${JAEGER_THRIFT_GENCPP_SOURCES})
+
+set_target_properties(opentelemetry_exporter_jaeger_trace
+ PROPERTIES EXPORT_NAME jaeger_trace_exporter)
+
+target_include_directories(
+ opentelemetry_exporter_jaeger_trace
+ PUBLIC "$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>"
+ "$<INSTALL_INTERFACE:include>")
+
+target_link_libraries(
+ opentelemetry_exporter_jaeger_trace
+ PUBLIC opentelemetry_resources opentelemetry_http_client_curl
+ PRIVATE thrift::thrift)
+
+if(MSVC)
+ target_compile_definitions(opentelemetry_exporter_jaeger_trace
+ PUBLIC NOMINMAX)
+ if(NOT BUILD_SHARED_LIBS)
+ target_compile_definitions(opentelemetry_exporter_jaeger_trace
+ PUBLIC THRIFT_STATIC_DEFINE)
+ endif()
+endif()
+
+install(
+ TARGETS opentelemetry_exporter_jaeger_trace
+ EXPORT "${PROJECT_NAME}-target"
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+
+install(
+ DIRECTORY include/opentelemetry/exporters/jaeger
+ DESTINATION include/opentelemetry/exporters
+ FILES_MATCHING
+ PATTERN "*.h"
+ PATTERN "recordable.h" EXCLUDE)
+
+if(BUILD_TESTING)
+ add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1)
+
+ add_executable(jaeger_recordable_test test/jaeger_recordable_test.cc)
+ target_link_libraries(
+ jaeger_recordable_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
+ opentelemetry_exporter_jaeger_trace)
+
+ gtest_add_tests(
+ TARGET jaeger_recordable_test
+ TEST_PREFIX exporter.
+ TEST_LIST jaeger_recordable_test)
+
+ add_executable(jaeger_exporter_test test/jaeger_exporter_test.cc)
+ if(MSVC)
+ if(GMOCK_LIB)
+ unset(GMOCK_LIB CACHE)
+ endif()
+ endif()
+ if(MSVC AND CMAKE_BUILD_TYPE STREQUAL "Debug")
+ find_library(GMOCK_LIB gmockd PATH_SUFFIXES lib)
+ else()
+ find_library(GMOCK_LIB gmock PATH_SUFFIXES lib)
+ endif()
+ target_link_libraries(
+ jaeger_exporter_test ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}
+ ${GMOCK_LIB} opentelemetry_trace opentelemetry_exporter_jaeger_trace)
+
+ target_include_directories(jaeger_exporter_test
+ PRIVATE ${CMAKE_CURRENT_LIST_DIR}/src)
+
+ gtest_add_tests(
+ TARGET jaeger_exporter_test
+ TEST_PREFIX exporter.
+ TEST_LIST jaeger_exporter_test)
+endif() # BUILD_TESTING
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/README.md b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/README.md
new file mode 100644
index 000000000..d4fa3b45b
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/README.md
@@ -0,0 +1,61 @@
+# Jaeger Exporter for OpenTelemetry C++
+
+## Prerequisite
+
+* [Get Jaeger](https://www.jaegertracing.io/docs/getting-started/) and run
+ Jaeger agent.
+
+## Installation
+
+### CMake Installation Instructions
+
+Refer to install instructions
+[INSTALL.md](../../INSTALL.md#building-as-standalone-cmake-project). Modify step
+2 to create `cmake` build configuration for compiling with Jaeger exporter as
+below:
+
+```console
+ $ cmake -DWITH_JAEGER=ON ..
+ -- The C compiler identification is GNU 9.3.0
+ -- The CXX compiler identification is GNU 9.3.0
+ ...
+ -- Configuring done
+ -- Generating done
+ -- Build files have been written to: /home/<user>/source/opentelemetry-cpp/build
+ $
+```
+
+### Bazel install Instructions
+
+Refer to install instructions
+[INSTALL.md](../../INSTALL.md#building-as-standalone-bazel-project).
+
+```console
+bazel build //exporters/jaeger:opentelemetry_exporter_jaeger_trace
+```
+
+## Usage
+
+Install the exporter in your application, initialize and pass the `options` to it.
+
+```cpp
+opentelemetry::exporter::jaeger::JaegerExporterOptions options;
+options.server_addr = "localhost";
+options.server_port = 6831;
+options.transport_format = opentelemetry::exporter::jaeger::TransportFormat::kThriftUdpCompact;
+
+auto exporter = std::unique_ptr<opentelemetry::sdk::trace::SpanExporter>(
+ new opentelemetry::exporter::jaeger::JaegerExporter(options));
+auto processor = std::shared_ptr<sdktrace::SpanProcessor>(
+ new sdktrace::SimpleSpanProcessor(std::move(exporter)));
+auto provider = nostd::shared_ptr<opentelemetry::trace::TracerProvider>(
+ new sdktrace::TracerProvider(processor));
+
+// Set the global trace provider
+opentelemetry::trace::Provider::SetTracerProvider(provider);
+
+```
+
+## Viewing your traces
+
+Please visit the Jaeger UI endpoint <http://localhost:16686>.
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h
new file mode 100644
index 000000000..284bab2ca
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h
@@ -0,0 +1,93 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include <opentelemetry/common/spin_lock_mutex.h>
+#include <opentelemetry/ext/http/client/http_client.h>
+#include <opentelemetry/sdk/trace/exporter.h>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+enum class TransportFormat
+{
+ kThriftUdp,
+ kThriftUdpCompact,
+ kThriftHttp,
+ kProtobufGrpc,
+};
+
+class ThriftSender;
+
+/**
+ * Struct to hold Jaeger exporter options.
+ */
+struct JaegerExporterOptions
+{
+ TransportFormat transport_format = TransportFormat::kThriftUdpCompact;
+ std::string endpoint = "localhost";
+ uint16_t server_port = 6831;
+ // Only applicable when using kThriftHttp transport.
+ ext::http::client::Headers headers;
+};
+
+class JaegerExporter final : public opentelemetry::sdk::trace::SpanExporter
+{
+public:
+ /**
+ * Create a JaegerExporter using all default options.
+ */
+ JaegerExporter();
+
+ /**
+ * Create a JaegerExporter using the given options.
+ */
+ explicit JaegerExporter(const JaegerExporterOptions &options);
+
+ /**
+ * Create a span recordable.
+ * @return a new initialized Recordable object.
+ */
+ std::unique_ptr<opentelemetry::sdk::trace::Recordable> MakeRecordable() noexcept override;
+
+ /**
+ * Export a batch of spans.
+ * @param spans a span of unique pointers to span recordables.
+ */
+ opentelemetry::sdk::common::ExportResult Export(
+ const nostd::span<std::unique_ptr<opentelemetry::sdk::trace::Recordable>> &spans) noexcept
+ override;
+
+ /**
+ * Shutdown the exporter.
+ * @param timeout an option timeout, default to max.
+ */
+ bool Shutdown(
+ std::chrono::microseconds timeout = std::chrono::microseconds::max()) noexcept override;
+
+private:
+ void InitializeEndpoint();
+
+private:
+ // The configuration options associated with this exporter.
+ bool is_shutdown_ = false;
+ JaegerExporterOptions options_;
+ std::unique_ptr<ThriftSender> sender_;
+ mutable opentelemetry::common::SpinLockMutex lock_;
+ bool isShutdown() const noexcept;
+ // For testing
+ friend class JaegerExporterTestPeer;
+ /**
+ * Create an JaegerExporter using the specified thrift sender.
+ * Only tests can call this constructor directly.
+ * @param sender the thrift sender to be used for exporting
+ */
+ JaegerExporter(std::unique_ptr<ThriftSender> sender);
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h
new file mode 100644
index 000000000..98e1e6131
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h
@@ -0,0 +1,119 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include <jaeger_types.h>
+#include <opentelemetry/sdk/trace/recordable.h>
+#include <opentelemetry/version.h>
+
+#if (defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
+ __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
+# define JAEGER_IS_LITTLE_ENDIAN 1
+#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
+ __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
+# define JAEGER_IS_LITTLE_ENDIAN 0
+#elif defined(_WIN32)
+# define JAEGER_IS_LITTLE_ENDIAN 1
+#else
+# error "Endian detection needs to be set up for your compiler"
+#endif
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+#if JAEGER_IS_LITTLE_ENDIAN == 1
+
+# if defined(__clang__) || \
+ (defined(__GNUC__) && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 8) || __GNUC__ >= 5))
+inline uint64_t otel_bswap_64(uint64_t host_int)
+{
+ return __builtin_bswap64(host_int);
+}
+
+# elif defined(_MSC_VER)
+inline uint64_t otel_bswap_64(uint64_t host_int)
+{
+ return _byteswap_uint64(host_int);
+}
+
+# else
+# error "Port need to support endianess conversion"
+
+# endif
+
+#endif
+
+using namespace jaegertracing;
+
+class JaegerRecordable final : public sdk::trace::Recordable
+{
+public:
+ JaegerRecordable();
+
+ thrift::Span *Span() noexcept { return span_.release(); }
+ std::vector<thrift::Tag> Tags() noexcept { return std::move(tags_); }
+ std::vector<thrift::Tag> ResourceTags() noexcept { return std::move(resource_tags_); }
+ std::vector<thrift::Log> Logs() noexcept { return std::move(logs_); }
+ std::vector<thrift::SpanRef> References() noexcept { return std::move(references_); }
+ const std::string &ServiceName() const noexcept { return service_name_; }
+
+ void SetIdentity(const opentelemetry::trace::SpanContext &span_context,
+ opentelemetry::trace::SpanId parent_span_id) noexcept override;
+
+ void SetAttribute(nostd::string_view key,
+ const opentelemetry::common::AttributeValue &value) noexcept override;
+
+ void AddEvent(nostd::string_view key,
+ common::SystemTimestamp timestamp,
+ const common::KeyValueIterable &attributes) noexcept override;
+
+ void AddLink(const opentelemetry::trace::SpanContext &span_context,
+ const common::KeyValueIterable &attributes) noexcept override;
+
+ void SetStatus(trace::StatusCode code, nostd::string_view description) noexcept override;
+
+ void SetName(nostd::string_view name) noexcept override;
+
+ void SetStartTime(common::SystemTimestamp start_time) noexcept override;
+
+ void SetSpanKind(opentelemetry::trace::SpanKind span_kind) noexcept override;
+
+ void SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept override;
+
+ void SetDuration(std::chrono::nanoseconds duration) noexcept override;
+
+ void SetInstrumentationLibrary(
+ const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
+ &instrumentation_library) noexcept override;
+
+private:
+ void AddTag(const std::string &key, const std::string &value, std::vector<thrift::Tag> &tags);
+ void AddTag(const std::string &key, const char *value, std::vector<thrift::Tag> &tags);
+ void AddTag(const std::string &key, bool value, std::vector<thrift::Tag> &tags);
+ void AddTag(const std::string &key, int64_t value, std::vector<thrift::Tag> &tags);
+ void AddTag(const std::string &key, double value, std::vector<thrift::Tag> &tags);
+
+ void PopulateAttribute(nostd::string_view key,
+ const opentelemetry::common::AttributeValue &value,
+ std::vector<thrift::Tag> &tags);
+
+ void PopulateAttribute(nostd::string_view key,
+ const sdk::common::OwnedAttributeValue &value,
+ std::vector<thrift::Tag> &tags);
+
+private:
+ std::unique_ptr<thrift::Span> span_;
+ std::vector<thrift::Tag> tags_;
+ std::vector<thrift::Tag> resource_tags_;
+ std::vector<thrift::Log> logs_;
+ std::vector<thrift::SpanRef> references_;
+ std::string service_name_;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.cc
new file mode 100644
index 000000000..cbb1b65cb
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.cc
@@ -0,0 +1,61 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include "THttpTransport.h"
+#include "opentelemetry/ext/http/client/http_client_factory.h"
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+THttpTransport::THttpTransport(std::string endpoint, ext::http::client::Headers extra_headers)
+ : endpoint(std::move(endpoint)),
+ headers(std::move(extra_headers)),
+ client(ext::http::client::HttpClientFactory::CreateSync())
+{
+ headers.insert({{"Content-Type", "application/vnd.apache.thrift.binary"}});
+}
+
+THttpTransport::~THttpTransport() {}
+
+bool THttpTransport::isOpen() const
+{
+ return true;
+}
+
+uint32_t THttpTransport::read(uint8_t *buf, uint32_t len)
+{
+ (void)buf;
+ (void)len;
+ return 0;
+}
+
+void THttpTransport::write(const uint8_t *buf, uint32_t len)
+{
+ request_buffer.insert(request_buffer.end(), buf, buf + len);
+}
+
+bool THttpTransport::sendSpans()
+{
+ auto result = client->Post(endpoint, request_buffer, headers);
+ request_buffer.clear();
+
+ // TODO: Add logging once global log handling is available.
+ if (!result)
+ {
+ return false;
+ }
+
+ if (result.GetResponse().GetStatusCode() >= 400)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.h
new file mode 100644
index 000000000..9c796e67a
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/THttpTransport.h
@@ -0,0 +1,40 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include <opentelemetry/ext/http/client/http_client.h>
+#include <opentelemetry/version.h>
+
+#include <thrift/transport/TVirtualTransport.h>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+class THttpTransport : public apache::thrift::transport::TVirtualTransport<THttpTransport>
+{
+public:
+ THttpTransport(std::string endpoint, ext::http::client::Headers extra_headers);
+ ~THttpTransport() override;
+
+ bool isOpen() const override;
+
+ uint32_t read(uint8_t *buf, uint32_t len);
+
+ void write(const uint8_t *buf, uint32_t len);
+
+ bool sendSpans();
+
+private:
+ std::string endpoint;
+ ext::http::client::Headers headers;
+ std::shared_ptr<ext::http::client::HttpClientSync> client;
+ std::vector<uint8_t> request_buffer;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.cc
new file mode 100644
index 000000000..e41112739
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.cc
@@ -0,0 +1,113 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include <sstream> // std::stringstream
+
+#include "TUDPTransport.h"
+#include "opentelemetry/sdk_config.h"
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+TUDPTransport::TUDPTransport(const std::string &host, int port)
+ : host_(host), port_(port), socket_(THRIFT_INVALID_SOCKET)
+{}
+
+TUDPTransport::~TUDPTransport()
+{
+ if (server_addr_info_)
+ {
+ freeaddrinfo(server_addr_info_);
+ server_addr_info_ = nullptr;
+ sockaddr_len = 0;
+ }
+ close();
+}
+
+bool TUDPTransport::isOpen() const
+{
+ return (socket_ != THRIFT_INVALID_SOCKET);
+}
+
+void TUDPTransport::open()
+{
+ if (isOpen())
+ {
+ return;
+ }
+
+ struct addrinfo hints;
+ int error;
+ char port[sizeof("65535") + 1];
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_DGRAM;
+ hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
+
+ sprintf(port, "%d", port_);
+
+ error = getaddrinfo(host_.c_str(), port, &hints, &server_addr_info_);
+
+ if (error)
+ {
+ OTEL_INTERNAL_LOG_ERROR("Jaeger Exporter: getaddrinfo failed with error: " << error);
+ return;
+ }
+
+ socket_ = socket(server_addr_info_->ai_family, server_addr_info_->ai_socktype,
+ server_addr_info_->ai_protocol);
+ sockaddr_len = server_addr_info_->ai_addr->sa_family == AF_INET ? sizeof(struct sockaddr_in)
+ : sizeof(struct sockaddr_in6);
+}
+
+void TUDPTransport::close()
+{
+ if (socket_ != THRIFT_INVALID_SOCKET)
+ {
+ ::THRIFT_CLOSESOCKET(socket_);
+ }
+ socket_ = THRIFT_INVALID_SOCKET;
+}
+
+uint32_t TUDPTransport::read(uint8_t *buf, uint32_t len)
+{
+ if (!server_addr_info_)
+ {
+ return 0;
+ }
+ uint32_t num_read = recvfrom(socket_,
+#if defined(_WIN32)
+ reinterpret_cast<char *>(buf), len, 0, server_addr_info_->ai_addr,
+ reinterpret_cast<int *>(&sockaddr_len)
+#else
+ buf, len, 0, server_addr_info_->ai_addr, &sockaddr_len
+#endif
+ );
+
+ return num_read;
+}
+
+void TUDPTransport::write(const uint8_t *buf, uint32_t len)
+{
+ if (!server_addr_info_)
+ {
+ return;
+ }
+ sendto(socket_,
+#if defined(_WIN32)
+ reinterpret_cast<const char *>(buf),
+#else
+ buf,
+#endif
+ len, 0, server_addr_info_->ai_addr, sockaddr_len);
+}
+
+void TUDPTransport::flush() {}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.h
new file mode 100644
index 000000000..df3151d11
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/TUDPTransport.h
@@ -0,0 +1,53 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#ifdef _WIN32
+# include <winsock2.h>
+#else
+# include <netdb.h>
+# include <string.h>
+# include <sys/socket.h>
+# include <sys/types.h>
+#endif
+
+#include <opentelemetry/version.h>
+#include <thrift/transport/PlatformSocket.h>
+#include <thrift/transport/TVirtualTransport.h>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+class TUDPTransport : public apache::thrift::transport::TVirtualTransport<TUDPTransport>
+{
+public:
+ TUDPTransport(const std::string &host, int port);
+ ~TUDPTransport() override;
+
+ bool isOpen() const override;
+
+ void open() override;
+
+ void close() override;
+
+ uint32_t read(uint8_t *buf, uint32_t len);
+
+ void write(const uint8_t *buf, uint32_t len);
+
+ void flush() override;
+
+private:
+ std::string host_;
+ int port_;
+ THRIFT_SOCKET socket_;
+ struct addrinfo *server_addr_info_ = nullptr;
+ uint32_t sockaddr_len = 0;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.cc
new file mode 100644
index 000000000..f804ccc84
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.cc
@@ -0,0 +1,37 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include "http_transport.h"
+
+#include <thrift/protocol/TBinaryProtocol.h>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using TBinaryProtocol = apache::thrift::protocol::TBinaryProtocol;
+using TTransport = apache::thrift::transport::TTransport;
+
+HttpTransport::HttpTransport(std::string endpoint, ext::http::client::Headers headers)
+{
+ endpoint_transport_ = std::make_shared<THttpTransport>(std::move(endpoint), std::move(headers));
+ protocol_ = std::shared_ptr<TProtocol>(new TBinaryProtocol(endpoint_transport_));
+}
+
+int HttpTransport::EmitBatch(const thrift::Batch &batch)
+{
+ batch.write(protocol_.get());
+
+ if (!endpoint_transport_->sendSpans())
+ {
+ return 0;
+ }
+
+ return static_cast<int>(batch.spans.size());
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.h
new file mode 100644
index 000000000..8f5c9c057
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/http_transport.h
@@ -0,0 +1,39 @@
+#pragma once
+
+#include "THttpTransport.h"
+#include "transport.h"
+
+#include <thrift/protocol/TProtocol.h>
+#include <thrift/transport/TTransport.h>
+#include <memory>
+#include <string>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using TProtocol = apache::thrift::protocol::TProtocol;
+
+class HttpTransport : public Transport
+{
+public:
+ HttpTransport(std::string endpoint, ext::http::client::Headers headers);
+
+ int EmitBatch(const thrift::Batch &batch) override;
+
+ uint32_t MaxPacketSize() const override
+ {
+ // Default to 4 MiB POST body size.
+ return 1 << 22;
+ }
+
+private:
+ std::shared_ptr<THttpTransport> endpoint_transport_;
+ std::shared_ptr<TProtocol> protocol_;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/jaeger_exporter.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/jaeger_exporter.cc
new file mode 100644
index 000000000..c07f2f010
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/jaeger_exporter.cc
@@ -0,0 +1,111 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include <agent_types.h>
+#include <opentelemetry/exporters/jaeger/jaeger_exporter.h>
+#include <opentelemetry/exporters/jaeger/recordable.h>
+#include "opentelemetry/sdk_config.h"
+
+#include "http_transport.h"
+#include "thrift_sender.h"
+#include "udp_transport.h"
+
+#include <mutex>
+#include <vector>
+
+namespace sdk_common = opentelemetry::sdk::common;
+namespace trace_sdk = opentelemetry::sdk::trace;
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+JaegerExporter::JaegerExporter(const JaegerExporterOptions &options) : options_(options)
+{
+ InitializeEndpoint();
+}
+
+JaegerExporter::JaegerExporter() : JaegerExporter(JaegerExporterOptions()) {}
+
+JaegerExporter::JaegerExporter(std::unique_ptr<ThriftSender> sender)
+ : options_(JaegerExporterOptions()), sender_(std::move(sender))
+{}
+
+std::unique_ptr<trace_sdk::Recordable> JaegerExporter::MakeRecordable() noexcept
+{
+ return std::unique_ptr<sdk::trace::Recordable>(new JaegerRecordable);
+}
+
+sdk_common::ExportResult JaegerExporter::Export(
+ const nostd::span<std::unique_ptr<sdk::trace::Recordable>> &spans) noexcept
+{
+ if (isShutdown())
+ {
+ OTEL_INTERNAL_LOG_ERROR("[Jaeger Trace Exporter] Exporting "
+ << spans.size() << " span(s) failed, exporter is shutdown");
+ return sdk_common::ExportResult::kFailure;
+ }
+
+ std::size_t exported_size = 0;
+
+ for (auto &recordable : spans)
+ {
+ auto rec =
+ std::unique_ptr<JaegerRecordable>(static_cast<JaegerRecordable *>(recordable.release()));
+ if (rec != nullptr)
+ {
+ exported_size += sender_->Append(std::move(rec));
+ }
+ }
+
+ exported_size += sender_->Flush();
+
+ if (exported_size == 0)
+ {
+ return sdk_common::ExportResult::kFailure;
+ }
+
+ return sdk_common::ExportResult::kSuccess;
+}
+
+void JaegerExporter::InitializeEndpoint()
+{
+ if (options_.transport_format == TransportFormat::kThriftUdpCompact)
+ {
+ // TODO: do we need support any authentication mechanism?
+ auto transport = std::unique_ptr<Transport>(
+ static_cast<Transport *>(new UDPTransport(options_.endpoint, options_.server_port)));
+ sender_ = std::unique_ptr<ThriftSender>(new ThriftSender(std::move(transport)));
+ return;
+ }
+
+ if (options_.transport_format == TransportFormat::kThriftHttp)
+ {
+ auto transport =
+ std::unique_ptr<HttpTransport>(new HttpTransport(options_.endpoint, options_.headers));
+ sender_ = std::unique_ptr<ThriftSender>(new ThriftSender(std::move(transport)));
+ return;
+ }
+
+ // The transport format is not implemented.
+ assert(false);
+}
+
+bool JaegerExporter::Shutdown(std::chrono::microseconds timeout) noexcept
+{
+ const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
+ is_shutdown_ = true;
+ return true;
+}
+
+bool JaegerExporter::isShutdown() const noexcept
+{
+ const std::lock_guard<opentelemetry::common::SpinLockMutex> locked(lock_);
+ return is_shutdown_;
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/recordable.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/recordable.cc
new file mode 100644
index 000000000..c4a61a5d2
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/recordable.cc
@@ -0,0 +1,365 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include "opentelemetry/exporters/jaeger/recordable.h"
+#include "opentelemetry/sdk/common/global_log_handler.h"
+#include "opentelemetry/sdk/resource/experimental_semantic_conventions.h"
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using namespace opentelemetry::sdk::resource;
+namespace trace_api = opentelemetry::trace;
+
+JaegerRecordable::JaegerRecordable() : span_{new thrift::Span} {}
+
+void JaegerRecordable::PopulateAttribute(nostd::string_view key,
+ const common::AttributeValue &value,
+ std::vector<thrift::Tag> &tags)
+{
+ if (nostd::holds_alternative<int32_t>(value))
+ {
+ AddTag(std::string{key}, int64_t{nostd::get<int32_t>(value)}, tags);
+ }
+ else if (nostd::holds_alternative<uint32_t>(value))
+ {
+ AddTag(std::string{key}, int64_t{nostd::get<uint32_t>(value)}, tags);
+ }
+ else if (nostd::holds_alternative<int64_t>(value))
+ {
+ AddTag(std::string{key}, nostd::get<int64_t>(value), tags);
+ }
+ else if (nostd::holds_alternative<bool>(value))
+ {
+ AddTag(std::string{key}, nostd::get<bool>(value), tags);
+ }
+ else if (nostd::holds_alternative<double>(value))
+ {
+ AddTag(std::string{key}, nostd::get<double>(value), tags);
+ }
+ else if (nostd::holds_alternative<const char *>(value))
+ {
+ AddTag(std::string{key}, std::string{nostd::get<const char *>(value)}, tags);
+ }
+ else if (nostd::holds_alternative<nostd::string_view>(value))
+ {
+ AddTag(std::string{key}, std::string{nostd::get<nostd::string_view>(value)}, tags);
+ }
+ else if (nostd::holds_alternative<nostd::span<const bool>>(value))
+ {
+ for (const auto &val : nostd::get<nostd::span<const bool>>(value))
+ {
+ AddTag(std::string{key}, val, tags);
+ }
+ }
+ else if (nostd::holds_alternative<nostd::span<const int32_t>>(value))
+ {
+ for (const auto &val : nostd::get<nostd::span<const int32_t>>(value))
+ {
+ AddTag(std::string{key}, int64_t{val}, tags);
+ }
+ }
+ else if (nostd::holds_alternative<nostd::span<const int64_t>>(value))
+ {
+ for (const auto &val : nostd::get<nostd::span<const int64_t>>(value))
+ {
+ AddTag(std::string{key}, val, tags);
+ }
+ }
+ else if (nostd::holds_alternative<nostd::span<const uint32_t>>(value))
+ {
+ for (const auto &val : nostd::get<nostd::span<const uint32_t>>(value))
+ {
+ AddTag(std::string{key}, int64_t{val}, tags);
+ }
+ }
+ else if (nostd::holds_alternative<nostd::span<const double>>(value))
+ {
+ for (const auto &val : nostd::get<nostd::span<const double>>(value))
+ {
+ AddTag(std::string{key}, val, tags);
+ }
+ }
+ else if (nostd::holds_alternative<nostd::span<const nostd::string_view>>(value))
+ {
+ for (const auto &val : nostd::get<nostd::span<const nostd::string_view>>(value))
+ {
+ AddTag(std::string{key}, std::string{val}, tags);
+ }
+ }
+ else
+ {
+ OTEL_INTERNAL_LOG_ERROR(
+ "[TRACE JAEGER Exporter] SetAttribute() failed, attribute type not supported ");
+ }
+}
+
+void JaegerRecordable::PopulateAttribute(nostd::string_view key,
+ const sdk::common::OwnedAttributeValue &value,
+ std::vector<thrift::Tag> &tags)
+{
+ if (nostd::holds_alternative<int32_t>(value))
+ {
+ AddTag(std::string{key}, int64_t{nostd::get<int32_t>(value)}, tags);
+ }
+ else if (nostd::holds_alternative<uint32_t>(value))
+ {
+ AddTag(std::string{key}, int64_t{nostd::get<uint32_t>(value)}, tags);
+ }
+ else if (nostd::holds_alternative<int64_t>(value))
+ {
+ AddTag(std::string{key}, nostd::get<int64_t>(value), tags);
+ }
+ else if (nostd::holds_alternative<bool>(value))
+ {
+ AddTag(std::string{key}, nostd::get<bool>(value), tags);
+ }
+ else if (nostd::holds_alternative<double>(value))
+ {
+ AddTag(std::string{key}, nostd::get<double>(value), tags);
+ }
+ else if (nostd::holds_alternative<std::string>(value))
+ {
+ AddTag(std::string{key}, std::string{nostd::get<std::string>(value)}, tags);
+ }
+ else
+ {
+ OTEL_INTERNAL_LOG_ERROR(
+ "[TRACE JAEGER Exporter] SetAttribute() failed, attribute type not supported ");
+ }
+}
+
+void JaegerRecordable::SetIdentity(const trace::SpanContext &span_context,
+ trace::SpanId parent_span_id) noexcept
+{
+ // IDs should be converted to big endian before transmission.
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md#ids
+#if JAEGER_IS_LITTLE_ENDIAN == 1
+ span_->__set_traceIdHigh(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()))));
+ span_->__set_traceIdLow(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()) + 1)));
+ span_->__set_spanId(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.span_id().Id().data()))));
+ span_->__set_parentSpanId(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(parent_span_id.Id().data()))));
+#else
+ span_->__set_traceIdLow(
+ *(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data())));
+ span_->__set_traceIdHigh(
+ *(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()) + 1));
+ span_->__set_spanId(*(reinterpret_cast<const int64_t *>(span_context.span_id().Id().data())));
+ span_->__set_parentSpanId(*(reinterpret_cast<const int64_t *>(parent_span_id.Id().data())));
+#endif
+
+ // TODO: set trace_state.
+}
+
+void JaegerRecordable::SetAttribute(nostd::string_view key,
+ const common::AttributeValue &value) noexcept
+{
+ PopulateAttribute(key, value, tags_);
+}
+
+void JaegerRecordable::AddEvent(nostd::string_view name,
+ common::SystemTimestamp timestamp,
+ const common::KeyValueIterable &attributes) noexcept
+{
+ std::vector<thrift::Tag> tags;
+ PopulateAttribute("event", static_cast<common::AttributeValue>(name.data()), tags);
+
+ attributes.ForEachKeyValue([&](nostd::string_view key, common::AttributeValue value) noexcept {
+ PopulateAttribute(key, value, tags);
+ return true;
+ });
+ thrift::Log log;
+ log.__set_fields(tags);
+ log.__set_timestamp(
+ std::chrono::duration_cast<std::chrono::microseconds>(timestamp.time_since_epoch()).count());
+ logs_.push_back(log);
+}
+
+void JaegerRecordable::SetInstrumentationLibrary(
+ const opentelemetry::sdk::instrumentationlibrary::InstrumentationLibrary
+ &instrumentation_library) noexcept
+{
+ AddTag("otel.library.name", instrumentation_library.GetName(), tags_);
+ AddTag("otel.library.version", instrumentation_library.GetVersion(), tags_);
+}
+
+void JaegerRecordable::AddLink(const trace::SpanContext &span_context,
+ const common::KeyValueIterable &attributes) noexcept
+{
+ // Note: "The Link’s attributes cannot be represented in Jaeger explicitly."
+ // -- https://opentelemetry.io/docs/reference/specification/trace/sdk_exporters/jaeger/#links
+ //
+ // This implementation does not (currently) implement the optional conversion to span logs.
+
+ thrift::SpanRef reference;
+
+ reference.__set_refType(thrift::SpanRefType::FOLLOWS_FROM);
+
+ // IDs should be converted to big endian before transmission.
+ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk_exporters/jaeger.md#ids
+#if JAEGER_IS_LITTLE_ENDIAN == 1
+ reference.__set_traceIdHigh(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()))));
+ reference.__set_traceIdLow(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()) + 1)));
+ reference.__set_spanId(
+ otel_bswap_64(*(reinterpret_cast<const int64_t *>(span_context.span_id().Id().data()))));
+#else
+ reference.__set_traceIdLow(
+ *(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data())));
+ reference.__set_traceIdHigh(
+ *(reinterpret_cast<const int64_t *>(span_context.trace_id().Id().data()) + 1));
+ reference.__set_spanId(*(reinterpret_cast<const int64_t *>(span_context.span_id().Id().data())));
+#endif
+
+ references_.push_back(reference);
+}
+
+void JaegerRecordable::SetStatus(trace::StatusCode code, nostd::string_view description) noexcept
+{
+ if (code == trace::StatusCode::kUnset)
+ {
+ return;
+ }
+
+ if (code == trace::StatusCode::kOk)
+ {
+ AddTag("otel.status_code", "OK", tags_);
+ }
+ else if (code == trace::StatusCode::kError)
+ {
+ AddTag("otel.status_code", "ERROR", tags_);
+ AddTag("error", true, tags_);
+ }
+
+ AddTag("otel.status_description", std::string{description}, tags_);
+}
+
+void JaegerRecordable::SetName(nostd::string_view name) noexcept
+{
+ span_->__set_operationName(static_cast<std::string>(name));
+}
+
+void JaegerRecordable::SetResource(const opentelemetry::sdk::resource::Resource &resource) noexcept
+{
+ for (const auto &attribute_iter : resource.GetAttributes())
+ {
+ if (attribute_iter.first != "service.name")
+ {
+ PopulateAttribute(nostd::string_view{attribute_iter.first}, attribute_iter.second,
+ resource_tags_);
+ }
+ else
+ {
+ service_name_ = nostd::get<std::string>(attribute_iter.second);
+ }
+ }
+}
+
+void JaegerRecordable::SetStartTime(common::SystemTimestamp start_time) noexcept
+{
+ span_->__set_startTime(
+ std::chrono::duration_cast<std::chrono::microseconds>(start_time.time_since_epoch()).count());
+}
+
+void JaegerRecordable::SetDuration(std::chrono::nanoseconds duration) noexcept
+{
+ span_->__set_duration(std::chrono::duration_cast<std::chrono::microseconds>(duration).count());
+}
+
+void JaegerRecordable::SetSpanKind(trace::SpanKind span_kind) noexcept
+{
+ const char *span_kind_str = nullptr;
+
+ // map SpanKind to Jaeger tag span.kind.
+ switch (span_kind)
+ {
+ case trace_api::SpanKind::kClient: {
+ span_kind_str = "client";
+ break;
+ }
+ case trace_api::SpanKind::kServer: {
+ span_kind_str = "server";
+ break;
+ }
+ case trace_api::SpanKind::kConsumer: {
+ span_kind_str = "consumer";
+ break;
+ }
+ case trace_api::SpanKind::kProducer: {
+ span_kind_str = "producer";
+ break;
+ }
+ default:
+ break;
+ }
+
+ if (span_kind_str != nullptr)
+ {
+ AddTag("span.kind", span_kind_str, tags_);
+ }
+}
+
+void JaegerRecordable::AddTag(const std::string &key,
+ const std::string &value,
+ std::vector<thrift::Tag> &tags)
+{
+ thrift::Tag tag;
+
+ tag.__set_key(key);
+ tag.__set_vType(thrift::TagType::STRING);
+ tag.__set_vStr(value);
+
+ tags.push_back(tag);
+}
+
+void JaegerRecordable::AddTag(const std::string &key,
+ const char *value,
+ std::vector<thrift::Tag> &tags)
+{
+ AddTag(key, std::string{value}, tags);
+}
+
+void JaegerRecordable::AddTag(const std::string &key, bool value, std::vector<thrift::Tag> &tags)
+{
+ thrift::Tag tag;
+
+ tag.__set_key(key);
+ tag.__set_vType(thrift::TagType::BOOL);
+ tag.__set_vBool(value);
+
+ tags.push_back(tag);
+}
+
+void JaegerRecordable::AddTag(const std::string &key, int64_t value, std::vector<thrift::Tag> &tags)
+{
+ thrift::Tag tag;
+
+ tag.__set_key(key);
+ tag.__set_vType(thrift::TagType::LONG);
+ tag.__set_vLong(value);
+
+ tags.push_back(tag);
+}
+
+void JaegerRecordable::AddTag(const std::string &key, double value, std::vector<thrift::Tag> &tags)
+{
+ thrift::Tag tag;
+
+ tag.__set_key(key);
+ tag.__set_vType(thrift::TagType::DOUBLE);
+ tag.__set_vDouble(value);
+
+ tags.push_back(tag);
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/sender.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/sender.h
new file mode 100644
index 000000000..f4827b550
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/sender.h
@@ -0,0 +1,32 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include <opentelemetry/exporters/jaeger/recordable.h>
+#include <opentelemetry/version.h>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using namespace jaegertracing;
+
+class Sender
+{
+public:
+ Sender() = default;
+ virtual ~Sender() = default;
+
+ virtual int Append(std::unique_ptr<JaegerRecordable> &&span) = 0;
+
+ virtual int Flush() = 0;
+
+ virtual void Close() = 0;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.cc
new file mode 100644
index 000000000..46f0dcd5a
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.cc
@@ -0,0 +1,99 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include "thrift_sender.h"
+#include <opentelemetry/exporters/jaeger/recordable.h>
+#include "opentelemetry/sdk/common/global_log_handler.h"
+#include "udp_transport.h"
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using namespace jaegertracing;
+
+ThriftSender::ThriftSender(std::unique_ptr<Transport> &&transport)
+ : transport_(std::move(transport)),
+ protocol_factory_(new apache::thrift::protocol::TCompactProtocolFactory()),
+ thrift_buffer_(new apache::thrift::transport::TMemoryBuffer(transport_->MaxPacketSize()))
+{}
+
+int ThriftSender::Append(std::unique_ptr<JaegerRecordable> &&span) noexcept
+{
+ if (span == nullptr)
+ {
+ return 0;
+ }
+
+ uint32_t max_span_bytes = transport_->MaxPacketSize() - kEmitBatchOverhead;
+ if (process_.serviceName.empty())
+ {
+ process_.serviceName = span->ServiceName();
+ process_.__set_tags(span->ResourceTags());
+
+ process_bytes_size_ = CalcSizeOfSerializedThrift(process_);
+ max_span_bytes -= process_bytes_size_;
+ }
+
+ auto jaeger_span = std::unique_ptr<thrift::Span>(span->Span());
+ jaeger_span->__set_tags(span->Tags());
+ jaeger_span->__set_logs(span->Logs());
+ jaeger_span->__set_references(span->References());
+
+ const uint32_t span_size = CalcSizeOfSerializedThrift(*jaeger_span);
+ if (span_size > max_span_bytes)
+ {
+ OTEL_INTERNAL_LOG_ERROR("[JAEGER TRACE Exporter] Append() failed: too large span");
+ return 0;
+ }
+
+ byte_buffer_size_ += span_size;
+ if (byte_buffer_size_ <= max_span_bytes)
+ {
+ span_buffer_.push_back(*jaeger_span);
+ if (byte_buffer_size_ < max_span_bytes)
+ {
+ return 0;
+ }
+ else
+ {
+ // byte buffer is full so flush it before appending new span.
+ return Flush();
+ }
+ }
+
+ const auto flushed = Flush();
+ span_buffer_.push_back(*jaeger_span);
+ byte_buffer_size_ = span_size + process_bytes_size_;
+
+ return flushed;
+}
+
+int ThriftSender::Flush()
+{
+ if (span_buffer_.empty())
+ {
+ return 0;
+ }
+
+ thrift::Batch batch;
+ batch.__set_process(process_);
+ batch.__set_spans(span_buffer_);
+
+ int spans_flushed = transport_->EmitBatch(batch);
+
+ ResetBuffers();
+
+ return spans_flushed;
+}
+
+void ThriftSender::Close()
+{
+ Flush();
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.h
new file mode 100644
index 000000000..0ec8d47f1
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/thrift_sender.h
@@ -0,0 +1,78 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include <Agent.h>
+#include <atomic>
+#include <memory>
+#include <mutex>
+#include <vector>
+
+#include <thrift/protocol/TCompactProtocol.h>
+#include <thrift/transport/TBufferTransports.h>
+
+#include "sender.h"
+#include "transport.h"
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using namespace jaegertracing;
+
+class ThriftSender : public Sender
+{
+public:
+ static constexpr uint32_t kEmitBatchOverhead = 30;
+
+ ThriftSender(std::unique_ptr<Transport> &&transport);
+ ~ThriftSender() override { Close(); }
+
+ int Append(std::unique_ptr<JaegerRecordable> &&span) noexcept override;
+ int Flush() override;
+ void Close() override;
+
+private:
+ void ResetBuffers()
+ {
+ span_buffer_.clear();
+ byte_buffer_size_ = process_bytes_size_;
+ }
+
+ template <typename ThriftType>
+ uint32_t CalcSizeOfSerializedThrift(const ThriftType &base)
+ {
+ uint8_t *data = nullptr;
+ uint32_t size = 0;
+
+ thrift_buffer_->resetBuffer();
+ auto protocol = protocol_factory_->getProtocol(thrift_buffer_);
+ base.write(protocol.get());
+ thrift_buffer_->getBuffer(&data, &size);
+ return size;
+ }
+
+private:
+ std::vector<std::unique_ptr<JaegerRecordable>> spans_;
+ std::vector<thrift::Span> span_buffer_;
+ std::unique_ptr<Transport> transport_;
+ std::unique_ptr<apache::thrift::protocol::TProtocolFactory> protocol_factory_;
+ std::shared_ptr<apache::thrift::transport::TMemoryBuffer> thrift_buffer_;
+ thrift::Process process_;
+
+ // Size in bytes of the serialization buffer.
+ uint32_t byte_buffer_size_ = 0;
+ uint32_t process_bytes_size_ = 0;
+ uint32_t max_span_bytes_ = 0;
+ friend class MockThriftSender;
+
+protected:
+ ThriftSender() = default;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/transport.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/transport.h
new file mode 100644
index 000000000..8121e3007
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/transport.h
@@ -0,0 +1,30 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include <opentelemetry/version.h>
+
+#include <jaeger_types.h>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using namespace jaegertracing;
+
+class Transport
+{
+public:
+ Transport() = default;
+ virtual ~Transport() = default;
+
+ virtual int EmitBatch(const thrift::Batch &batch) = 0;
+ virtual uint32_t MaxPacketSize() const = 0;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.cc
new file mode 100644
index 000000000..9b1fe0caf
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.cc
@@ -0,0 +1,86 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include <sstream> // std::stringstream
+
+#include "opentelemetry/sdk_config.h"
+#include "udp_transport.h"
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+UDPTransport::UDPTransport(const std::string &addr, uint16_t port)
+ : max_packet_size_(kUDPPacketMaxLength)
+{
+ InitSocket();
+
+ endpoint_transport_ = std::shared_ptr<TTransport>(new TUDPTransport(addr, port));
+ endpoint_transport_->open();
+ transport_ =
+ std::shared_ptr<TTransport>(new TBufferedTransport(endpoint_transport_, max_packet_size_));
+ protocol_ = std::shared_ptr<TProtocol>(new TCompactProtocol(transport_));
+ agent_ = std::unique_ptr<AgentClient>(new AgentClient(protocol_));
+}
+
+UDPTransport::~UDPTransport()
+{
+ CleanSocket();
+}
+
+void UDPTransport::InitSocket()
+{
+#if defined(_WIN32)
+ /* Use the MAKEWORD(lowbyte, highbyte) macro declared in Windef.h */
+ WORD wVersionRequested = MAKEWORD(2, 2);
+
+ WSADATA wsaData;
+ int err = WSAStartup(wVersionRequested, &wsaData);
+ if (err != 0)
+ {
+ OTEL_INTERNAL_LOG_ERROR("Jaeger Exporter: WSAStartup failed with error: " << err);
+ return;
+ }
+
+ /* Confirm that the WinSock DLL supports 2.2. */
+ /* Note that if the DLL supports versions greater */
+ /* than 2.2 in addition to 2.2, it will still return */
+ /* 2.2 in wVersion since that is the version we */
+ /* requested. */
+
+ if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
+ {
+ OTEL_INTERNAL_LOG_ERROR("Jaeger Exporter: winsock " << LOBYTE(wsaData.wVersion) << "."
+ << HIBYTE(wsaData.wVersion)
+ << " is not supported.");
+ WSACleanup();
+
+ return;
+ }
+#endif
+}
+
+void UDPTransport::CleanSocket()
+{
+#if defined(_WIN32)
+ WSACleanup();
+#endif
+}
+
+int UDPTransport::EmitBatch(const thrift::Batch &batch)
+{
+ try
+ {
+ agent_->emitBatch(batch);
+ }
+ catch (...)
+ {}
+
+ return static_cast<int>(batch.spans.size());
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.h
new file mode 100644
index 000000000..0997a27c6
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/src/udp_transport.h
@@ -0,0 +1,57 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#pragma once
+
+#include "TUDPTransport.h"
+#include "transport.h"
+
+#include <Agent.h>
+#include <thrift/protocol/TBinaryProtocol.h>
+#include <thrift/protocol/TCompactProtocol.h>
+#include <thrift/protocol/TProtocol.h>
+#include <thrift/transport/TBufferTransports.h>
+#include <thrift/transport/TSocket.h>
+#include <thrift/transport/TTransport.h>
+#include <memory>
+#include <string>
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+using AgentClient = jaegertracing::agent::thrift::AgentClient;
+using TBinaryProtocol = apache::thrift::protocol::TBinaryProtocol;
+using TCompactProtocol = apache::thrift::protocol::TCompactProtocol;
+using TBufferedTransport = apache::thrift::transport::TBufferedTransport;
+using TProtocol = apache::thrift::protocol::TProtocol;
+using TTransport = apache::thrift::transport::TTransport;
+
+class UDPTransport : public Transport
+{
+public:
+ static constexpr auto kUDPPacketMaxLength = 65000;
+
+ UDPTransport(const std::string &addr, uint16_t port);
+ virtual ~UDPTransport();
+
+ int EmitBatch(const thrift::Batch &batch) override;
+
+ uint32_t MaxPacketSize() const override { return max_packet_size_; }
+
+ void InitSocket();
+ void CleanSocket();
+
+private:
+ std::unique_ptr<AgentClient> agent_;
+ std::shared_ptr<TTransport> endpoint_transport_;
+ std::shared_ptr<TTransport> transport_;
+ std::shared_ptr<TProtocol> protocol_;
+ uint32_t max_packet_size_;
+};
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_exporter_test.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_exporter_test.cc
new file mode 100644
index 000000000..7f86f877b
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_exporter_test.cc
@@ -0,0 +1,175 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include <opentelemetry/exporters/jaeger/jaeger_exporter.h>
+#include <memory>
+#include <vector>
+#include "opentelemetry/sdk/trace/batch_span_processor.h"
+#include "opentelemetry/sdk/trace/tracer_provider.h"
+
+#ifdef BAZEL_BUILD
+# include "exporters/jaeger/src/thrift_sender.h"
+#else
+# include "thrift_sender.h"
+#endif
+
+#include <gtest/gtest.h>
+#include "gmock/gmock.h"
+
+namespace trace = opentelemetry::trace;
+namespace nostd = opentelemetry::nostd;
+namespace sdktrace = opentelemetry::sdk::trace;
+namespace common = opentelemetry::common;
+namespace sdk_common = opentelemetry::sdk::common;
+
+using namespace testing;
+
+OPENTELEMETRY_BEGIN_NAMESPACE
+namespace exporter
+{
+namespace jaeger
+{
+
+namespace trace_api = opentelemetry::trace;
+namespace resource = opentelemetry::sdk::resource;
+
+template <class T, size_t N>
+static nostd::span<T, N> MakeSpan(T (&array)[N])
+{
+ return nostd::span<T, N>(array);
+}
+
+class JaegerExporterTestPeer : public ::testing::Test
+{
+public:
+ std::unique_ptr<sdk::trace::SpanExporter> GetExporter(std::unique_ptr<ThriftSender> sender)
+ {
+ return std::unique_ptr<sdk::trace::SpanExporter>(new JaegerExporter(std::move(sender)));
+ }
+
+ // Get the options associated with the given exporter.
+ const JaegerExporterOptions &GetOptions(std::unique_ptr<JaegerExporter> &exporter)
+ {
+ return exporter->options_;
+ }
+};
+
+class MockThriftSender : public ThriftSender
+{
+public:
+ MOCK_METHOD(int, Append, (std::unique_ptr<JaegerRecordable> &&), (noexcept, override));
+};
+
+class MockTransport : public Transport
+{
+public:
+ MOCK_METHOD(int, EmitBatch, (const thrift::Batch &), (override));
+ MOCK_METHOD(uint32_t, MaxPacketSize, (), (const, override));
+};
+
+// Create spans, let processor call Export()
+TEST_F(JaegerExporterTestPeer, ExportIntegrationTest)
+{
+ auto mock_transport = new MockTransport;
+ auto mock_thrift_sender = new ThriftSender(std::unique_ptr<MockTransport>{mock_transport});
+ auto exporter = GetExporter(std::unique_ptr<ThriftSender>{mock_thrift_sender});
+
+ resource::ResourceAttributes resource_attributes = {{"service.name", "unit_test_service"},
+ {"tenant.id", "test_user"}};
+ resource_attributes["bool_value"] = true;
+ resource_attributes["int32_value"] = static_cast<int32_t>(1);
+ resource_attributes["uint32_value"] = static_cast<uint32_t>(2);
+ resource_attributes["int64_value"] = static_cast<int64_t>(0x1100000000LL);
+ resource_attributes["double_value"] = static_cast<double>(3.1);
+ auto resource = resource::Resource::Create(resource_attributes);
+
+ auto processor_opts = sdk::trace::BatchSpanProcessorOptions();
+ processor_opts.max_export_batch_size = 5;
+ processor_opts.max_queue_size = 5;
+ processor_opts.schedule_delay_millis = std::chrono::milliseconds(256);
+ auto processor = std::unique_ptr<sdk::trace::SpanProcessor>(
+ new sdk::trace::BatchSpanProcessor(std::move(exporter), processor_opts));
+ auto provider = nostd::shared_ptr<trace::TracerProvider>(
+ new sdk::trace::TracerProvider(std::move(processor), resource));
+
+ EXPECT_CALL(*mock_transport, EmitBatch(_)).Times(Exactly(1)).WillOnce(Return(1));
+
+ auto tracer = provider->GetTracer("test");
+ auto parent_span = tracer->StartSpan("Test parent span");
+
+ trace_api::StartSpanOptions child_span_opts = {};
+ child_span_opts.parent = parent_span->GetContext();
+ auto child_span = tracer->StartSpan("Test child span", child_span_opts);
+
+ child_span->End();
+ parent_span->End();
+
+ auto parent_ctx = parent_span->GetContext();
+ auto child_ctx = child_span->GetContext();
+ EXPECT_EQ(parent_ctx.trace_id(), child_ctx.trace_id());
+ EXPECT_EQ(parent_ctx.trace_state(), child_ctx.trace_state());
+ ASSERT_TRUE(parent_ctx.IsValid());
+ ASSERT_TRUE(child_ctx.IsValid());
+}
+
+TEST_F(JaegerExporterTestPeer, ShutdownTest)
+{
+ auto mock_thrift_sender = new MockThriftSender;
+ auto exporter = GetExporter(std::unique_ptr<ThriftSender>{mock_thrift_sender});
+
+ auto recordable_1 = exporter->MakeRecordable();
+ recordable_1->SetName("Test span 1");
+ auto recordable_2 = exporter->MakeRecordable();
+ recordable_2->SetName("Test span 2");
+
+ // exporter shuold not be shutdown by default
+ nostd::span<std::unique_ptr<sdk::trace::Recordable>> batch_1(&recordable_1, 1);
+ EXPECT_CALL(*mock_thrift_sender, Append(_)).Times(Exactly(1)).WillOnce(Return(1));
+ auto result = exporter->Export(batch_1);
+ EXPECT_EQ(sdk_common::ExportResult::kSuccess, result);
+
+ exporter->Shutdown();
+
+ nostd::span<std::unique_ptr<sdk::trace::Recordable>> batch_2(&recordable_2, 1);
+ result = exporter->Export(batch_2);
+ EXPECT_EQ(sdk_common::ExportResult::kFailure, result);
+}
+
+// Call Export() directly
+TEST_F(JaegerExporterTestPeer, ExportTest)
+{
+ auto mock_thrift_sender = new MockThriftSender;
+ auto exporter = GetExporter(std::unique_ptr<ThriftSender>{mock_thrift_sender});
+
+ auto recordable_1 = exporter->MakeRecordable();
+ recordable_1->SetName("Test span 1");
+ auto recordable_2 = exporter->MakeRecordable();
+ recordable_2->SetName("Test span 2");
+
+ // Test successful send
+ nostd::span<std::unique_ptr<sdk::trace::Recordable>> batch_1(&recordable_1, 1);
+ EXPECT_CALL(*mock_thrift_sender, Append(_)).Times(Exactly(1)).WillOnce(Return(1));
+ auto result = exporter->Export(batch_1);
+ EXPECT_EQ(sdk_common::ExportResult::kSuccess, result);
+
+ // Test failed send
+ nostd::span<std::unique_ptr<sdk::trace::Recordable>> batch_2(&recordable_2, 1);
+ EXPECT_CALL(*mock_thrift_sender, Append(_)).Times(Exactly(1)).WillOnce(Return(0));
+ result = exporter->Export(batch_2);
+ EXPECT_EQ(sdk::common::ExportResult::kFailure, result);
+}
+
+// Test exporter configuration options
+TEST_F(JaegerExporterTestPeer, ConfigTest)
+{
+ JaegerExporterOptions opts;
+ opts.endpoint = "localhost";
+ opts.server_port = 6851;
+ std::unique_ptr<JaegerExporter> exporter(new JaegerExporter(opts));
+ EXPECT_EQ(GetOptions(exporter).endpoint, "localhost");
+ EXPECT_EQ(GetOptions(exporter).server_port, 6851);
+}
+
+} // namespace jaeger
+} // namespace exporter
+OPENTELEMETRY_END_NAMESPACE
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_recordable_test.cc b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_recordable_test.cc
new file mode 100644
index 000000000..4a0a1f74b
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/test/jaeger_recordable_test.cc
@@ -0,0 +1,334 @@
+// Copyright The OpenTelemetry Authors
+// SPDX-License-Identifier: Apache-2.0
+
+#include <vector>
+#include "opentelemetry/exporters/jaeger/recordable.h"
+#include "opentelemetry/sdk/instrumentationlibrary/instrumentation_library.h"
+#include "opentelemetry/sdk/trace/simple_processor.h"
+#include "opentelemetry/sdk/trace/span_data.h"
+#include "opentelemetry/sdk/trace/tracer_provider.h"
+#include "opentelemetry/trace/provider.h"
+
+#include <gtest/gtest.h>
+
+namespace trace = opentelemetry::trace;
+namespace nostd = opentelemetry::nostd;
+namespace sdktrace = opentelemetry::sdk::trace;
+namespace common = opentelemetry::common;
+
+using namespace jaegertracing;
+using namespace opentelemetry::exporter::jaeger;
+using namespace opentelemetry::sdk::instrumentationlibrary;
+using std::vector;
+
+using Attributes = std::initializer_list<std::pair<nostd::string_view, common::AttributeValue>>;
+
+TEST(JaegerSpanRecordable, SetIdentity)
+{
+ JaegerRecordable rec;
+
+ int64_t trace_id_val[2] = {0x0000000000000000, 0x1000000000000000};
+ int64_t span_id_val = 0x2000000000000000;
+ int64_t parent_span_id_val = 0x3000000000000000;
+
+ const trace::TraceId trace_id{
+ nostd::span<uint8_t, 16>(reinterpret_cast<uint8_t *>(trace_id_val), 16)};
+
+ const trace::SpanId span_id(
+ nostd::span<uint8_t, 8>(reinterpret_cast<uint8_t *>(&span_id_val), 8));
+
+ const trace::SpanId parent_span_id(
+ nostd::span<uint8_t, 8>(reinterpret_cast<uint8_t *>(&parent_span_id_val), 8));
+
+ const trace::SpanContext span_context{trace_id, span_id,
+ trace::TraceFlags{trace::TraceFlags::kIsSampled}, true};
+ rec.SetIdentity(span_context, parent_span_id);
+
+ std::unique_ptr<thrift::Span> span{rec.Span()};
+
+#if JAEGER_IS_LITTLE_ENDIAN == 1
+ EXPECT_EQ(span->traceIdLow, otel_bswap_64(trace_id_val[1]));
+ EXPECT_EQ(span->traceIdHigh, otel_bswap_64(trace_id_val[0]));
+ EXPECT_EQ(span->spanId, otel_bswap_64(span_id_val));
+ EXPECT_EQ(span->parentSpanId, otel_bswap_64(parent_span_id_val));
+#else
+ EXPECT_EQ(span->traceIdLow, trace_id_val[0]);
+ EXPECT_EQ(span->traceIdHigh, trace_id_val[1]);
+ EXPECT_EQ(span->spanId, span_id_val);
+ EXPECT_EQ(span->parentSpanId, parent_span_id_val);
+#endif
+}
+
+TEST(JaegerSpanRecordable, SetName)
+{
+ JaegerRecordable rec;
+
+ nostd::string_view name = "Test Span";
+ rec.SetName(name);
+
+ std::unique_ptr<thrift::Span> span{rec.Span()};
+
+ EXPECT_EQ(span->operationName, name);
+}
+
+TEST(JaegerSpanRecordable, SetStartTime)
+{
+ JaegerRecordable rec;
+
+ std::chrono::system_clock::time_point start_time = std::chrono::system_clock::now();
+ common::SystemTimestamp start_timestamp(start_time);
+ uint64_t unix_start =
+ std::chrono::duration_cast<std::chrono::microseconds>(start_time.time_since_epoch()).count();
+ rec.SetStartTime(start_timestamp);
+
+ std::unique_ptr<thrift::Span> span{rec.Span()};
+
+ EXPECT_EQ(span->startTime, unix_start);
+}
+
+TEST(JaegerSpanRecordable, SetDuration)
+{
+ JaegerRecordable rec;
+
+ common::SystemTimestamp start_timestamp;
+
+ std::chrono::microseconds duration(10);
+ uint64_t unix_end = duration.count();
+
+ rec.SetStartTime(start_timestamp);
+ rec.SetDuration(duration);
+
+ std::unique_ptr<thrift::Span> span{rec.Span()};
+
+ EXPECT_EQ(span->startTime, 0);
+ EXPECT_EQ(span->duration, unix_end);
+}
+
+TEST(JaegerSpanRecordable, SetStatus)
+{
+ JaegerRecordable rec;
+
+ const char *error_description = "Error test";
+ rec.SetStatus(trace::StatusCode::kError, error_description);
+
+ auto tags = rec.Tags();
+ EXPECT_EQ(tags.size(), 3);
+
+ EXPECT_EQ(tags[0].key, "otel.status_code");
+ EXPECT_EQ(tags[0].vType, thrift::TagType::STRING);
+ EXPECT_EQ(tags[0].vStr, "ERROR");
+
+ EXPECT_EQ(tags[1].key, "error");
+ EXPECT_EQ(tags[1].vType, thrift::TagType::BOOL);
+ EXPECT_EQ(tags[1].vBool, true);
+
+ EXPECT_EQ(tags[2].key, "otel.status_description");
+ EXPECT_EQ(tags[2].vType, thrift::TagType::STRING);
+ EXPECT_EQ(tags[2].vStr, error_description);
+}
+
+TEST(JaegerSpanRecordable, AddEvent)
+{
+ JaegerRecordable rec;
+
+ std::chrono::system_clock::time_point event_time = std::chrono::system_clock::now();
+ common::SystemTimestamp event_timestamp(event_time);
+ uint64_t epoch_us =
+ std::chrono::duration_cast<std::chrono::microseconds>(event_time.time_since_epoch()).count();
+
+ const int kNumAttributes = 3;
+ std::string keys[kNumAttributes] = {"attr1", "attr2", "attr3"};
+ int64_t values[kNumAttributes] = {4, 7, 23};
+ std::map<std::string, int64_t> attributes = {
+ {keys[0], values[0]}, {keys[1], values[1]}, {keys[2], values[2]}};
+
+ rec.AddEvent("Test Event", event_timestamp,
+ common::KeyValueIterableView<std::map<std::string, int64_t>>(attributes));
+ thrift::Log log = rec.Logs().at(0);
+ EXPECT_EQ(log.timestamp, epoch_us);
+ auto tags = log.fields;
+ size_t index = 0;
+ EXPECT_EQ(tags[index].key, "event");
+ EXPECT_EQ(tags[index++].vStr, "Test Event");
+ while (index <= kNumAttributes)
+ {
+ EXPECT_EQ(tags[index].key, keys[index - 1]);
+ EXPECT_EQ(tags[index].vLong, values[index - 1]);
+ index++;
+ }
+}
+
+template <typename value_type>
+void addTag(thrift::TagType::type tag_type,
+ const std::string &key,
+ value_type value,
+ vector<thrift::Tag> &tags)
+{
+ thrift::Tag tag;
+
+ tag.__set_key(key);
+ tag.__set_vType(tag_type);
+ if (tag_type == thrift::TagType::LONG)
+ {
+ tag.__set_vLong(static_cast<int64_t>(value));
+ }
+ else if (tag_type == thrift::TagType::DOUBLE)
+ {
+ tag.__set_vDouble(static_cast<double>(value));
+ }
+ else if (tag_type == thrift::TagType::BOOL)
+ {
+ tag.__set_vBool(static_cast<bool>(value));
+ }
+
+ tags.push_back(tag);
+}
+
+void addTag(const std::string &key, std::string value, vector<thrift::Tag> &tags)
+{
+ thrift::Tag tag;
+
+ tag.__set_key(key);
+ tag.__set_vType(thrift::TagType::STRING);
+ tag.__set_vStr(value);
+
+ tags.push_back(tag);
+}
+
+TEST(JaegerSpanRecordable, SetAttributes)
+{
+ JaegerRecordable rec;
+ std::string string_val{"string_val"};
+ vector<common::AttributeValue> values{
+ bool{false},
+ int32_t{-32},
+ int64_t{-64},
+ uint32_t{32},
+ double{3.14},
+ string_val.c_str(),
+ nostd::string_view{"string_view"},
+ };
+ for (const auto &val : values)
+ {
+ rec.SetAttribute("key1", val);
+ }
+ rec.SetAttribute("key2", nostd::span<const bool>{{false, true}});
+ rec.SetAttribute("key3", nostd::span<const int32_t>{{-320, 320}});
+ rec.SetAttribute("key4", nostd::span<const int64_t>{{-640, 640}});
+ rec.SetAttribute("key5", nostd::span<const uint32_t>{{320, 322}});
+ rec.SetAttribute("key6", nostd::span<const double>{{4.15, 5.15}});
+ rec.SetAttribute("key7", nostd::span<const nostd::string_view>{{"string_v1", "string_v2"}});
+
+ auto tags = rec.Tags();
+ EXPECT_EQ(tags.size(), values.size() + 12);
+
+ vector<thrift::Tag> expected_tags;
+ addTag(thrift::TagType::BOOL, "key1", bool{false}, expected_tags);
+ addTag(thrift::TagType::LONG, "key1", int32_t{-32}, expected_tags);
+ addTag(thrift::TagType::LONG, "key1", int64_t{-64}, expected_tags);
+ addTag(thrift::TagType::LONG, "key1", int32_t{32}, expected_tags);
+ addTag(thrift::TagType::DOUBLE, "key1", double{3.14}, expected_tags);
+ addTag("key1", string_val, expected_tags);
+ addTag("key1", std::string{"string_view"}, expected_tags);
+
+ addTag(thrift::TagType::BOOL, "key2", bool{false}, expected_tags);
+ addTag(thrift::TagType::BOOL, "key2", bool{true}, expected_tags);
+ addTag(thrift::TagType::LONG, "key3", int32_t{-320}, expected_tags);
+ addTag(thrift::TagType::LONG, "key3", int32_t{320}, expected_tags);
+ addTag(thrift::TagType::LONG, "key4", int64_t{-640}, expected_tags);
+ addTag(thrift::TagType::LONG, "key4", int64_t{640}, expected_tags);
+ addTag(thrift::TagType::LONG, "key5", uint32_t{320}, expected_tags);
+ addTag(thrift::TagType::LONG, "key5", uint32_t{322}, expected_tags);
+ addTag(thrift::TagType::DOUBLE, "key6", double{4.15}, expected_tags);
+ addTag(thrift::TagType::DOUBLE, "key6", double{5.15}, expected_tags);
+ addTag("key7", std::string{"string_v1"}, expected_tags);
+ addTag("key7", std::string{"string_v2"}, expected_tags);
+
+ EXPECT_EQ(tags, expected_tags);
+}
+
+TEST(JaegerSpanRecordable, SetInstrumentationLibrary)
+{
+ JaegerRecordable rec;
+
+ std::string library_name = "opentelemetry-cpp";
+ std::string library_version = "0.1.0";
+ auto instrumentation_library = InstrumentationLibrary::Create(library_name, library_version);
+
+ rec.SetInstrumentationLibrary(*instrumentation_library);
+
+ auto tags = rec.Tags();
+ EXPECT_EQ(tags.size(), 2);
+
+ EXPECT_EQ(tags[0].key, "otel.library.name");
+ EXPECT_EQ(tags[0].vType, thrift::TagType::STRING);
+ EXPECT_EQ(tags[0].vStr, library_name);
+
+ EXPECT_EQ(tags[1].key, "otel.library.version");
+ EXPECT_EQ(tags[1].vType, thrift::TagType::STRING);
+ EXPECT_EQ(tags[1].vStr, library_version);
+}
+
+TEST(JaegerSpanRecordable, SetResource)
+{
+ JaegerRecordable rec;
+
+ const std::string service_name_key = "service.name";
+ std::string service_name_value = "test-jaeger-service-name";
+ auto resource = opentelemetry::sdk::resource::Resource::Create(
+ {{service_name_key, service_name_value}, {"key1", "value1"}, {"key2", "value2"}});
+ rec.SetResource(resource);
+
+ auto service_name = rec.ServiceName();
+ auto resource_tags = rec.ResourceTags();
+
+ EXPECT_GE(resource_tags.size(), 2);
+ EXPECT_EQ(service_name, service_name_value);
+
+ for (const auto &tag : resource_tags)
+ {
+ if (tag.key == "key1")
+ {
+ EXPECT_EQ(tag.vType, thrift::TagType::STRING);
+ EXPECT_EQ(tag.vStr, "value1");
+ }
+ else if (tag.key == "key2")
+ {
+ EXPECT_EQ(tag.vType, thrift::TagType::STRING);
+ EXPECT_EQ(tag.vStr, "value2");
+ }
+ }
+}
+
+TEST(JaegerSpanRecordable, AddLink)
+{
+ JaegerRecordable rec;
+
+ int64_t trace_id_val[2] = {0x0000000000000000, 0x1000000000000000};
+ int64_t span_id_val = 0x2000000000000000;
+
+ const trace::TraceId trace_id{
+ nostd::span<uint8_t, 16>(reinterpret_cast<uint8_t *>(trace_id_val), 16)};
+
+ const trace::SpanId span_id(
+ nostd::span<uint8_t, 8>(reinterpret_cast<uint8_t *>(&span_id_val), 8));
+
+ const trace::SpanContext span_context{trace_id, span_id,
+ trace::TraceFlags{trace::TraceFlags::kIsSampled}, true};
+ rec.AddLink(span_context, common::KeyValueIterableView<Attributes>({{"attr1", "string"}}));
+
+ auto references = rec.References();
+ EXPECT_EQ(references.size(), 1);
+
+ auto reference = references.front();
+
+#if JAEGER_IS_LITTLE_ENDIAN == 1
+ EXPECT_EQ(reference.traceIdLow, otel_bswap_64(trace_id_val[1]));
+ EXPECT_EQ(reference.traceIdHigh, otel_bswap_64(trace_id_val[0]));
+ EXPECT_EQ(reference.spanId, otel_bswap_64(span_id_val));
+#else
+ EXPECT_EQ(reference.traceIdLow, trace_id_val[0]);
+ EXPECT_EQ(reference.traceIdHigh, trace_id_val[1]);
+ EXPECT_EQ(reference.spanId, span_id_val);
+#endif
+}
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.cpp
new file mode 100644
index 000000000..4ff023650
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.cpp
@@ -0,0 +1,380 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#include "Agent.h"
+
+namespace jaegertracing { namespace agent { namespace thrift {
+
+
+Agent_emitZipkinBatch_args::~Agent_emitZipkinBatch_args() noexcept {
+}
+
+
+uint32_t Agent_emitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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<uint32_t>(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();
+ return xfer;
+}
+
+
+Agent_emitZipkinBatch_pargs::~Agent_emitZipkinBatch_pargs() noexcept {
+}
+
+
+uint32_t Agent_emitZipkinBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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<uint32_t>((*(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();
+ return xfer;
+}
+
+
+Agent_emitBatch_args::~Agent_emitBatch_args() noexcept {
+}
+
+
+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;
+ 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->batch.read(iprot);
+ this->__isset.batch = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ return xfer;
+}
+
+uint32_t Agent_emitBatch_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Agent_emitBatch_args");
+
+ xfer += oprot->writeFieldBegin("batch", ::apache::thrift::protocol::T_STRUCT, 1);
+ xfer += this->batch.write(oprot);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+
+Agent_emitBatch_pargs::~Agent_emitBatch_pargs() noexcept {
+}
+
+
+uint32_t Agent_emitBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Agent_emitBatch_pargs");
+
+ xfer += oprot->writeFieldBegin("batch", ::apache::thrift::protocol::T_STRUCT, 1);
+ xfer += (*(this->batch)).write(oprot);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ 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);
+}
+
+void AgentClient::send_emitBatch(const ::jaegertracing::thrift::Batch& batch)
+{
+ int32_t cseqid = 0;
+ 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();
+}
+
+bool AgentProcessor::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 AgentProcessor::process_emitZipkinBatch(int32_t, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol*, void* callContext)
+{
+ void* ctx = nullptr;
+ if (this->eventHandler_.get() != nullptr) {
+ ctx = this->eventHandler_->getContext("Agent.emitZipkinBatch", callContext);
+ }
+ ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Agent.emitZipkinBatch");
+
+ if (this->eventHandler_.get() != nullptr) {
+ 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() != nullptr) {
+ this->eventHandler_->postRead(ctx, "Agent.emitZipkinBatch", bytes);
+ }
+
+ try {
+ iface_->emitZipkinBatch(args.spans);
+ } catch (const std::exception&) {
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->handlerError(ctx, "Agent.emitZipkinBatch");
+ }
+ return;
+ }
+
+ if (this->eventHandler_.get() != nullptr) {
+ 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 = nullptr;
+ if (this->eventHandler_.get() != nullptr) {
+ ctx = this->eventHandler_->getContext("Agent.emitBatch", callContext);
+ }
+ ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Agent.emitBatch");
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->preRead(ctx, "Agent.emitBatch");
+ }
+
+ Agent_emitBatch_args args;
+ args.read(iprot);
+ iprot->readMessageEnd();
+ uint32_t bytes = iprot->getTransport()->readEnd();
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->postRead(ctx, "Agent.emitBatch", bytes);
+ }
+
+ try {
+ iface_->emitBatch(args.batch);
+ } catch (const std::exception&) {
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->handlerError(ctx, "Agent.emitBatch");
+ }
+ return;
+ }
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->asyncComplete(ctx, "Agent.emitBatch");
+ }
+
+ return;
+}
+
+::std::shared_ptr< ::apache::thrift::TProcessor > AgentProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
+ ::apache::thrift::ReleaseHandler< AgentIfFactory > cleanup(handlerFactory_);
+ ::std::shared_ptr< AgentIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
+ ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new AgentProcessor(handler));
+ return processor;
+}
+
+void AgentConcurrentClient::emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans)
+{
+ send_emitZipkinBatch(spans);
+}
+
+void AgentConcurrentClient::send_emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans)
+{
+ int32_t cseqid = 0;
+ ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get());
+ oprot_->writeMessageBegin("emitZipkinBatch", ::apache::thrift::protocol::T_ONEWAY, cseqid);
+
+ Agent_emitZipkinBatch_pargs args;
+ args.spans = &spans;
+ args.write(oprot_);
+
+ oprot_->writeMessageEnd();
+ oprot_->getTransport()->writeEnd();
+ oprot_->getTransport()->flush();
+
+ sentry.commit();
+}
+
+void AgentConcurrentClient::emitBatch(const ::jaegertracing::thrift::Batch& batch)
+{
+ send_emitBatch(batch);
+}
+
+void AgentConcurrentClient::send_emitBatch(const ::jaegertracing::thrift::Batch& batch)
+{
+ int32_t cseqid = 0;
+ ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get());
+ 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/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.h
new file mode 100644
index 000000000..49abaf54a
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent.h
@@ -0,0 +1,309 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef Agent_H
+#define Agent_H
+
+#include <thrift/TDispatchProcessor.h>
+#include <thrift/async/TConcurrentClientSyncInfo.h>
+#include <memory>
+#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;
+};
+
+class AgentIfFactory {
+ public:
+ typedef AgentIf Handler;
+
+ virtual ~AgentIfFactory() {}
+
+ virtual AgentIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
+ virtual void releaseHandler(AgentIf* /* handler */) = 0;
+};
+
+class AgentIfSingletonFactory : virtual public AgentIfFactory {
+ public:
+ AgentIfSingletonFactory(const ::std::shared_ptr<AgentIf>& iface) : iface_(iface) {}
+ virtual ~AgentIfSingletonFactory() {}
+
+ virtual AgentIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
+ return iface_.get();
+ }
+ virtual void releaseHandler(AgentIf* /* handler */) {}
+
+ protected:
+ ::std::shared_ptr<AgentIf> 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:
+
+ Agent_emitZipkinBatch_args(const Agent_emitZipkinBatch_args&);
+ Agent_emitZipkinBatch_args& operator=(const Agent_emitZipkinBatch_args&);
+ Agent_emitZipkinBatch_args() {
+ }
+
+ virtual ~Agent_emitZipkinBatch_args() noexcept;
+ 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;
+
+};
+
+
+class Agent_emitZipkinBatch_pargs {
+ public:
+
+
+ virtual ~Agent_emitZipkinBatch_pargs() noexcept;
+ const std::vector< ::twitter::zipkin::thrift::Span> * spans;
+
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _Agent_emitBatch_args__isset {
+ _Agent_emitBatch_args__isset() : batch(false) {}
+ bool batch :1;
+} _Agent_emitBatch_args__isset;
+
+class Agent_emitBatch_args {
+ public:
+
+ Agent_emitBatch_args(const Agent_emitBatch_args&);
+ Agent_emitBatch_args& operator=(const Agent_emitBatch_args&);
+ Agent_emitBatch_args() {
+ }
+
+ virtual ~Agent_emitBatch_args() noexcept;
+ ::jaegertracing::thrift::Batch batch;
+
+ _Agent_emitBatch_args__isset __isset;
+
+ void __set_batch(const ::jaegertracing::thrift::Batch& val);
+
+ bool operator == (const Agent_emitBatch_args & rhs) const
+ {
+ if (!(batch == rhs.batch))
+ return false;
+ return true;
+ }
+ bool operator != (const Agent_emitBatch_args &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Agent_emitBatch_args & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+
+class Agent_emitBatch_pargs {
+ public:
+
+
+ virtual ~Agent_emitBatch_pargs() noexcept;
+ const ::jaegertracing::thrift::Batch* batch;
+
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+class AgentClient : virtual public AgentIf {
+ public:
+ AgentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot);
+ }
+ AgentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ setProtocol(iprot,oprot);
+ }
+ private:
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot,prot);
+ }
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ piprot_=iprot;
+ poprot_=oprot;
+ iprot_ = iprot.get();
+ oprot_ = oprot.get();
+ }
+ public:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
+ return piprot_;
+ }
+ std::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:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
+ ::apache::thrift::protocol::TProtocol* iprot_;
+ ::apache::thrift::protocol::TProtocol* oprot_;
+};
+
+class AgentProcessor : public ::apache::thrift::TDispatchProcessor {
+ protected:
+ ::std::shared_ptr<AgentIf> 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<std::string, ProcessFunction> 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(::std::shared_ptr<AgentIf> iface) :
+ iface_(iface) {
+ processMap_["emitZipkinBatch"] = &AgentProcessor::process_emitZipkinBatch;
+ processMap_["emitBatch"] = &AgentProcessor::process_emitBatch;
+ }
+
+ virtual ~AgentProcessor() {}
+};
+
+class AgentProcessorFactory : public ::apache::thrift::TProcessorFactory {
+ public:
+ AgentProcessorFactory(const ::std::shared_ptr< AgentIfFactory >& handlerFactory) :
+ handlerFactory_(handlerFactory) {}
+
+ ::std::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
+
+ protected:
+ ::std::shared_ptr< AgentIfFactory > handlerFactory_;
+};
+
+class AgentMultiface : virtual public AgentIf {
+ public:
+ AgentMultiface(std::vector<std::shared_ptr<AgentIf> >& ifaces) : ifaces_(ifaces) {
+ }
+ virtual ~AgentMultiface() {}
+ protected:
+ std::vector<std::shared_ptr<AgentIf> > ifaces_;
+ AgentMultiface() {}
+ void add(::std::shared_ptr<AgentIf> 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;
+ for (; i < (sz - 1); ++i) {
+ ifaces_[i]->emitBatch(batch);
+ }
+ ifaces_[i]->emitBatch(batch);
+ }
+
+};
+
+// 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(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync)
+{
+ setProtocol(prot);
+ }
+ AgentConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync)
+{
+ setProtocol(iprot,oprot);
+ }
+ private:
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot,prot);
+ }
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ piprot_=iprot;
+ poprot_=oprot;
+ iprot_ = iprot.get();
+ oprot_ = oprot.get();
+ }
+ public:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
+ return piprot_;
+ }
+ std::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:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
+ ::apache::thrift::protocol::TProtocol* iprot_;
+ ::apache::thrift::protocol::TProtocol* oprot_;
+ std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync_;
+};
+
+#ifdef _MSC_VER
+ #pragma warning( pop )
+#endif
+
+}}} // namespace
+
+#endif
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp
new file mode 100644
index 000000000..60fdd9436
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp
@@ -0,0 +1,47 @@
+// This autogenerated skeleton file illustrates how to build a server.
+// You should copy it to another filename to avoid overwriting it.
+
+#include "Agent.h"
+#include <thrift/protocol/TBinaryProtocol.h>
+#include <thrift/server/TSimpleServer.h>
+#include <thrift/transport/TServerSocket.h>
+#include <thrift/transport/TBufferTransports.h>
+
+using namespace ::apache::thrift;
+using namespace ::apache::thrift::protocol;
+using namespace ::apache::thrift::transport;
+using namespace ::apache::thrift::server;
+
+using namespace ::jaegertracing::agent::thrift;
+
+class AgentHandler : virtual public AgentIf {
+ public:
+ AgentHandler() {
+ // Your initialization goes here
+ }
+
+ void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) {
+ // Your implementation goes here
+ printf("emitZipkinBatch\n");
+ }
+
+ void emitBatch(const ::jaegertracing::thrift::Batch& batch) {
+ // Your implementation goes here
+ printf("emitBatch\n");
+ }
+
+};
+
+int main(int argc, char **argv) {
+ int port = 9090;
+ ::std::shared_ptr<AgentHandler> handler(new AgentHandler());
+ ::std::shared_ptr<TProcessor> processor(new AgentProcessor(handler));
+ ::std::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
+ ::std::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
+ ::std::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+
+ TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
+ server.serve();
+ return 0;
+}
+
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.cpp
new file mode 100644
index 000000000..f96b40f20
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.cpp
@@ -0,0 +1,481 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#include "Collector.h"
+
+namespace jaegertracing { namespace thrift {
+
+
+Collector_submitBatches_args::~Collector_submitBatches_args() noexcept {
+}
+
+
+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;
+ 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->batches.clear();
+ uint32_t _size52;
+ ::apache::thrift::protocol::TType _etype55;
+ xfer += iprot->readListBegin(_etype55, _size52);
+ this->batches.resize(_size52);
+ uint32_t _i56;
+ for (_i56 = 0; _i56 < _size52; ++_i56)
+ {
+ xfer += this->batches[_i56].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ this->__isset.batches = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ return xfer;
+}
+
+uint32_t Collector_submitBatches_args::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Collector_submitBatches_args");
+
+ xfer += oprot->writeFieldBegin("batches", ::apache::thrift::protocol::T_LIST, 1);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->batches.size()));
+ std::vector<Batch> ::const_iterator _iter57;
+ for (_iter57 = this->batches.begin(); _iter57 != this->batches.end(); ++_iter57)
+ {
+ xfer += (*_iter57).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+
+Collector_submitBatches_pargs::~Collector_submitBatches_pargs() noexcept {
+}
+
+
+uint32_t Collector_submitBatches_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Collector_submitBatches_pargs");
+
+ xfer += oprot->writeFieldBegin("batches", ::apache::thrift::protocol::T_LIST, 1);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>((*(this->batches)).size()));
+ std::vector<Batch> ::const_iterator _iter58;
+ for (_iter58 = (*(this->batches)).begin(); _iter58 != (*(this->batches)).end(); ++_iter58)
+ {
+ xfer += (*_iter58).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+
+Collector_submitBatches_result::~Collector_submitBatches_result() noexcept {
+}
+
+
+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;
+ 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 _size59;
+ ::apache::thrift::protocol::TType _etype62;
+ xfer += iprot->readListBegin(_etype62, _size59);
+ this->success.resize(_size59);
+ uint32_t _i63;
+ for (_i63 = 0; _i63 < _size59; ++_i63)
+ {
+ xfer += this->success[_i63].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 Collector_submitBatches_result::write(::apache::thrift::protocol::TProtocol* oprot) const {
+
+ uint32_t xfer = 0;
+
+ xfer += oprot->writeStructBegin("Collector_submitBatches_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<uint32_t>(this->success.size()));
+ std::vector<BatchSubmitResponse> ::const_iterator _iter64;
+ for (_iter64 = this->success.begin(); _iter64 != this->success.end(); ++_iter64)
+ {
+ xfer += (*_iter64).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+ }
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+
+Collector_submitBatches_presult::~Collector_submitBatches_presult() noexcept {
+}
+
+
+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;
+ 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 _size65;
+ ::apache::thrift::protocol::TType _etype68;
+ xfer += iprot->readListBegin(_etype68, _size65);
+ (*(this->success)).resize(_size65);
+ uint32_t _i69;
+ for (_i69 = 0; _i69 < _size65; ++_i69)
+ {
+ xfer += (*(this->success))[_i69].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 CollectorClient::submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches)
+{
+ send_submitBatches(batches);
+ recv_submitBatches(_return);
+}
+
+void CollectorClient::send_submitBatches(const std::vector<Batch> & batches)
+{
+ int32_t cseqid = 0;
+ 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();
+}
+
+void CollectorClient::recv_submitBatches(std::vector<BatchSubmitResponse> & _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("submitBatches") != 0) {
+ iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+ iprot_->readMessageEnd();
+ iprot_->getTransport()->readEnd();
+ }
+ 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
+ return;
+ }
+ throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitBatches failed: unknown result");
+}
+
+bool CollectorProcessor::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 CollectorProcessor::process_submitBatches(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext)
+{
+ void* ctx = nullptr;
+ if (this->eventHandler_.get() != nullptr) {
+ ctx = this->eventHandler_->getContext("Collector.submitBatches", callContext);
+ }
+ ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "Collector.submitBatches");
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->preRead(ctx, "Collector.submitBatches");
+ }
+
+ Collector_submitBatches_args args;
+ args.read(iprot);
+ iprot->readMessageEnd();
+ uint32_t bytes = iprot->getTransport()->readEnd();
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->postRead(ctx, "Collector.submitBatches", bytes);
+ }
+
+ Collector_submitBatches_result result;
+ try {
+ iface_->submitBatches(result.success, args.batches);
+ result.__isset.success = true;
+ } catch (const std::exception& e) {
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->handlerError(ctx, "Collector.submitBatches");
+ }
+
+ ::apache::thrift::TApplicationException x(e.what());
+ oprot->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_EXCEPTION, seqid);
+ x.write(oprot);
+ oprot->writeMessageEnd();
+ oprot->getTransport()->writeEnd();
+ oprot->getTransport()->flush();
+ return;
+ }
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->preWrite(ctx, "Collector.submitBatches");
+ }
+
+ oprot->writeMessageBegin("submitBatches", ::apache::thrift::protocol::T_REPLY, seqid);
+ result.write(oprot);
+ oprot->writeMessageEnd();
+ bytes = oprot->getTransport()->writeEnd();
+ oprot->getTransport()->flush();
+
+ if (this->eventHandler_.get() != nullptr) {
+ this->eventHandler_->postWrite(ctx, "Collector.submitBatches", bytes);
+ }
+}
+
+::std::shared_ptr< ::apache::thrift::TProcessor > CollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
+ ::apache::thrift::ReleaseHandler< CollectorIfFactory > cleanup(handlerFactory_);
+ ::std::shared_ptr< CollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
+ ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new CollectorProcessor(handler));
+ return processor;
+}
+
+void CollectorConcurrentClient::submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches)
+{
+ int32_t seqid = send_submitBatches(batches);
+ recv_submitBatches(_return, seqid);
+}
+
+int32_t CollectorConcurrentClient::send_submitBatches(const std::vector<Batch> & batches)
+{
+ int32_t cseqid = this->sync_->generateSeqId();
+ ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get());
+ 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<BatchSubmitResponse> & _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_.get(), 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/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.h
new file mode 100644
index 000000000..75daa69a7
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector.h
@@ -0,0 +1,299 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef Collector_H
+#define Collector_H
+
+#include <thrift/TDispatchProcessor.h>
+#include <thrift/async/TConcurrentClientSyncInfo.h>
+#include <memory>
+#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() {}
+ virtual void submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches) = 0;
+};
+
+class CollectorIfFactory {
+ public:
+ typedef CollectorIf Handler;
+
+ virtual ~CollectorIfFactory() {}
+
+ virtual CollectorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0;
+ virtual void releaseHandler(CollectorIf* /* handler */) = 0;
+};
+
+class CollectorIfSingletonFactory : virtual public CollectorIfFactory {
+ public:
+ CollectorIfSingletonFactory(const ::std::shared_ptr<CollectorIf>& iface) : iface_(iface) {}
+ virtual ~CollectorIfSingletonFactory() {}
+
+ virtual CollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
+ return iface_.get();
+ }
+ virtual void releaseHandler(CollectorIf* /* handler */) {}
+
+ protected:
+ ::std::shared_ptr<CollectorIf> iface_;
+};
+
+class CollectorNull : virtual public CollectorIf {
+ public:
+ virtual ~CollectorNull() {}
+ void submitBatches(std::vector<BatchSubmitResponse> & /* _return */, const std::vector<Batch> & /* batches */) {
+ return;
+ }
+};
+
+typedef struct _Collector_submitBatches_args__isset {
+ _Collector_submitBatches_args__isset() : batches(false) {}
+ bool batches :1;
+} _Collector_submitBatches_args__isset;
+
+class Collector_submitBatches_args {
+ public:
+
+ Collector_submitBatches_args(const Collector_submitBatches_args&);
+ Collector_submitBatches_args& operator=(const Collector_submitBatches_args&);
+ Collector_submitBatches_args() {
+ }
+
+ virtual ~Collector_submitBatches_args() noexcept;
+ std::vector<Batch> batches;
+
+ _Collector_submitBatches_args__isset __isset;
+
+ void __set_batches(const std::vector<Batch> & val);
+
+ bool operator == (const Collector_submitBatches_args & rhs) const
+ {
+ if (!(batches == rhs.batches))
+ return false;
+ return true;
+ }
+ bool operator != (const Collector_submitBatches_args &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Collector_submitBatches_args & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+
+class Collector_submitBatches_pargs {
+ public:
+
+
+ virtual ~Collector_submitBatches_pargs() noexcept;
+ const std::vector<Batch> * batches;
+
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _Collector_submitBatches_result__isset {
+ _Collector_submitBatches_result__isset() : success(false) {}
+ bool success :1;
+} _Collector_submitBatches_result__isset;
+
+class Collector_submitBatches_result {
+ public:
+
+ Collector_submitBatches_result(const Collector_submitBatches_result&);
+ Collector_submitBatches_result& operator=(const Collector_submitBatches_result&);
+ Collector_submitBatches_result() {
+ }
+
+ virtual ~Collector_submitBatches_result() noexcept;
+ std::vector<BatchSubmitResponse> success;
+
+ _Collector_submitBatches_result__isset __isset;
+
+ void __set_success(const std::vector<BatchSubmitResponse> & val);
+
+ bool operator == (const Collector_submitBatches_result & rhs) const
+ {
+ if (!(success == rhs.success))
+ return false;
+ return true;
+ }
+ bool operator != (const Collector_submitBatches_result &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Collector_submitBatches_result & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _Collector_submitBatches_presult__isset {
+ _Collector_submitBatches_presult__isset() : success(false) {}
+ bool success :1;
+} _Collector_submitBatches_presult__isset;
+
+class Collector_submitBatches_presult {
+ public:
+
+
+ virtual ~Collector_submitBatches_presult() noexcept;
+ std::vector<BatchSubmitResponse> * success;
+
+ _Collector_submitBatches_presult__isset __isset;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+
+};
+
+class CollectorClient : virtual public CollectorIf {
+ public:
+ CollectorClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot);
+ }
+ CollectorClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ setProtocol(iprot,oprot);
+ }
+ private:
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot,prot);
+ }
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ piprot_=iprot;
+ poprot_=oprot;
+ iprot_ = iprot.get();
+ oprot_ = oprot.get();
+ }
+ public:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
+ return piprot_;
+ }
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
+ return poprot_;
+ }
+ void submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches);
+ void send_submitBatches(const std::vector<Batch> & batches);
+ void recv_submitBatches(std::vector<BatchSubmitResponse> & _return);
+ protected:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
+ ::apache::thrift::protocol::TProtocol* iprot_;
+ ::apache::thrift::protocol::TProtocol* oprot_;
+};
+
+class CollectorProcessor : public ::apache::thrift::TDispatchProcessor {
+ protected:
+ ::std::shared_ptr<CollectorIf> 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*);
+ typedef std::map<std::string, ProcessFunction> ProcessMap;
+ ProcessMap processMap_;
+ void process_submitBatches(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
+ public:
+ CollectorProcessor(::std::shared_ptr<CollectorIf> iface) :
+ iface_(iface) {
+ processMap_["submitBatches"] = &CollectorProcessor::process_submitBatches;
+ }
+
+ virtual ~CollectorProcessor() {}
+};
+
+class CollectorProcessorFactory : public ::apache::thrift::TProcessorFactory {
+ public:
+ CollectorProcessorFactory(const ::std::shared_ptr< CollectorIfFactory >& handlerFactory) :
+ handlerFactory_(handlerFactory) {}
+
+ ::std::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
+
+ protected:
+ ::std::shared_ptr< CollectorIfFactory > handlerFactory_;
+};
+
+class CollectorMultiface : virtual public CollectorIf {
+ public:
+ CollectorMultiface(std::vector<std::shared_ptr<CollectorIf> >& ifaces) : ifaces_(ifaces) {
+ }
+ virtual ~CollectorMultiface() {}
+ protected:
+ std::vector<std::shared_ptr<CollectorIf> > ifaces_;
+ CollectorMultiface() {}
+ void add(::std::shared_ptr<CollectorIf> iface) {
+ ifaces_.push_back(iface);
+ }
+ public:
+ void submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches) {
+ size_t sz = ifaces_.size();
+ size_t i = 0;
+ for (; i < (sz - 1); ++i) {
+ ifaces_[i]->submitBatches(_return, batches);
+ }
+ ifaces_[i]->submitBatches(_return, batches);
+ return;
+ }
+
+};
+
+// 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(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync)
+{
+ setProtocol(prot);
+ }
+ CollectorConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync)
+{
+ setProtocol(iprot,oprot);
+ }
+ private:
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot,prot);
+ }
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ piprot_=iprot;
+ poprot_=oprot;
+ iprot_ = iprot.get();
+ oprot_ = oprot.get();
+ }
+ public:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
+ return piprot_;
+ }
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
+ return poprot_;
+ }
+ void submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches);
+ int32_t send_submitBatches(const std::vector<Batch> & batches);
+ void recv_submitBatches(std::vector<BatchSubmitResponse> & _return, const int32_t seqid);
+ protected:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
+ ::apache::thrift::protocol::TProtocol* iprot_;
+ ::apache::thrift::protocol::TProtocol* oprot_;
+ std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync_;
+};
+
+#ifdef _MSC_VER
+ #pragma warning( pop )
+#endif
+
+}} // namespace
+
+#endif
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp
new file mode 100644
index 000000000..c59c8aa49
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp
@@ -0,0 +1,42 @@
+// This autogenerated skeleton file illustrates how to build a server.
+// You should copy it to another filename to avoid overwriting it.
+
+#include "Collector.h"
+#include <thrift/protocol/TBinaryProtocol.h>
+#include <thrift/server/TSimpleServer.h>
+#include <thrift/transport/TServerSocket.h>
+#include <thrift/transport/TBufferTransports.h>
+
+using namespace ::apache::thrift;
+using namespace ::apache::thrift::protocol;
+using namespace ::apache::thrift::transport;
+using namespace ::apache::thrift::server;
+
+using namespace ::jaegertracing::thrift;
+
+class CollectorHandler : virtual public CollectorIf {
+ public:
+ CollectorHandler() {
+ // Your initialization goes here
+ }
+
+ void submitBatches(std::vector<BatchSubmitResponse> & _return, const std::vector<Batch> & batches) {
+ // Your implementation goes here
+ printf("submitBatches\n");
+ }
+
+};
+
+int main(int argc, char **argv) {
+ int port = 9090;
+ ::std::shared_ptr<CollectorHandler> handler(new CollectorHandler());
+ ::std::shared_ptr<TProcessor> processor(new CollectorProcessor(handler));
+ ::std::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
+ ::std::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
+ ::std::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+
+ TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
+ server.serve();
+ return 0;
+}
+
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.cpp
new file mode 100644
index 000000000..42d813dfd
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.cpp
@@ -0,0 +1,481 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * 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() noexcept {
+}
+
+
+uint32_t ZipkinCollector_submitZipkinBatch_args::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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<uint32_t>(this->spans.size()));
+ std::vector<Span> ::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();
+ return xfer;
+}
+
+
+ZipkinCollector_submitZipkinBatch_pargs::~ZipkinCollector_submitZipkinBatch_pargs() noexcept {
+}
+
+
+uint32_t ZipkinCollector_submitZipkinBatch_pargs::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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<uint32_t>((*(this->spans)).size()));
+ std::vector<Span> ::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();
+ return xfer;
+}
+
+
+ZipkinCollector_submitZipkinBatch_result::~ZipkinCollector_submitZipkinBatch_result() noexcept {
+}
+
+
+uint32_t ZipkinCollector_submitZipkinBatch_result::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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<uint32_t>(this->success.size()));
+ std::vector<Response> ::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() noexcept {
+}
+
+
+uint32_t ZipkinCollector_submitZipkinBatch_presult::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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<Response> & _return, const std::vector<Span> & spans)
+{
+ send_submitZipkinBatch(spans);
+ recv_submitZipkinBatch(_return);
+}
+
+void ZipkinCollectorClient::send_submitZipkinBatch(const std::vector<Span> & 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<Response> & _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 = nullptr;
+ if (this->eventHandler_.get() != nullptr) {
+ ctx = this->eventHandler_->getContext("ZipkinCollector.submitZipkinBatch", callContext);
+ }
+ ::apache::thrift::TProcessorContextFreer freer(this->eventHandler_.get(), ctx, "ZipkinCollector.submitZipkinBatch");
+
+ if (this->eventHandler_.get() != nullptr) {
+ 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() != nullptr) {
+ 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() != nullptr) {
+ 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() != nullptr) {
+ 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() != nullptr) {
+ this->eventHandler_->postWrite(ctx, "ZipkinCollector.submitZipkinBatch", bytes);
+ }
+}
+
+::std::shared_ptr< ::apache::thrift::TProcessor > ZipkinCollectorProcessorFactory::getProcessor(const ::apache::thrift::TConnectionInfo& connInfo) {
+ ::apache::thrift::ReleaseHandler< ZipkinCollectorIfFactory > cleanup(handlerFactory_);
+ ::std::shared_ptr< ZipkinCollectorIf > handler(handlerFactory_->getHandler(connInfo), cleanup);
+ ::std::shared_ptr< ::apache::thrift::TProcessor > processor(new ZipkinCollectorProcessor(handler));
+ return processor;
+}
+
+void ZipkinCollectorConcurrentClient::submitZipkinBatch(std::vector<Response> & _return, const std::vector<Span> & spans)
+{
+ int32_t seqid = send_submitZipkinBatch(spans);
+ recv_submitZipkinBatch(_return, seqid);
+}
+
+int32_t ZipkinCollectorConcurrentClient::send_submitZipkinBatch(const std::vector<Span> & spans)
+{
+ int32_t cseqid = this->sync_->generateSeqId();
+ ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.get());
+ oprot_->writeMessageBegin("submitZipkinBatch", ::apache::thrift::protocol::T_CALL, cseqid);
+
+ ZipkinCollector_submitZipkinBatch_pargs args;
+ args.spans = &spans;
+ args.write(oprot_);
+
+ oprot_->writeMessageEnd();
+ oprot_->getTransport()->writeEnd();
+ oprot_->getTransport()->flush();
+
+ sentry.commit();
+ return cseqid;
+}
+
+void ZipkinCollectorConcurrentClient::recv_submitZipkinBatch(std::vector<Response> & _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_.get(), seqid);
+
+ while(true) {
+ if(!this->sync_->getPending(fname, mtype, rseqid)) {
+ iprot_->readMessageBegin(fname, mtype, rseqid);
+ }
+ if(seqid == rseqid) {
+ if (mtype == ::apache::thrift::protocol::T_EXCEPTION) {
+ ::apache::thrift::TApplicationException x;
+ x.read(iprot_);
+ iprot_->readMessageEnd();
+ iprot_->getTransport()->readEnd();
+ sentry.commit();
+ throw x;
+ }
+ if (mtype != ::apache::thrift::protocol::T_REPLY) {
+ iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+ iprot_->readMessageEnd();
+ iprot_->getTransport()->readEnd();
+ }
+ if (fname.compare("submitZipkinBatch") != 0) {
+ iprot_->skip(::apache::thrift::protocol::T_STRUCT);
+ iprot_->readMessageEnd();
+ iprot_->getTransport()->readEnd();
+
+ // in a bad state, don't commit
+ using ::apache::thrift::protocol::TProtocolException;
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ }
+ ZipkinCollector_submitZipkinBatch_presult result;
+ result.success = &_return;
+ result.read(iprot_);
+ iprot_->readMessageEnd();
+ iprot_->getTransport()->readEnd();
+
+ if (result.__isset.success) {
+ // _return pointer has now been filled
+ sentry.commit();
+ return;
+ }
+ // in a bad state, don't commit
+ throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitZipkinBatch failed: unknown result");
+ }
+ // seqid != rseqid
+ this->sync_->updatePending(fname, mtype, rseqid);
+
+ // this will temporarily unlock the readMutex, and let other clients get work done
+ this->sync_->waitForWork(seqid);
+ } // end while(true)
+}
+
+}}} // namespace
+
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.h
new file mode 100644
index 000000000..97e111d24
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector.h
@@ -0,0 +1,299 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef ZipkinCollector_H
+#define ZipkinCollector_H
+
+#include <thrift/TDispatchProcessor.h>
+#include <thrift/async/TConcurrentClientSyncInfo.h>
+#include <memory>
+#include "zipkincore_types.h"
+
+namespace twitter { namespace zipkin { namespace thrift {
+
+#ifdef _MSC_VER
+ #pragma warning( push )
+ #pragma warning (disable : 4250 ) //inheriting methods via dominance
+#endif
+
+class ZipkinCollectorIf {
+ public:
+ virtual ~ZipkinCollectorIf() {}
+ virtual void submitZipkinBatch(std::vector<Response> & _return, const std::vector<Span> & 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 ::std::shared_ptr<ZipkinCollectorIf>& iface) : iface_(iface) {}
+ virtual ~ZipkinCollectorIfSingletonFactory() {}
+
+ virtual ZipkinCollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) {
+ return iface_.get();
+ }
+ virtual void releaseHandler(ZipkinCollectorIf* /* handler */) {}
+
+ protected:
+ ::std::shared_ptr<ZipkinCollectorIf> iface_;
+};
+
+class ZipkinCollectorNull : virtual public ZipkinCollectorIf {
+ public:
+ virtual ~ZipkinCollectorNull() {}
+ void submitZipkinBatch(std::vector<Response> & /* _return */, const std::vector<Span> & /* 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:
+
+ ZipkinCollector_submitZipkinBatch_args(const ZipkinCollector_submitZipkinBatch_args&);
+ ZipkinCollector_submitZipkinBatch_args& operator=(const ZipkinCollector_submitZipkinBatch_args&);
+ ZipkinCollector_submitZipkinBatch_args() {
+ }
+
+ virtual ~ZipkinCollector_submitZipkinBatch_args() noexcept;
+ std::vector<Span> spans;
+
+ _ZipkinCollector_submitZipkinBatch_args__isset __isset;
+
+ void __set_spans(const std::vector<Span> & 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;
+
+};
+
+
+class ZipkinCollector_submitZipkinBatch_pargs {
+ public:
+
+
+ virtual ~ZipkinCollector_submitZipkinBatch_pargs() noexcept;
+ const std::vector<Span> * spans;
+
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+};
+
+typedef struct _ZipkinCollector_submitZipkinBatch_result__isset {
+ _ZipkinCollector_submitZipkinBatch_result__isset() : success(false) {}
+ bool success :1;
+} _ZipkinCollector_submitZipkinBatch_result__isset;
+
+class ZipkinCollector_submitZipkinBatch_result {
+ public:
+
+ ZipkinCollector_submitZipkinBatch_result(const ZipkinCollector_submitZipkinBatch_result&);
+ ZipkinCollector_submitZipkinBatch_result& operator=(const ZipkinCollector_submitZipkinBatch_result&);
+ ZipkinCollector_submitZipkinBatch_result() {
+ }
+
+ virtual ~ZipkinCollector_submitZipkinBatch_result() noexcept;
+ std::vector<Response> success;
+
+ _ZipkinCollector_submitZipkinBatch_result__isset __isset;
+
+ void __set_success(const std::vector<Response> & 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;
+
+};
+
+typedef struct _ZipkinCollector_submitZipkinBatch_presult__isset {
+ _ZipkinCollector_submitZipkinBatch_presult__isset() : success(false) {}
+ bool success :1;
+} _ZipkinCollector_submitZipkinBatch_presult__isset;
+
+class ZipkinCollector_submitZipkinBatch_presult {
+ public:
+
+
+ virtual ~ZipkinCollector_submitZipkinBatch_presult() noexcept;
+ std::vector<Response> * success;
+
+ _ZipkinCollector_submitZipkinBatch_presult__isset __isset;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+
+};
+
+class ZipkinCollectorClient : virtual public ZipkinCollectorIf {
+ public:
+ ZipkinCollectorClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot);
+ }
+ ZipkinCollectorClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ setProtocol(iprot,oprot);
+ }
+ private:
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot,prot);
+ }
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ piprot_=iprot;
+ poprot_=oprot;
+ iprot_ = iprot.get();
+ oprot_ = oprot.get();
+ }
+ public:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
+ return piprot_;
+ }
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
+ return poprot_;
+ }
+ void submitZipkinBatch(std::vector<Response> & _return, const std::vector<Span> & spans);
+ void send_submitZipkinBatch(const std::vector<Span> & spans);
+ void recv_submitZipkinBatch(std::vector<Response> & _return);
+ protected:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
+ ::apache::thrift::protocol::TProtocol* iprot_;
+ ::apache::thrift::protocol::TProtocol* oprot_;
+};
+
+class ZipkinCollectorProcessor : public ::apache::thrift::TDispatchProcessor {
+ protected:
+ ::std::shared_ptr<ZipkinCollectorIf> 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<std::string, ProcessFunction> ProcessMap;
+ ProcessMap processMap_;
+ void process_submitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext);
+ public:
+ ZipkinCollectorProcessor(::std::shared_ptr<ZipkinCollectorIf> iface) :
+ iface_(iface) {
+ processMap_["submitZipkinBatch"] = &ZipkinCollectorProcessor::process_submitZipkinBatch;
+ }
+
+ virtual ~ZipkinCollectorProcessor() {}
+};
+
+class ZipkinCollectorProcessorFactory : public ::apache::thrift::TProcessorFactory {
+ public:
+ ZipkinCollectorProcessorFactory(const ::std::shared_ptr< ZipkinCollectorIfFactory >& handlerFactory) :
+ handlerFactory_(handlerFactory) {}
+
+ ::std::shared_ptr< ::apache::thrift::TProcessor > getProcessor(const ::apache::thrift::TConnectionInfo& connInfo);
+
+ protected:
+ ::std::shared_ptr< ZipkinCollectorIfFactory > handlerFactory_;
+};
+
+class ZipkinCollectorMultiface : virtual public ZipkinCollectorIf {
+ public:
+ ZipkinCollectorMultiface(std::vector<std::shared_ptr<ZipkinCollectorIf> >& ifaces) : ifaces_(ifaces) {
+ }
+ virtual ~ZipkinCollectorMultiface() {}
+ protected:
+ std::vector<std::shared_ptr<ZipkinCollectorIf> > ifaces_;
+ ZipkinCollectorMultiface() {}
+ void add(::std::shared_ptr<ZipkinCollectorIf> iface) {
+ ifaces_.push_back(iface);
+ }
+ public:
+ void submitZipkinBatch(std::vector<Response> & _return, const std::vector<Span> & 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;
+ }
+
+};
+
+// The 'concurrent' client is a thread safe client that correctly handles
+// out of order responses. It is slower than the regular client, so should
+// only be used when you need to share a connection among multiple threads
+class ZipkinCollectorConcurrentClient : virtual public ZipkinCollectorIf {
+ public:
+ ZipkinCollectorConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync)
+{
+ setProtocol(prot);
+ }
+ ZipkinCollectorConcurrentClient(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot, std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync) : sync_(sync)
+{
+ setProtocol(iprot,oprot);
+ }
+ private:
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> prot) {
+ setProtocol(prot,prot);
+ }
+ void setProtocol(std::shared_ptr< ::apache::thrift::protocol::TProtocol> iprot, std::shared_ptr< ::apache::thrift::protocol::TProtocol> oprot) {
+ piprot_=iprot;
+ poprot_=oprot;
+ iprot_ = iprot.get();
+ oprot_ = oprot.get();
+ }
+ public:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getInputProtocol() {
+ return piprot_;
+ }
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> getOutputProtocol() {
+ return poprot_;
+ }
+ void submitZipkinBatch(std::vector<Response> & _return, const std::vector<Span> & spans);
+ int32_t send_submitZipkinBatch(const std::vector<Span> & spans);
+ void recv_submitZipkinBatch(std::vector<Response> & _return, const int32_t seqid);
+ protected:
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> piprot_;
+ std::shared_ptr< ::apache::thrift::protocol::TProtocol> poprot_;
+ ::apache::thrift::protocol::TProtocol* iprot_;
+ ::apache::thrift::protocol::TProtocol* oprot_;
+ std::shared_ptr<::apache::thrift::async::TConcurrentClientSyncInfo> sync_;
+};
+
+#ifdef _MSC_VER
+ #pragma warning( pop )
+#endif
+
+}}} // namespace
+
+#endif
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp
new file mode 100644
index 000000000..cca6ef752
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp
@@ -0,0 +1,42 @@
+// This autogenerated skeleton file illustrates how to build a server.
+// You should copy it to another filename to avoid overwriting it.
+
+#include "ZipkinCollector.h"
+#include <thrift/protocol/TBinaryProtocol.h>
+#include <thrift/server/TSimpleServer.h>
+#include <thrift/transport/TServerSocket.h>
+#include <thrift/transport/TBufferTransports.h>
+
+using namespace ::apache::thrift;
+using namespace ::apache::thrift::protocol;
+using namespace ::apache::thrift::transport;
+using namespace ::apache::thrift::server;
+
+using namespace ::twitter::zipkin::thrift;
+
+class ZipkinCollectorHandler : virtual public ZipkinCollectorIf {
+ public:
+ ZipkinCollectorHandler() {
+ // Your initialization goes here
+ }
+
+ void submitZipkinBatch(std::vector<Response> & _return, const std::vector<Span> & spans) {
+ // Your implementation goes here
+ printf("submitZipkinBatch\n");
+ }
+
+};
+
+int main(int argc, char **argv) {
+ int port = 9090;
+ ::std::shared_ptr<ZipkinCollectorHandler> handler(new ZipkinCollectorHandler());
+ ::std::shared_ptr<TProcessor> processor(new ZipkinCollectorProcessor(handler));
+ ::std::shared_ptr<TServerTransport> serverTransport(new TServerSocket(port));
+ ::std::shared_ptr<TTransportFactory> transportFactory(new TBufferedTransportFactory());
+ ::std::shared_ptr<TProtocolFactory> protocolFactory(new TBinaryProtocolFactory());
+
+ TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory);
+ server.serve();
+ return 0;
+}
+
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/agent_types.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/agent_types.h
new file mode 100644
index 000000000..0b576e34f
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/agent_types.h
@@ -0,0 +1,28 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef agent_TYPES_H
+#define agent_TYPES_H
+
+#include <iosfwd>
+
+#include <thrift/Thrift.h>
+#include <thrift/TApplicationException.h>
+#include <thrift/TBase.h>
+#include <thrift/protocol/TProtocol.h>
+#include <thrift/transport/TTransport.h>
+
+#include <functional>
+#include <memory>
+#include "jaeger_types.h"
+#include "zipkincore_types.h"
+
+
+namespace jaegertracing { namespace agent { namespace thrift {
+
+}}} // namespace
+
+#endif
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.cpp
new file mode 100644
index 000000000..5e4140cc9
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.cpp
@@ -0,0 +1,1354 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#include "jaeger_types.h"
+
+#include <algorithm>
+#include <ostream>
+
+#include <thrift/TToString.h>
+
+namespace jaegertracing { namespace thrift {
+
+int _kTagTypeValues[] = {
+ TagType::STRING,
+ TagType::DOUBLE,
+ TagType::BOOL,
+ TagType::LONG,
+ TagType::BINARY
+};
+const char* _kTagTypeNames[] = {
+ "STRING",
+ "DOUBLE",
+ "BOOL",
+ "LONG",
+ "BINARY"
+};
+const std::map<int, const char*> _TagType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(5, _kTagTypeValues, _kTagTypeNames), ::apache::thrift::TEnumIterator(-1, nullptr, nullptr));
+
+std::ostream& operator<<(std::ostream& out, const TagType::type& val) {
+ std::map<int, const char*>::const_iterator it = _TagType_VALUES_TO_NAMES.find(val);
+ if (it != _TagType_VALUES_TO_NAMES.end()) {
+ out << it->second;
+ } else {
+ out << static_cast<int>(val);
+ }
+ return out;
+}
+
+std::string to_string(const TagType::type& val) {
+ std::map<int, const char*>::const_iterator it = _TagType_VALUES_TO_NAMES.find(val);
+ if (it != _TagType_VALUES_TO_NAMES.end()) {
+ return std::string(it->second);
+ } else {
+ return std::to_string(static_cast<int>(val));
+ }
+}
+
+int _kSpanRefTypeValues[] = {
+ SpanRefType::CHILD_OF,
+ SpanRefType::FOLLOWS_FROM
+};
+const char* _kSpanRefTypeNames[] = {
+ "CHILD_OF",
+ "FOLLOWS_FROM"
+};
+const std::map<int, const char*> _SpanRefType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(2, _kSpanRefTypeValues, _kSpanRefTypeNames), ::apache::thrift::TEnumIterator(-1, nullptr, nullptr));
+
+std::ostream& operator<<(std::ostream& out, const SpanRefType::type& val) {
+ std::map<int, const char*>::const_iterator it = _SpanRefType_VALUES_TO_NAMES.find(val);
+ if (it != _SpanRefType_VALUES_TO_NAMES.end()) {
+ out << it->second;
+ } else {
+ out << static_cast<int>(val);
+ }
+ return out;
+}
+
+std::string to_string(const SpanRefType::type& val) {
+ std::map<int, const char*>::const_iterator it = _SpanRefType_VALUES_TO_NAMES.find(val);
+ if (it != _SpanRefType_VALUES_TO_NAMES.end()) {
+ return std::string(it->second);
+ } else {
+ return std::to_string(static_cast<int>(val));
+ }
+}
+
+
+Tag::~Tag() noexcept {
+}
+
+
+void Tag::__set_key(const std::string& val) {
+ this->key = val;
+}
+
+void Tag::__set_vType(const TagType::type val) {
+ this->vType = val;
+}
+
+void Tag::__set_vStr(const std::string& val) {
+ this->vStr = val;
+__isset.vStr = true;
+}
+
+void Tag::__set_vDouble(const double val) {
+ this->vDouble = val;
+__isset.vDouble = true;
+}
+
+void Tag::__set_vBool(const bool val) {
+ this->vBool = val;
+__isset.vBool = true;
+}
+
+void Tag::__set_vLong(const int64_t val) {
+ this->vLong = val;
+__isset.vLong = true;
+}
+
+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;
+}
+
+
+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;
+ int16_t fid;
+
+ xfer += iprot->readStructBegin(fname);
+
+ using ::apache::thrift::protocol::TProtocolException;
+
+ bool isset_key = false;
+ bool isset_vType = 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->key);
+ isset_key = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 2:
+ if (ftype == ::apache::thrift::protocol::T_I32) {
+ int32_t ecast0;
+ xfer += iprot->readI32(ecast0);
+ this->vType = (TagType::type)ecast0;
+ isset_vType = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 3:
+ if (ftype == ::apache::thrift::protocol::T_STRING) {
+ xfer += iprot->readString(this->vStr);
+ this->__isset.vStr = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 4:
+ if (ftype == ::apache::thrift::protocol::T_DOUBLE) {
+ xfer += iprot->readDouble(this->vDouble);
+ this->__isset.vDouble = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 5:
+ if (ftype == ::apache::thrift::protocol::T_BOOL) {
+ xfer += iprot->readBool(this->vBool);
+ this->__isset.vBool = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 6:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->vLong);
+ this->__isset.vLong = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 7:
+ if (ftype == ::apache::thrift::protocol::T_STRING) {
+ xfer += iprot->readBinary(this->vBinary);
+ this->__isset.vBinary = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ if (!isset_key)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_vType)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ return xfer;
+}
+
+uint32_t Tag::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Tag");
+
+ xfer += oprot->writeFieldBegin("key", ::apache::thrift::protocol::T_STRING, 1);
+ xfer += oprot->writeString(this->key);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("vType", ::apache::thrift::protocol::T_I32, 2);
+ xfer += oprot->writeI32((int32_t)this->vType);
+ xfer += oprot->writeFieldEnd();
+
+ if (this->__isset.vStr) {
+ xfer += oprot->writeFieldBegin("vStr", ::apache::thrift::protocol::T_STRING, 3);
+ xfer += oprot->writeString(this->vStr);
+ xfer += oprot->writeFieldEnd();
+ }
+ if (this->__isset.vDouble) {
+ xfer += oprot->writeFieldBegin("vDouble", ::apache::thrift::protocol::T_DOUBLE, 4);
+ xfer += oprot->writeDouble(this->vDouble);
+ xfer += oprot->writeFieldEnd();
+ }
+ if (this->__isset.vBool) {
+ xfer += oprot->writeFieldBegin("vBool", ::apache::thrift::protocol::T_BOOL, 5);
+ xfer += oprot->writeBool(this->vBool);
+ xfer += oprot->writeFieldEnd();
+ }
+ if (this->__isset.vLong) {
+ xfer += oprot->writeFieldBegin("vLong", ::apache::thrift::protocol::T_I64, 6);
+ xfer += oprot->writeI64(this->vLong);
+ xfer += oprot->writeFieldEnd();
+ }
+ if (this->__isset.vBinary) {
+ xfer += oprot->writeFieldBegin("vBinary", ::apache::thrift::protocol::T_STRING, 7);
+ xfer += oprot->writeBinary(this->vBinary);
+ xfer += oprot->writeFieldEnd();
+ }
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(Tag &a, Tag &b) {
+ using ::std::swap;
+ swap(a.key, b.key);
+ swap(a.vType, b.vType);
+ swap(a.vStr, b.vStr);
+ swap(a.vDouble, b.vDouble);
+ swap(a.vBool, b.vBool);
+ swap(a.vLong, b.vLong);
+ swap(a.vBinary, b.vBinary);
+ swap(a.__isset, b.__isset);
+}
+
+Tag::Tag(const Tag& other1) {
+ key = other1.key;
+ vType = other1.vType;
+ vStr = other1.vStr;
+ vDouble = other1.vDouble;
+ vBool = other1.vBool;
+ vLong = other1.vLong;
+ vBinary = other1.vBinary;
+ __isset = other1.__isset;
+}
+Tag& Tag::operator=(const Tag& other2) {
+ key = other2.key;
+ vType = other2.vType;
+ vStr = other2.vStr;
+ vDouble = other2.vDouble;
+ vBool = other2.vBool;
+ vLong = other2.vLong;
+ vBinary = other2.vBinary;
+ __isset = other2.__isset;
+ return *this;
+}
+void Tag::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Tag(";
+ out << "key=" << to_string(key);
+ out << ", " << "vType=" << to_string(vType);
+ out << ", " << "vStr="; (__isset.vStr ? (out << to_string(vStr)) : (out << "<null>"));
+ out << ", " << "vDouble="; (__isset.vDouble ? (out << to_string(vDouble)) : (out << "<null>"));
+ out << ", " << "vBool="; (__isset.vBool ? (out << to_string(vBool)) : (out << "<null>"));
+ out << ", " << "vLong="; (__isset.vLong ? (out << to_string(vLong)) : (out << "<null>"));
+ out << ", " << "vBinary="; (__isset.vBinary ? (out << to_string(vBinary)) : (out << "<null>"));
+ out << ")";
+}
+
+
+Log::~Log() noexcept {
+}
+
+
+void Log::__set_timestamp(const int64_t val) {
+ this->timestamp = val;
+}
+
+void Log::__set_fields(const std::vector<Tag> & val) {
+ this->fields = val;
+}
+std::ostream& operator<<(std::ostream& out, const Log& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+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;
+ int16_t fid;
+
+ xfer += iprot->readStructBegin(fname);
+
+ using ::apache::thrift::protocol::TProtocolException;
+
+ bool isset_timestamp = false;
+ bool isset_fields = 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_I64) {
+ xfer += iprot->readI64(this->timestamp);
+ isset_timestamp = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 2:
+ if (ftype == ::apache::thrift::protocol::T_LIST) {
+ {
+ this->fields.clear();
+ uint32_t _size3;
+ ::apache::thrift::protocol::TType _etype6;
+ xfer += iprot->readListBegin(_etype6, _size3);
+ this->fields.resize(_size3);
+ uint32_t _i7;
+ for (_i7 = 0; _i7 < _size3; ++_i7)
+ {
+ xfer += this->fields[_i7].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ isset_fields = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ if (!isset_timestamp)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_fields)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ return xfer;
+}
+
+uint32_t Log::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Log");
+
+ xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 1);
+ xfer += oprot->writeI64(this->timestamp);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("fields", ::apache::thrift::protocol::T_LIST, 2);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->fields.size()));
+ std::vector<Tag> ::const_iterator _iter8;
+ for (_iter8 = this->fields.begin(); _iter8 != this->fields.end(); ++_iter8)
+ {
+ xfer += (*_iter8).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(Log &a, Log &b) {
+ using ::std::swap;
+ swap(a.timestamp, b.timestamp);
+ swap(a.fields, b.fields);
+}
+
+Log::Log(const Log& other9) {
+ timestamp = other9.timestamp;
+ fields = other9.fields;
+}
+Log& Log::operator=(const Log& other10) {
+ timestamp = other10.timestamp;
+ fields = other10.fields;
+ return *this;
+}
+void Log::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Log(";
+ out << "timestamp=" << to_string(timestamp);
+ out << ", " << "fields=" << to_string(fields);
+ out << ")";
+}
+
+
+SpanRef::~SpanRef() noexcept {
+}
+
+
+void SpanRef::__set_refType(const SpanRefType::type val) {
+ this->refType = val;
+}
+
+void SpanRef::__set_traceIdLow(const int64_t val) {
+ this->traceIdLow = val;
+}
+
+void SpanRef::__set_traceIdHigh(const int64_t val) {
+ this->traceIdHigh = 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;
+}
+
+
+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;
+ int16_t fid;
+
+ xfer += iprot->readStructBegin(fname);
+
+ using ::apache::thrift::protocol::TProtocolException;
+
+ bool isset_refType = false;
+ bool isset_traceIdLow = false;
+ bool isset_traceIdHigh = false;
+ bool isset_spanId = 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_I32) {
+ int32_t ecast11;
+ xfer += iprot->readI32(ecast11);
+ this->refType = (SpanRefType::type)ecast11;
+ isset_refType = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 2:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->traceIdLow);
+ isset_traceIdLow = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 3:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->traceIdHigh);
+ isset_traceIdHigh = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 4:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->spanId);
+ isset_spanId = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ if (!isset_refType)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_traceIdLow)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_traceIdHigh)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_spanId)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ return xfer;
+}
+
+uint32_t SpanRef::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("SpanRef");
+
+ xfer += oprot->writeFieldBegin("refType", ::apache::thrift::protocol::T_I32, 1);
+ xfer += oprot->writeI32((int32_t)this->refType);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("traceIdLow", ::apache::thrift::protocol::T_I64, 2);
+ xfer += oprot->writeI64(this->traceIdLow);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("traceIdHigh", ::apache::thrift::protocol::T_I64, 3);
+ xfer += oprot->writeI64(this->traceIdHigh);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("spanId", ::apache::thrift::protocol::T_I64, 4);
+ xfer += oprot->writeI64(this->spanId);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(SpanRef &a, SpanRef &b) {
+ using ::std::swap;
+ swap(a.refType, b.refType);
+ swap(a.traceIdLow, b.traceIdLow);
+ swap(a.traceIdHigh, b.traceIdHigh);
+ swap(a.spanId, b.spanId);
+}
+
+SpanRef::SpanRef(const SpanRef& other12) {
+ refType = other12.refType;
+ traceIdLow = other12.traceIdLow;
+ traceIdHigh = other12.traceIdHigh;
+ spanId = other12.spanId;
+}
+SpanRef& SpanRef::operator=(const SpanRef& other13) {
+ refType = other13.refType;
+ traceIdLow = other13.traceIdLow;
+ traceIdHigh = other13.traceIdHigh;
+ spanId = other13.spanId;
+ return *this;
+}
+void SpanRef::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "SpanRef(";
+ out << "refType=" << to_string(refType);
+ out << ", " << "traceIdLow=" << to_string(traceIdLow);
+ out << ", " << "traceIdHigh=" << to_string(traceIdHigh);
+ out << ", " << "spanId=" << to_string(spanId);
+ out << ")";
+}
+
+
+Span::~Span() noexcept {
+}
+
+
+void Span::__set_traceIdLow(const int64_t val) {
+ this->traceIdLow = val;
+}
+
+void Span::__set_traceIdHigh(const int64_t val) {
+ this->traceIdHigh = val;
+}
+
+void Span::__set_spanId(const int64_t val) {
+ this->spanId = val;
+}
+
+void Span::__set_parentSpanId(const int64_t val) {
+ this->parentSpanId = val;
+}
+
+void Span::__set_operationName(const std::string& val) {
+ this->operationName = val;
+}
+
+void Span::__set_references(const std::vector<SpanRef> & val) {
+ this->references = val;
+__isset.references = true;
+}
+
+void Span::__set_flags(const int32_t val) {
+ this->flags = val;
+}
+
+void Span::__set_startTime(const int64_t val) {
+ this->startTime = val;
+}
+
+void Span::__set_duration(const int64_t val) {
+ this->duration = val;
+}
+
+void Span::__set_tags(const std::vector<Tag> & val) {
+ this->tags = val;
+__isset.tags = true;
+}
+
+void Span::__set_logs(const std::vector<Log> & val) {
+ this->logs = val;
+__isset.logs = true;
+}
+std::ostream& operator<<(std::ostream& out, const Span& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+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;
+ int16_t fid;
+
+ xfer += iprot->readStructBegin(fname);
+
+ using ::apache::thrift::protocol::TProtocolException;
+
+ bool isset_traceIdLow = false;
+ bool isset_traceIdHigh = false;
+ bool isset_spanId = false;
+ bool isset_parentSpanId = false;
+ bool isset_operationName = false;
+ bool isset_flags = false;
+ bool isset_startTime = false;
+ bool isset_duration = 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_I64) {
+ xfer += iprot->readI64(this->traceIdLow);
+ isset_traceIdLow = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 2:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->traceIdHigh);
+ isset_traceIdHigh = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 3:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->spanId);
+ isset_spanId = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 4:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->parentSpanId);
+ isset_parentSpanId = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 5:
+ if (ftype == ::apache::thrift::protocol::T_STRING) {
+ xfer += iprot->readString(this->operationName);
+ isset_operationName = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 6:
+ if (ftype == ::apache::thrift::protocol::T_LIST) {
+ {
+ this->references.clear();
+ uint32_t _size14;
+ ::apache::thrift::protocol::TType _etype17;
+ xfer += iprot->readListBegin(_etype17, _size14);
+ this->references.resize(_size14);
+ uint32_t _i18;
+ for (_i18 = 0; _i18 < _size14; ++_i18)
+ {
+ xfer += this->references[_i18].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ this->__isset.references = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 7:
+ if (ftype == ::apache::thrift::protocol::T_I32) {
+ xfer += iprot->readI32(this->flags);
+ isset_flags = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 8:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->startTime);
+ isset_startTime = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 9:
+ if (ftype == ::apache::thrift::protocol::T_I64) {
+ xfer += iprot->readI64(this->duration);
+ isset_duration = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 10:
+ if (ftype == ::apache::thrift::protocol::T_LIST) {
+ {
+ this->tags.clear();
+ uint32_t _size19;
+ ::apache::thrift::protocol::TType _etype22;
+ xfer += iprot->readListBegin(_etype22, _size19);
+ this->tags.resize(_size19);
+ uint32_t _i23;
+ for (_i23 = 0; _i23 < _size19; ++_i23)
+ {
+ xfer += this->tags[_i23].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ this->__isset.tags = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 11:
+ if (ftype == ::apache::thrift::protocol::T_LIST) {
+ {
+ this->logs.clear();
+ uint32_t _size24;
+ ::apache::thrift::protocol::TType _etype27;
+ xfer += iprot->readListBegin(_etype27, _size24);
+ this->logs.resize(_size24);
+ uint32_t _i28;
+ for (_i28 = 0; _i28 < _size24; ++_i28)
+ {
+ xfer += this->logs[_i28].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ this->__isset.logs = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ if (!isset_traceIdLow)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_traceIdHigh)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_spanId)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_parentSpanId)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_operationName)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_flags)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_startTime)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_duration)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ return xfer;
+}
+
+uint32_t Span::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Span");
+
+ xfer += oprot->writeFieldBegin("traceIdLow", ::apache::thrift::protocol::T_I64, 1);
+ xfer += oprot->writeI64(this->traceIdLow);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("traceIdHigh", ::apache::thrift::protocol::T_I64, 2);
+ xfer += oprot->writeI64(this->traceIdHigh);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("spanId", ::apache::thrift::protocol::T_I64, 3);
+ xfer += oprot->writeI64(this->spanId);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("parentSpanId", ::apache::thrift::protocol::T_I64, 4);
+ xfer += oprot->writeI64(this->parentSpanId);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("operationName", ::apache::thrift::protocol::T_STRING, 5);
+ xfer += oprot->writeString(this->operationName);
+ xfer += oprot->writeFieldEnd();
+
+ if (this->__isset.references) {
+ xfer += oprot->writeFieldBegin("references", ::apache::thrift::protocol::T_LIST, 6);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->references.size()));
+ std::vector<SpanRef> ::const_iterator _iter29;
+ for (_iter29 = this->references.begin(); _iter29 != this->references.end(); ++_iter29)
+ {
+ xfer += (*_iter29).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+ }
+ xfer += oprot->writeFieldBegin("flags", ::apache::thrift::protocol::T_I32, 7);
+ xfer += oprot->writeI32(this->flags);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("startTime", ::apache::thrift::protocol::T_I64, 8);
+ xfer += oprot->writeI64(this->startTime);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("duration", ::apache::thrift::protocol::T_I64, 9);
+ xfer += oprot->writeI64(this->duration);
+ xfer += oprot->writeFieldEnd();
+
+ if (this->__isset.tags) {
+ xfer += oprot->writeFieldBegin("tags", ::apache::thrift::protocol::T_LIST, 10);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->tags.size()));
+ std::vector<Tag> ::const_iterator _iter30;
+ for (_iter30 = this->tags.begin(); _iter30 != this->tags.end(); ++_iter30)
+ {
+ xfer += (*_iter30).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+ }
+ if (this->__isset.logs) {
+ xfer += oprot->writeFieldBegin("logs", ::apache::thrift::protocol::T_LIST, 11);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->logs.size()));
+ std::vector<Log> ::const_iterator _iter31;
+ for (_iter31 = this->logs.begin(); _iter31 != this->logs.end(); ++_iter31)
+ {
+ xfer += (*_iter31).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+ }
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(Span &a, Span &b) {
+ using ::std::swap;
+ swap(a.traceIdLow, b.traceIdLow);
+ swap(a.traceIdHigh, b.traceIdHigh);
+ swap(a.spanId, b.spanId);
+ swap(a.parentSpanId, b.parentSpanId);
+ swap(a.operationName, b.operationName);
+ swap(a.references, b.references);
+ swap(a.flags, b.flags);
+ swap(a.startTime, b.startTime);
+ swap(a.duration, b.duration);
+ swap(a.tags, b.tags);
+ swap(a.logs, b.logs);
+ swap(a.__isset, b.__isset);
+}
+
+Span::Span(const Span& other32) {
+ traceIdLow = other32.traceIdLow;
+ traceIdHigh = other32.traceIdHigh;
+ spanId = other32.spanId;
+ parentSpanId = other32.parentSpanId;
+ operationName = other32.operationName;
+ references = other32.references;
+ flags = other32.flags;
+ startTime = other32.startTime;
+ duration = other32.duration;
+ tags = other32.tags;
+ logs = other32.logs;
+ __isset = other32.__isset;
+}
+Span& Span::operator=(const Span& other33) {
+ traceIdLow = other33.traceIdLow;
+ traceIdHigh = other33.traceIdHigh;
+ spanId = other33.spanId;
+ parentSpanId = other33.parentSpanId;
+ operationName = other33.operationName;
+ references = other33.references;
+ flags = other33.flags;
+ startTime = other33.startTime;
+ duration = other33.duration;
+ tags = other33.tags;
+ logs = other33.logs;
+ __isset = other33.__isset;
+ return *this;
+}
+void Span::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Span(";
+ 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 << "<null>"));
+ out << ", " << "flags=" << to_string(flags);
+ out << ", " << "startTime=" << to_string(startTime);
+ out << ", " << "duration=" << to_string(duration);
+ out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "<null>"));
+ out << ", " << "logs="; (__isset.logs ? (out << to_string(logs)) : (out << "<null>"));
+ out << ")";
+}
+
+
+Process::~Process() noexcept {
+}
+
+
+void Process::__set_serviceName(const std::string& val) {
+ this->serviceName = val;
+}
+
+void Process::__set_tags(const std::vector<Tag> & val) {
+ this->tags = val;
+__isset.tags = true;
+}
+std::ostream& operator<<(std::ostream& out, const Process& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+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;
+ int16_t fid;
+
+ xfer += iprot->readStructBegin(fname);
+
+ using ::apache::thrift::protocol::TProtocolException;
+
+ bool isset_serviceName = 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_LIST) {
+ {
+ this->tags.clear();
+ uint32_t _size34;
+ ::apache::thrift::protocol::TType _etype37;
+ xfer += iprot->readListBegin(_etype37, _size34);
+ this->tags.resize(_size34);
+ uint32_t _i38;
+ for (_i38 = 0; _i38 < _size34; ++_i38)
+ {
+ xfer += this->tags[_i38].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ this->__isset.tags = true;
+ } 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);
+ return xfer;
+}
+
+uint32_t Process::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Process");
+
+ xfer += oprot->writeFieldBegin("serviceName", ::apache::thrift::protocol::T_STRING, 1);
+ xfer += oprot->writeString(this->serviceName);
+ xfer += oprot->writeFieldEnd();
+
+ if (this->__isset.tags) {
+ xfer += oprot->writeFieldBegin("tags", ::apache::thrift::protocol::T_LIST, 2);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->tags.size()));
+ std::vector<Tag> ::const_iterator _iter39;
+ for (_iter39 = this->tags.begin(); _iter39 != this->tags.end(); ++_iter39)
+ {
+ xfer += (*_iter39).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+ }
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(Process &a, Process &b) {
+ using ::std::swap;
+ swap(a.serviceName, b.serviceName);
+ swap(a.tags, b.tags);
+ swap(a.__isset, b.__isset);
+}
+
+Process::Process(const Process& other40) {
+ serviceName = other40.serviceName;
+ tags = other40.tags;
+ __isset = other40.__isset;
+}
+Process& Process::operator=(const Process& other41) {
+ serviceName = other41.serviceName;
+ tags = other41.tags;
+ __isset = other41.__isset;
+ return *this;
+}
+void Process::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Process(";
+ out << "serviceName=" << to_string(serviceName);
+ out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "<null>"));
+ out << ")";
+}
+
+
+Batch::~Batch() noexcept {
+}
+
+
+void Batch::__set_process(const Process& val) {
+ this->process = val;
+}
+
+void Batch::__set_spans(const std::vector<Span> & val) {
+ this->spans = val;
+}
+std::ostream& operator<<(std::ostream& out, const Batch& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+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;
+ int16_t fid;
+
+ xfer += iprot->readStructBegin(fname);
+
+ using ::apache::thrift::protocol::TProtocolException;
+
+ bool isset_process = false;
+ bool isset_spans = 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->process.read(iprot);
+ isset_process = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ case 2:
+ if (ftype == ::apache::thrift::protocol::T_LIST) {
+ {
+ this->spans.clear();
+ uint32_t _size42;
+ ::apache::thrift::protocol::TType _etype45;
+ xfer += iprot->readListBegin(_etype45, _size42);
+ this->spans.resize(_size42);
+ uint32_t _i46;
+ for (_i46 = 0; _i46 < _size42; ++_i46)
+ {
+ xfer += this->spans[_i46].read(iprot);
+ }
+ xfer += iprot->readListEnd();
+ }
+ isset_spans = true;
+ } else {
+ xfer += iprot->skip(ftype);
+ }
+ break;
+ default:
+ xfer += iprot->skip(ftype);
+ break;
+ }
+ xfer += iprot->readFieldEnd();
+ }
+
+ xfer += iprot->readStructEnd();
+
+ if (!isset_process)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ if (!isset_spans)
+ throw TProtocolException(TProtocolException::INVALID_DATA);
+ return xfer;
+}
+
+uint32_t Batch::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("Batch");
+
+ xfer += oprot->writeFieldBegin("process", ::apache::thrift::protocol::T_STRUCT, 1);
+ xfer += this->process.write(oprot);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldBegin("spans", ::apache::thrift::protocol::T_LIST, 2);
+ {
+ xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast<uint32_t>(this->spans.size()));
+ std::vector<Span> ::const_iterator _iter47;
+ for (_iter47 = this->spans.begin(); _iter47 != this->spans.end(); ++_iter47)
+ {
+ xfer += (*_iter47).write(oprot);
+ }
+ xfer += oprot->writeListEnd();
+ }
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(Batch &a, Batch &b) {
+ using ::std::swap;
+ swap(a.process, b.process);
+ swap(a.spans, b.spans);
+}
+
+Batch::Batch(const Batch& other48) {
+ process = other48.process;
+ spans = other48.spans;
+}
+Batch& Batch::operator=(const Batch& other49) {
+ process = other49.process;
+ spans = other49.spans;
+ return *this;
+}
+void Batch::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Batch(";
+ out << "process=" << to_string(process);
+ out << ", " << "spans=" << to_string(spans);
+ out << ")";
+}
+
+
+BatchSubmitResponse::~BatchSubmitResponse() noexcept {
+}
+
+
+void BatchSubmitResponse::__set_ok(const bool val) {
+ this->ok = val;
+}
+std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+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;
+ 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 BatchSubmitResponse::write(::apache::thrift::protocol::TProtocol* oprot) const {
+ uint32_t xfer = 0;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ xfer += oprot->writeStructBegin("BatchSubmitResponse");
+
+ xfer += oprot->writeFieldBegin("ok", ::apache::thrift::protocol::T_BOOL, 1);
+ xfer += oprot->writeBool(this->ok);
+ xfer += oprot->writeFieldEnd();
+
+ xfer += oprot->writeFieldStop();
+ xfer += oprot->writeStructEnd();
+ return xfer;
+}
+
+void swap(BatchSubmitResponse &a, BatchSubmitResponse &b) {
+ using ::std::swap;
+ swap(a.ok, b.ok);
+}
+
+BatchSubmitResponse::BatchSubmitResponse(const BatchSubmitResponse& other50) {
+ ok = other50.ok;
+}
+BatchSubmitResponse& BatchSubmitResponse::operator=(const BatchSubmitResponse& other51) {
+ ok = other51.ok;
+ return *this;
+}
+void BatchSubmitResponse::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "BatchSubmitResponse(";
+ out << "ok=" << to_string(ok);
+ out << ")";
+}
+
+}} // namespace
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.h
new file mode 100644
index 000000000..b30a3740b
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/jaeger_types.h
@@ -0,0 +1,481 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef jaeger_TYPES_H
+#define jaeger_TYPES_H
+
+#include <iosfwd>
+
+#include <thrift/Thrift.h>
+#include <thrift/TApplicationException.h>
+#include <thrift/TBase.h>
+#include <thrift/protocol/TProtocol.h>
+#include <thrift/transport/TTransport.h>
+
+#include <functional>
+#include <memory>
+
+
+namespace jaegertracing { namespace thrift {
+
+struct TagType {
+ enum type {
+ STRING = 0,
+ DOUBLE = 1,
+ BOOL = 2,
+ LONG = 3,
+ BINARY = 4
+ };
+};
+
+extern const std::map<int, const char*> _TagType_VALUES_TO_NAMES;
+
+std::ostream& operator<<(std::ostream& out, const TagType::type& val);
+
+std::string to_string(const TagType::type& val);
+
+struct SpanRefType {
+ enum type {
+ CHILD_OF = 0,
+ FOLLOWS_FROM = 1
+ };
+};
+
+extern const std::map<int, const char*> _SpanRefType_VALUES_TO_NAMES;
+
+std::ostream& operator<<(std::ostream& out, const SpanRefType::type& val);
+
+std::string to_string(const SpanRefType::type& val);
+
+class Tag;
+
+class Log;
+
+class SpanRef;
+
+class Span;
+
+class Process;
+
+class Batch;
+
+class BatchSubmitResponse;
+
+typedef struct _Tag__isset {
+ _Tag__isset() : vStr(false), vDouble(false), vBool(false), vLong(false), vBinary(false) {}
+ bool vStr :1;
+ bool vDouble :1;
+ bool vBool :1;
+ bool vLong :1;
+ bool vBinary :1;
+} _Tag__isset;
+
+class Tag : public virtual ::apache::thrift::TBase {
+ public:
+
+ Tag(const Tag&);
+ Tag& operator=(const Tag&);
+ Tag() : key(), vType((TagType::type)0), vStr(), vDouble(0), vBool(0), vLong(0), vBinary() {
+ }
+
+ virtual ~Tag() noexcept;
+ std::string key;
+ /**
+ *
+ * @see TagType
+ */
+ TagType::type vType;
+ std::string vStr;
+ double vDouble;
+ bool vBool;
+ int64_t vLong;
+ std::string vBinary;
+
+ _Tag__isset __isset;
+
+ void __set_key(const std::string& val);
+
+ void __set_vType(const TagType::type val);
+
+ void __set_vStr(const std::string& val);
+
+ void __set_vDouble(const double val);
+
+ void __set_vBool(const bool val);
+
+ void __set_vLong(const int64_t val);
+
+ void __set_vBinary(const std::string& val);
+
+ bool operator == (const Tag & rhs) const
+ {
+ if (!(key == rhs.key))
+ return false;
+ if (!(vType == rhs.vType))
+ return false;
+ if (__isset.vStr != rhs.__isset.vStr)
+ return false;
+ else if (__isset.vStr && !(vStr == rhs.vStr))
+ return false;
+ if (__isset.vDouble != rhs.__isset.vDouble)
+ return false;
+ else if (__isset.vDouble && !(vDouble == rhs.vDouble))
+ return false;
+ if (__isset.vBool != rhs.__isset.vBool)
+ return false;
+ else if (__isset.vBool && !(vBool == rhs.vBool))
+ return false;
+ if (__isset.vLong != rhs.__isset.vLong)
+ return false;
+ else if (__isset.vLong && !(vLong == rhs.vLong))
+ return false;
+ if (__isset.vBinary != rhs.__isset.vBinary)
+ return false;
+ else if (__isset.vBinary && !(vBinary == rhs.vBinary))
+ return false;
+ return true;
+ }
+ bool operator != (const Tag &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Tag & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Tag &a, Tag &b);
+
+std::ostream& operator<<(std::ostream& out, const Tag& obj);
+
+
+class Log : public virtual ::apache::thrift::TBase {
+ public:
+
+ Log(const Log&);
+ Log& operator=(const Log&);
+ Log() : timestamp(0) {
+ }
+
+ virtual ~Log() noexcept;
+ int64_t timestamp;
+ std::vector<Tag> fields;
+
+ void __set_timestamp(const int64_t val);
+
+ void __set_fields(const std::vector<Tag> & val);
+
+ bool operator == (const Log & rhs) const
+ {
+ if (!(timestamp == rhs.timestamp))
+ return false;
+ if (!(fields == rhs.fields))
+ return false;
+ return true;
+ }
+ bool operator != (const Log &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Log & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Log &a, Log &b);
+
+std::ostream& operator<<(std::ostream& out, const Log& obj);
+
+
+class SpanRef : public virtual ::apache::thrift::TBase {
+ public:
+
+ SpanRef(const SpanRef&);
+ SpanRef& operator=(const SpanRef&);
+ SpanRef() : refType((SpanRefType::type)0), traceIdLow(0), traceIdHigh(0), spanId(0) {
+ }
+
+ virtual ~SpanRef() noexcept;
+ /**
+ *
+ * @see SpanRefType
+ */
+ SpanRefType::type refType;
+ int64_t traceIdLow;
+ int64_t traceIdHigh;
+ int64_t spanId;
+
+ void __set_refType(const SpanRefType::type val);
+
+ void __set_traceIdLow(const int64_t val);
+
+ void __set_traceIdHigh(const int64_t val);
+
+ void __set_spanId(const int64_t val);
+
+ bool operator == (const SpanRef & rhs) const
+ {
+ if (!(refType == rhs.refType))
+ return false;
+ if (!(traceIdLow == rhs.traceIdLow))
+ return false;
+ if (!(traceIdHigh == rhs.traceIdHigh))
+ return false;
+ if (!(spanId == rhs.spanId))
+ return false;
+ return true;
+ }
+ bool operator != (const SpanRef &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const SpanRef & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(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;
+ bool tags :1;
+ bool logs :1;
+} _Span__isset;
+
+class Span : public virtual ::apache::thrift::TBase {
+ public:
+
+ Span(const Span&);
+ Span& operator=(const Span&);
+ Span() : traceIdLow(0), traceIdHigh(0), spanId(0), parentSpanId(0), operationName(), flags(0), startTime(0), duration(0) {
+ }
+
+ virtual ~Span() noexcept;
+ int64_t traceIdLow;
+ int64_t traceIdHigh;
+ int64_t spanId;
+ int64_t parentSpanId;
+ std::string operationName;
+ std::vector<SpanRef> references;
+ int32_t flags;
+ int64_t startTime;
+ int64_t duration;
+ std::vector<Tag> tags;
+ std::vector<Log> logs;
+
+ _Span__isset __isset;
+
+ void __set_traceIdLow(const int64_t val);
+
+ void __set_traceIdHigh(const int64_t val);
+
+ void __set_spanId(const int64_t val);
+
+ void __set_parentSpanId(const int64_t val);
+
+ void __set_operationName(const std::string& val);
+
+ void __set_references(const std::vector<SpanRef> & val);
+
+ void __set_flags(const int32_t val);
+
+ void __set_startTime(const int64_t val);
+
+ void __set_duration(const int64_t val);
+
+ void __set_tags(const std::vector<Tag> & val);
+
+ void __set_logs(const std::vector<Log> & val);
+
+ bool operator == (const Span & rhs) const
+ {
+ if (!(traceIdLow == rhs.traceIdLow))
+ return false;
+ if (!(traceIdHigh == rhs.traceIdHigh))
+ return false;
+ if (!(spanId == rhs.spanId))
+ return false;
+ if (!(parentSpanId == rhs.parentSpanId))
+ return false;
+ if (!(operationName == rhs.operationName))
+ return false;
+ if (__isset.references != rhs.__isset.references)
+ return false;
+ else if (__isset.references && !(references == rhs.references))
+ return false;
+ if (!(flags == rhs.flags))
+ return false;
+ if (!(startTime == rhs.startTime))
+ return false;
+ if (!(duration == rhs.duration))
+ return false;
+ if (__isset.tags != rhs.__isset.tags)
+ return false;
+ else if (__isset.tags && !(tags == rhs.tags))
+ return false;
+ if (__isset.logs != rhs.__isset.logs)
+ return false;
+ else if (__isset.logs && !(logs == rhs.logs))
+ 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;
+
+ 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 : public virtual ::apache::thrift::TBase {
+ public:
+
+ Process(const Process&);
+ Process& operator=(const Process&);
+ Process() : serviceName() {
+ }
+
+ virtual ~Process() noexcept;
+ std::string serviceName;
+ std::vector<Tag> tags;
+
+ _Process__isset __isset;
+
+ void __set_serviceName(const std::string& val);
+
+ void __set_tags(const std::vector<Tag> & val);
+
+ bool operator == (const Process & rhs) const
+ {
+ if (!(serviceName == rhs.serviceName))
+ return false;
+ if (__isset.tags != rhs.__isset.tags)
+ return false;
+ else if (__isset.tags && !(tags == rhs.tags))
+ return false;
+ return true;
+ }
+ bool operator != (const Process &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Process & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Process &a, Process &b);
+
+std::ostream& operator<<(std::ostream& out, const Process& obj);
+
+
+class Batch : public virtual ::apache::thrift::TBase {
+ public:
+
+ Batch(const Batch&);
+ Batch& operator=(const Batch&);
+ Batch() {
+ }
+
+ virtual ~Batch() noexcept;
+ Process process;
+ std::vector<Span> spans;
+
+ void __set_process(const Process& val);
+
+ void __set_spans(const std::vector<Span> & val);
+
+ bool operator == (const Batch & rhs) const
+ {
+ if (!(process == rhs.process))
+ return false;
+ if (!(spans == rhs.spans))
+ return false;
+ return true;
+ }
+ bool operator != (const Batch &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const Batch & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Batch &a, Batch &b);
+
+std::ostream& operator<<(std::ostream& out, const Batch& obj);
+
+
+class BatchSubmitResponse : public virtual ::apache::thrift::TBase {
+ public:
+
+ BatchSubmitResponse(const BatchSubmitResponse&);
+ BatchSubmitResponse& operator=(const BatchSubmitResponse&);
+ BatchSubmitResponse() : ok(0) {
+ }
+
+ virtual ~BatchSubmitResponse() noexcept;
+ bool ok;
+
+ void __set_ok(const bool val);
+
+ bool operator == (const BatchSubmitResponse & rhs) const
+ {
+ if (!(ok == rhs.ok))
+ return false;
+ return true;
+ }
+ bool operator != (const BatchSubmitResponse &rhs) const {
+ return !(*this == rhs);
+ }
+
+ bool operator < (const BatchSubmitResponse & ) const;
+
+ uint32_t read(::apache::thrift::protocol::TProtocol* iprot);
+ uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(BatchSubmitResponse &a, BatchSubmitResponse &b);
+
+std::ostream& operator<<(std::ostream& out, const BatchSubmitResponse& obj);
+
+}} // namespace
+
+#endif
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.cpp
new file mode 100644
index 000000000..8dd451e48
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.cpp
@@ -0,0 +1,49 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#include "zipkincore_constants.h"
+
+namespace twitter { namespace zipkin { namespace thrift {
+
+const zipkincoreConstants g_zipkincore_constants;
+
+zipkincoreConstants::zipkincoreConstants() {
+ CLIENT_SEND = "cs";
+
+ CLIENT_RECV = "cr";
+
+ SERVER_SEND = "ss";
+
+ SERVER_RECV = "sr";
+
+ MESSAGE_SEND = "ms";
+
+ MESSAGE_RECV = "mr";
+
+ 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";
+
+ MESSAGE_ADDR = "ma";
+
+}
+
+}}} // namespace
+
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.h
new file mode 100644
index 000000000..22b4b3b67
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_constants.h
@@ -0,0 +1,40 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef zipkincore_CONSTANTS_H
+#define zipkincore_CONSTANTS_H
+
+#include "zipkincore_types.h"
+
+namespace twitter { namespace zipkin { namespace thrift {
+
+class zipkincoreConstants {
+ public:
+ zipkincoreConstants();
+
+ std::string CLIENT_SEND;
+ std::string CLIENT_RECV;
+ std::string SERVER_SEND;
+ std::string SERVER_RECV;
+ std::string MESSAGE_SEND;
+ std::string MESSAGE_RECV;
+ std::string WIRE_SEND;
+ std::string WIRE_RECV;
+ std::string CLIENT_SEND_FRAGMENT;
+ std::string CLIENT_RECV_FRAGMENT;
+ std::string SERVER_SEND_FRAGMENT;
+ std::string SERVER_RECV_FRAGMENT;
+ std::string LOCAL_COMPONENT;
+ std::string CLIENT_ADDR;
+ std::string SERVER_ADDR;
+ std::string MESSAGE_ADDR;
+};
+
+extern const zipkincoreConstants g_zipkincore_constants;
+
+}}} // namespace
+
+#endif
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.cpp b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.cpp
new file mode 100644
index 000000000..a8b52e902
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.cpp
@@ -0,0 +1,913 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#include "zipkincore_types.h"
+
+#include <algorithm>
+#include <ostream>
+
+#include <thrift/TToString.h>
+
+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<int, const char*> _AnnotationType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(7, _kAnnotationTypeValues, _kAnnotationTypeNames), ::apache::thrift::TEnumIterator(-1, nullptr, nullptr));
+
+std::ostream& operator<<(std::ostream& out, const AnnotationType::type& val) {
+ std::map<int, const char*>::const_iterator it = _AnnotationType_VALUES_TO_NAMES.find(val);
+ if (it != _AnnotationType_VALUES_TO_NAMES.end()) {
+ out << it->second;
+ } else {
+ out << static_cast<int>(val);
+ }
+ return out;
+}
+
+std::string to_string(const AnnotationType::type& val) {
+ std::map<int, const char*>::const_iterator it = _AnnotationType_VALUES_TO_NAMES.find(val);
+ if (it != _AnnotationType_VALUES_TO_NAMES.end()) {
+ return std::string(it->second);
+ } else {
+ return std::to_string(static_cast<int>(val));
+ }
+}
+
+
+Endpoint::~Endpoint() noexcept {
+}
+
+
+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;
+}
+std::ostream& operator<<(std::ostream& out, const Endpoint& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+uint32_t Endpoint::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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();
+ 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;
+}
+void Endpoint::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Endpoint(";
+ out << "ipv4=" << to_string(ipv4);
+ out << ", " << "port=" << to_string(port);
+ out << ", " << "service_name=" << to_string(service_name);
+ out << ", " << "ipv6="; (__isset.ipv6 ? (out << to_string(ipv6)) : (out << "<null>"));
+ out << ")";
+}
+
+
+Annotation::~Annotation() noexcept {
+}
+
+
+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;
+}
+std::ostream& operator<<(std::ostream& out, const Annotation& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+uint32_t Annotation::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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();
+ 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;
+}
+void Annotation::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Annotation(";
+ out << "timestamp=" << to_string(timestamp);
+ out << ", " << "value=" << to_string(value);
+ out << ", " << "host="; (__isset.host ? (out << to_string(host)) : (out << "<null>"));
+ out << ")";
+}
+
+
+BinaryAnnotation::~BinaryAnnotation() noexcept {
+}
+
+
+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;
+}
+std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+uint32_t BinaryAnnotation::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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();
+ 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;
+}
+void BinaryAnnotation::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "BinaryAnnotation(";
+ out << "key=" << to_string(key);
+ out << ", " << "value=" << to_string(value);
+ out << ", " << "annotation_type=" << to_string(annotation_type);
+ out << ", " << "host="; (__isset.host ? (out << to_string(host)) : (out << "<null>"));
+ out << ")";
+}
+
+
+Span::~Span() noexcept {
+}
+
+
+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<Annotation> & val) {
+ this->annotations = val;
+}
+
+void Span::__set_binary_annotations(const std::vector<BinaryAnnotation> & 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;
+}
+std::ostream& operator<<(std::ostream& out, const Span& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+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;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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<uint32_t>(this->annotations.size()));
+ std::vector<Annotation> ::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<uint32_t>(this->binary_annotations.size()));
+ std::vector<BinaryAnnotation> ::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();
+ 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;
+}
+void Span::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Span(";
+ out << "trace_id=" << to_string(trace_id);
+ out << ", " << "name=" << to_string(name);
+ out << ", " << "id=" << to_string(id);
+ out << ", " << "parent_id="; (__isset.parent_id ? (out << to_string(parent_id)) : (out << "<null>"));
+ out << ", " << "annotations=" << to_string(annotations);
+ out << ", " << "binary_annotations=" << to_string(binary_annotations);
+ out << ", " << "debug="; (__isset.debug ? (out << to_string(debug)) : (out << "<null>"));
+ out << ", " << "timestamp="; (__isset.timestamp ? (out << to_string(timestamp)) : (out << "<null>"));
+ out << ", " << "duration="; (__isset.duration ? (out << to_string(duration)) : (out << "<null>"));
+ out << ", " << "trace_id_high="; (__isset.trace_id_high ? (out << to_string(trace_id_high)) : (out << "<null>"));
+ out << ")";
+}
+
+
+Response::~Response() noexcept {
+}
+
+
+void Response::__set_ok(const bool val) {
+ this->ok = val;
+}
+std::ostream& operator<<(std::ostream& out, const Response& obj)
+{
+ obj.printTo(out);
+ return out;
+}
+
+
+uint32_t Response::read(::apache::thrift::protocol::TProtocol* iprot) {
+
+ ::apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
+ uint32_t xfer = 0;
+ std::string fname;
+ ::apache::thrift::protocol::TType ftype;
+ 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;
+ ::apache::thrift::protocol::TOutputRecursionTracker tracker(*oprot);
+ 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();
+ 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;
+}
+void Response::printTo(std::ostream& out) const {
+ using ::apache::thrift::to_string;
+ out << "Response(";
+ out << "ok=" << to_string(ok);
+ out << ")";
+}
+
+}}} // namespace
diff --git a/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.h b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.h
new file mode 100644
index 000000000..c03421f43
--- /dev/null
+++ b/src/jaegertracing/opentelemetry-cpp/exporters/jaeger/thrift-gen/zipkincore_types.h
@@ -0,0 +1,493 @@
+/**
+ * Autogenerated by Thrift Compiler (0.14.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ * @generated
+ */
+#ifndef zipkincore_TYPES_H
+#define zipkincore_TYPES_H
+
+#include <iosfwd>
+
+#include <thrift/Thrift.h>
+#include <thrift/TApplicationException.h>
+#include <thrift/TBase.h>
+#include <thrift/protocol/TProtocol.h>
+#include <thrift/transport/TTransport.h>
+
+#include <functional>
+#include <memory>
+
+
+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<int, const char*> _AnnotationType_VALUES_TO_NAMES;
+
+std::ostream& operator<<(std::ostream& out, const AnnotationType::type& val);
+
+std::string to_string(const AnnotationType::type& val);
+
+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;
+
+/**
+ * Indicates the network context of a service recording an annotation with two
+ * exceptions.
+ *
+ * When a BinaryAnnotation, and key is CLIENT_ADDR or SERVER_ADDR,
+ * the endpoint indicates the source or destination of an RPC. This exception
+ * allows zipkin to display network context of uninstrumented services, or
+ * clients such as web browsers.
+ */
+class Endpoint : public virtual ::apache::thrift::TBase {
+ public:
+
+ Endpoint(const Endpoint&);
+ Endpoint& operator=(const Endpoint&);
+ Endpoint() : ipv4(0), port(0), service_name(), ipv6() {
+ }
+
+ virtual ~Endpoint() noexcept;
+ /**
+ * IPv4 host address packed into 4 bytes.
+ *
+ * Ex for the ip 1.2.3.4, it would be (1 << 24) | (2 << 16) | (3 << 8) | 4
+ */
+ int32_t ipv4;
+ /**
+ * IPv4 port
+ *
+ * Note: this is to be treated as an unsigned integer, so watch for negatives.
+ *
+ * Conventionally, when the port isn't known, port = 0.
+ */
+ int16_t port;
+ /**
+ * Service name in lowercase, such as "memcache" or "zipkin-web"
+ *
+ * Conventionally, when the service name isn't known, service_name = "unknown".
+ */
+ std::string service_name;
+ /**
+ * IPv6 host address packed into 16 bytes. Ex Inet6Address.getBytes()
+ */
+ 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;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Endpoint &a, Endpoint &b);
+
+std::ostream& operator<<(std::ostream& out, const Endpoint& obj);
+
+typedef struct _Annotation__isset {
+ _Annotation__isset() : timestamp(false), value(false), host(false) {}
+ bool timestamp :1;
+ bool value :1;
+ bool host :1;
+} _Annotation__isset;
+
+/**
+ * An annotation is similar to a log statement. It includes a host field which
+ * allows these events to be attributed properly, and also aggregatable.
+ */
+class Annotation : public virtual ::apache::thrift::TBase {
+ public:
+
+ Annotation(const Annotation&);
+ Annotation& operator=(const Annotation&);
+ Annotation() : timestamp(0), value() {
+ }
+
+ virtual ~Annotation() noexcept;
+ /**
+ * Microseconds from epoch.
+ *
+ * This value should use the most precise value possible. For example,
+ * gettimeofday or syncing nanoTime against a tick of currentTimeMillis.
+ */
+ int64_t timestamp;
+ std::string value;
+ /**
+ * Always the host that recorded the event. By specifying the host you allow
+ * rollup of all events (such as client requests to a service) by IP address.
+ */
+ 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;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Annotation &a, Annotation &b);
+
+std::ostream& operator<<(std::ostream& out, const Annotation& obj);
+
+typedef struct _BinaryAnnotation__isset {
+ _BinaryAnnotation__isset() : key(false), value(false), annotation_type(false), host(false) {}
+ bool key :1;
+ bool value :1;
+ bool annotation_type :1;
+ bool host :1;
+} _BinaryAnnotation__isset;
+
+/**
+ * Binary annotations are tags applied to a Span to give it context. For
+ * example, a binary annotation of "http.uri" could the path to a resource in a
+ * RPC call.
+ *
+ * Binary annotations of type STRING are always queryable, though more a
+ * historical implementation detail than a structural concern.
+ *
+ * Binary annotations can repeat, and vary on the host. Similar to Annotation,
+ * the host indicates who logged the event. This allows you to tell the
+ * difference between the client and server side of the same key. For example,
+ * the key "http.uri" might be different on the client and server side due to
+ * rewriting, like "/api/v1/myresource" vs "/myresource. Via the host field,
+ * you can see the different points of view, which often help in debugging.
+ */
+class BinaryAnnotation : public virtual ::apache::thrift::TBase {
+ public:
+
+ BinaryAnnotation(const BinaryAnnotation&);
+ BinaryAnnotation& operator=(const BinaryAnnotation&);
+ BinaryAnnotation() : key(), value(), annotation_type((AnnotationType::type)0) {
+ }
+
+ virtual ~BinaryAnnotation() noexcept;
+ std::string key;
+ std::string value;
+ /**
+ *
+ * @see AnnotationType
+ */
+ AnnotationType::type annotation_type;
+ /**
+ * The host that recorded tag, which allows you to differentiate between
+ * multiple tags with the same key. There are two exceptions to this.
+ *
+ * When the key is CLIENT_ADDR or SERVER_ADDR, host indicates the source or
+ * destination of an RPC. This exception allows zipkin to display network
+ * context of uninstrumented services, or clients such as web browsers.
+ */
+ 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;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(BinaryAnnotation &a, BinaryAnnotation &b);
+
+std::ostream& operator<<(std::ostream& out, const BinaryAnnotation& obj);
+
+typedef struct _Span__isset {
+ _Span__isset() : trace_id(false), name(false), id(false), parent_id(false), annotations(false), binary_annotations(false), debug(true), timestamp(false), duration(false), trace_id_high(false) {}
+ bool trace_id :1;
+ 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;
+
+/**
+ * A trace is a series of spans (often RPC calls) which form a latency tree.
+ *
+ * The root span is where trace_id = id and parent_id = Nil. The root span is
+ * usually the longest interval in the trace, starting with a SERVER_RECV
+ * annotation and ending with a SERVER_SEND.
+ */
+class Span : public virtual ::apache::thrift::TBase {
+ public:
+
+ 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() noexcept;
+ int64_t trace_id;
+ /**
+ * Span name in lowercase, rpc method for example
+ *
+ * Conventionally, when the span name isn't known, name = "unknown".
+ */
+ std::string name;
+ int64_t id;
+ int64_t parent_id;
+ std::vector<Annotation> annotations;
+ std::vector<BinaryAnnotation> binary_annotations;
+ bool debug;
+ /**
+ * Microseconds from epoch of the creation of this span.
+ *
+ * This value should be set directly by instrumentation, using the most
+ * precise value possible. For example, gettimeofday or syncing nanoTime
+ * against a tick of currentTimeMillis.
+ *
+ * For compatibility with instrumentation that precede this field, collectors
+ * or span stores can derive this via Annotation.timestamp.
+ * For example, SERVER_RECV.timestamp or CLIENT_SEND.timestamp.
+ *
+ * This field is optional for compatibility with old data: first-party span
+ * stores are expected to support this at time of introduction.
+ */
+ int64_t timestamp;
+ /**
+ * Measurement of duration in microseconds, used to support queries.
+ *
+ * This value should be set directly, where possible. Doing so encourages
+ * precise measurement decoupled from problems of clocks, such as skew or NTP
+ * updates causing time to move backwards.
+ *
+ * For compatibility with instrumentation that precede this field, collectors
+ * or span stores can derive this by subtracting Annotation.timestamp.
+ * For example, SERVER_SEND.timestamp - SERVER_RECV.timestamp.
+ *
+ * If this field is persisted as unset, zipkin will continue to work, except
+ * duration query support will be implementation-specific. Similarly, setting
+ * this field non-atomically is implementation-specific.
+ *
+ * This field is i64 vs i32 to support spans longer than 35 minutes.
+ */
+ int64_t duration;
+ /**
+ * Optional unique 8-byte additional identifier for a trace. If non zero, this
+ * means the trace uses 128 bit traceIds instead of 64 bit.
+ */
+ 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<Annotation> & val);
+
+ void __set_binary_annotations(const std::vector<BinaryAnnotation> & 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;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Span &a, Span &b);
+
+std::ostream& operator<<(std::ostream& out, const Span& obj);
+
+
+class Response : public virtual ::apache::thrift::TBase {
+ public:
+
+ Response(const Response&);
+ Response& operator=(const Response&);
+ Response() : ok(0) {
+ }
+
+ virtual ~Response() noexcept;
+ 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;
+
+ virtual void printTo(std::ostream& out) const;
+};
+
+void swap(Response &a, Response &b);
+
+std::ostream& operator<<(std::ostream& out, const Response& obj);
+
+}}} // namespace
+
+#endif