diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ac8999459..e1666dabbb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,6 @@ jobs: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 run: | - sudo -E ./ci/setup_thrift.sh ./ci/do_ci.sh cmake.test # @@ -88,7 +87,6 @@ jobs: CC: /usr/bin/gcc-12 CXX: /usr/bin/g++-12 run: | - sudo -E ./ci/setup_thrift.sh ./ci/do_ci.sh cmake.maintainer.sync.test - name: generate test cert env: @@ -122,7 +120,6 @@ jobs: CC: /usr/bin/gcc-12 CXX: /usr/bin/g++-12 run: | - sudo -E ./ci/setup_thrift.sh ./ci/do_ci.sh cmake.maintainer.async.test - name: generate test cert env: @@ -156,7 +153,6 @@ jobs: CC: /usr/bin/clang-14 CXX: /usr/bin/clang++-14 run: | - sudo -E ./ci/setup_thrift.sh ./ci/do_ci.sh cmake.maintainer.sync.test - name: generate test cert env: @@ -190,7 +186,6 @@ jobs: CC: /usr/bin/clang-14 CXX: /usr/bin/clang++-14 run: | - sudo -E ./ci/setup_thrift.sh ./ci/do_ci.sh cmake.maintainer.async.test - name: generate test cert env: @@ -235,7 +230,6 @@ jobs: CC: /usr/bin/gcc-10 CXX: /usr/bin/g++-10 run: | - sudo -E ./ci/setup_thrift.sh ./ci/do_ci.sh cmake.with_async_export.test cmake_absel_stl_test: @@ -455,7 +449,6 @@ jobs: key: bazel_test - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -477,7 +470,6 @@ jobs: key: bazel_test - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -499,7 +491,6 @@ jobs: key: bazel_test - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -521,7 +512,6 @@ jobs: key: bazel_valgrind - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -543,7 +533,6 @@ jobs: key: bazel_noexcept - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -565,7 +554,6 @@ jobs: key: bazel_nortti - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -587,7 +575,6 @@ jobs: key: bazel_asan - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -609,7 +596,6 @@ jobs: key: bazel_tsan - name: setup run: | - sudo ./ci/setup_thrift.sh dependencies_only sudo ./ci/setup_ci_environment.sh sudo ./ci/install_bazelisk.sh - name: run tests @@ -738,7 +724,6 @@ jobs: submodules: 'recursive' - name: setup run: | - ./ci/setup_thrift.ps1 ./ci/install_windows_bazelisk.ps1 - name: run tests run: ./ci/do_ci.ps1 bazel.build diff --git a/CHANGELOG.md b/CHANGELOG.md index 3330790d2b..52a9e19f26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,19 @@ Increment the: ## [Unreleased] +* [REMOVAL] Remove the jaeger exporter + [#2031](https://github.com/open-telemetry/opentelemetry-cpp/pull/2031) + * [API] Remove include_trace_context [#2194](https://github.com/open-telemetry/opentelemetry-cpp/pull/2194) +Important changes: + +* [REMOVAL] Remove the jaeger exporter + [#2031](https://github.com/open-telemetry/opentelemetry-cpp/pull/2031) + * The CMake `WITH_JAEGER` option has been removed + * Please remove usage of `WITH_JAEGER` from user scripts and makefiles. + ## [1.9.1] 2023-05-26 * [DEPRECATION] Drop C++11 support diff --git a/CMakeLists.txt b/CMakeLists.txt index 27930fe793..fb483f5a58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -182,8 +182,6 @@ option(WITH_ELASTICSEARCH option(WITH_ZPAGES "Whether to include the Zpages Server in the SDK" OFF) -option(WITH_JAEGER "DEPRECATED - Whether to include the Jaeger exporter" OFF) - option(WITH_NO_GETENV "Whether the platform supports environment variables" OFF) option(BUILD_TESTING "Whether to enable tests" ON) @@ -295,25 +293,6 @@ function(set_target_version target_name) endif() endfunction() -if(WITH_JAEGER) - if(WITH_NO_DEPRECATED_CODE) - message(FATAL_ERROR "Jaeger is DEPRECATED.") - else() - message(WARNING "Jaeger is DEPRECATED.") - endif() - - find_package(Thrift QUIET) - if(Thrift_FOUND) - find_package(Boost REQUIRED) - include_directories(${Boost_INCLUDE_DIR}) - else() - # Install Thrift and propagate via vcpkg toolchain file - if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) - install_windows_deps() - endif() - endif() -endif() - if(MSVC) # Options for Visual C++ compiler: /Zc:__cplusplus - report an updated value # for recent C++ language standards. Without this option MSVC returns the @@ -405,7 +384,6 @@ endif() if(WITH_OTLP_HTTP OR WITH_ELASTICSEARCH - OR WITH_JAEGER OR WITH_ZIPKIN OR BUILD_W3CTRACECONTEXT_TEST OR WITH_EXAMPLES_HTTP) diff --git a/DEPRECATED.md b/DEPRECATED.md index 2284197309..d77c3f073e 100644 --- a/DEPRECATED.md +++ b/DEPRECATED.md @@ -93,9 +93,7 @@ but the C++11 build will no longer be tested for each new release. ## [Third party dependencies] -### Jaeger - -See [Jaeger exporter](#jaeger-exporter) +N/A ## [Build tools] @@ -107,15 +105,7 @@ N/A ## [opentelemetry-cpp API] -N/A - -## [opentelemetry-cpp SDK] - -N/A - -## [opentelemetry-cpp Exporter] - -### Jaeger exporter +### Jaeger propagator #### Announcement (Jaeger) @@ -124,24 +114,17 @@ N/A * PR: [DEPRECATION] Deprecate the Jaeger exporter [#1923](https://github.com/open-telemetry/opentelemetry-cpp/pull/1923) -#### Motivation (Jaeger) +This PR also listed the Jaeger propagator as deprecated. -The Jaeger client libraries are deprecated, as announced -[here](https://www.jaegertracing.io/docs/1.41/client-libraries/). +#### Motivation (Jaeger) -The initial Jaeger announcement in release 1.35 reads as: +The Jaeger Exporter is now (July 2023) removed from the OpenTelemetry specification. -" -We plan to continue accepting pull requests and making new releases of -Jaeger clients through the end of 2021. In January 2022 we will enter a code -freeze period for 6 months, during which time we will no longer accept pull -requests with new features, with the exception of security-related fixes. -After that we will archive the client library repositories and will no -longer accept new changes. -" +The Jaeger Propagator remains, because changing propagation is a longer +process compared to changing an export format. -At time of writing, Jan 2023, the client libraries have been archived 6 -months ago already. +New deployments however are encouraged to use a W3C compliant propagator, +and avoid the Jaeger propagator, which is now deprecated. #### Scope (Jaeger) @@ -149,25 +132,26 @@ The following are deprecated and planned for removal: * the API header `opentelemetry/trace/propagation/jaeger.h`, including: * the C++ class `JaegerPropagator` -* all the code located under `exporters/jaeger/`, including: - * the jaeger exporter C++ class (`JaegerExporter`) - * the related factory (`JaegerExporterFactory`) - * the related options (`JaegerExporterOptions`) -* the jaeger exporter library(`opentelemetry_exporter_jaeger_trace`) -* the jaeger build options in CMake (`WITH_JAEGER`) -* the dependency on thrift #### Mitigation (Jaeger) -Jaeger supports natively the OTLP protocol, starting with jaeger 1.35. +Use a W3C compliant propagator instead. + +That is, use class HttpTraceContext and "traceparent" tags. -An application instrumented with opentelemetry needs to change how the SDK -and exporter are configured to replace the Jaeger exporter with the OTLP -exporter (both OTLP HTTP and OTLP GRPC are supported). +Do not use class JaegerPropagator and "uber-trace-id" tags. #### Planned removal (Jaeger) -* Date: July, 2023 +No date set yet for the Jaeger Propagator. + +## [opentelemetry-cpp SDK] + +N/A + +## [opentelemetry-cpp Exporter] + +N/A ## [Documentation] diff --git a/bazel/repository.bzl b/bazel/repository.bzl index 1cf6410488..0cf8a2d8b2 100644 --- a/bazel/repository.bzl +++ b/bazel/repository.bzl @@ -153,18 +153,6 @@ def opentelemetry_cpp_deps(): ], ) - # libthrift (optional) - maybe( - http_archive, - name = "com_github_thrift", - build_file_content = _ALL_CONTENT, - sha256 = "5ae1c4d16452a22eaf9d802ba7489907147c2b316ff38c9758918552fae5132c", - strip_prefix = "thrift-0.14.1", - urls = [ - "https://github.com/apache/thrift/archive/refs/tags/v0.14.1.tar.gz", - ], - ) - # rules foreign cc maybe( http_archive, @@ -195,25 +183,3 @@ def opentelemetry_cpp_deps(): "https://github.com/opentracing/opentracing-cpp/archive/refs/tags/v1.6.0.tar.gz", ], ) - - # boost headers from vcpkg - maybe( - native.new_local_repository, - name = "boost_all_hdrs", - build_file_content = """ -package(default_visibility = ["//visibility:public"]) -cc_library( - name = "boost_all_hdrs", - hdrs = glob( - ["include/**/*.h*"], - ), - strip_include_prefix = "include", - copts = [ - "-isystem include", - "-fexceptions", - ], - visibility = ["//visibility:public"], -) - """, - path = "tools/vcpkg/installed/x64-windows/", - ) diff --git a/ci/do_ci.ps1 b/ci/do_ci.ps1 index 0ffe716ca1..a91ebc0255 100644 --- a/ci/do_ci.ps1 +++ b/ci/do_ci.ps1 @@ -85,7 +85,6 @@ switch ($action) { cmake $SRC_DIR ` -DOTELCPP_MAINTAINER_MODE=ON ` -DWITH_NO_DEPRECATED_CODE=ON ` - -DWITH_JAEGER=OFF ` -DVCPKG_TARGET_TRIPLET=x64-windows ` "-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake" $exit = $LASTEXITCODE diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 6020d22a04..e4e4807c82 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -68,7 +68,7 @@ BAZEL_OPTIONS_ASYNC="$BAZEL_OPTIONS --copt=-DENABLE_ASYNC_EXPORT" BAZEL_TEST_OPTIONS_ASYNC="$BAZEL_OPTIONS_ASYNC --test_output=errors" # https://github.com/bazelbuild/bazel/issues/4341 -BAZEL_MACOS_OPTIONS="$BAZEL_OPTIONS_ASYNC --features=-supports_dynamic_linker --build_tag_filters=-jaeger" +BAZEL_MACOS_OPTIONS="$BAZEL_OPTIONS_ASYNC --features=-supports_dynamic_linker" BAZEL_MACOS_TEST_OPTIONS="$BAZEL_MACOS_OPTIONS --test_output=errors" BAZEL_STARTUP_OPTIONS="--output_user_root=$HOME/.cache/bazel" @@ -81,7 +81,6 @@ if [[ "$1" == "cmake.test" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug \ -DWITH_PROMETHEUS=ON \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ @@ -101,7 +100,6 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then -DWITH_EXAMPLES=ON \ -DWITH_EXAMPLES_HTTP=ON \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=OFF \ -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_LOGS_PREVIEW=ON \ @@ -124,7 +122,6 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then -DWITH_EXAMPLES=ON \ -DWITH_EXAMPLES_HTTP=ON \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=OFF \ -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_LOGS_PREVIEW=ON \ @@ -148,7 +145,6 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then -DWITH_EXAMPLES=ON \ -DWITH_EXAMPLES_HTTP=ON \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=OFF \ -DBUILD_W3CTRACECONTEXT_TEST=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_LOGS_PREVIEW=ON \ @@ -166,7 +162,6 @@ elif [[ "$1" == "cmake.with_async_export.test" ]]; then cmake -DCMAKE_BUILD_TYPE=Debug \ -DWITH_PROMETHEUS=ON \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=ON \ -DWITH_ELASTICSEARCH=ON \ -DWITH_METRICS_EXEMPLAR_PREVIEW=ON \ -DWITH_LOGS_PREVIEW=ON \ @@ -359,8 +354,8 @@ elif [[ "$1" == "bazel.benchmark" ]]; then run_benchmarks exit 0 elif [[ "$1" == "bazel.macos.test" ]]; then - bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_MACOS_OPTIONS -- //... -//exporters/jaeger/... - bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_MACOS_TEST_OPTIONS -- //... -//exporters/jaeger/... + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_MACOS_OPTIONS -- //... + bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_MACOS_TEST_OPTIONS -- //... exit 0 elif [[ "$1" == "bazel.legacy.test" ]]; then # we uses C++ future and async() function to test the Prometheus Exporter functionality, @@ -369,17 +364,17 @@ elif [[ "$1" == "bazel.legacy.test" ]]; then bazel $BAZEL_STARTUP_OPTIONS test $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/otlp/... -//exporters/prometheus/... exit 0 elif [[ "$1" == "bazel.noexcept" ]]; then - # there are some exceptions and error handling code from the Prometheus and Jaeger Clients + # there are some exceptions and error handling code from the Prometheus Client # as well as Opentracing shim (due to some third party code in its Opentracing dependency) # that make this test always fail. Ignore these packages in the noexcept test here. - bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/... -//sdk/test/metrics:attributes_hashmap_test -//opentracing-shim/... - bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... -//examples/prometheus/... -//sdk/test/metrics:attributes_hashmap_test -//opentracing-shim/... + bazel $BAZEL_STARTUP_OPTIONS build --copt=-fno-exceptions $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//sdk/test/metrics:attributes_hashmap_test -//opentracing-shim/... + bazel $BAZEL_STARTUP_OPTIONS test --copt=-fno-exceptions $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//examples/prometheus/... -//sdk/test/metrics:attributes_hashmap_test -//opentracing-shim/... exit 0 elif [[ "$1" == "bazel.nortti" ]]; then - # there are some exceptions and error handling code from the Prometheus and Jaeger Clients + # there are some exceptions and error handling code from the Prometheus Client # that make this test always fail. Ignore these packages in the nortti test here. - bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... - bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti --build_tag_filters=-jaeger $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... -//exporters/jaeger/... + bazel $BAZEL_STARTUP_OPTIONS build --cxxopt=-fno-rtti $BAZEL_OPTIONS_ASYNC -- //... -//exporters/prometheus/... + bazel $BAZEL_STARTUP_OPTIONS test --cxxopt=-fno-rtti $BAZEL_TEST_OPTIONS_ASYNC -- //... -//exporters/prometheus/... exit 0 elif [[ "$1" == "bazel.asan" ]]; then bazel $BAZEL_STARTUP_OPTIONS test --config=asan $BAZEL_TEST_OPTIONS_ASYNC //... @@ -435,7 +430,6 @@ elif [[ "$1" == "code.coverage" ]]; then exit 0 elif [[ "$1" == "third_party.tags" ]]; then echo "gRPC=v1.49.2" > third_party_release - echo "thrift=0.14.1" >> third_party_release echo "abseil=20220623.1" >> third_party_release git submodule foreach --quiet 'echo "$name=$(git describe --tags HEAD)"' | sed 's:.*/::' >> third_party_release exit 0 diff --git a/ci/setup_thrift.ps1 b/ci/setup_thrift.ps1 deleted file mode 100644 index 52cd96708a..0000000000 --- a/ci/setup_thrift.ps1 +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -$ErrorActionPreference = "Stop" -trap { $host.SetShouldExit(1) } - -git submodule update -f "tools/vcpkg" -Push-Location -Path "tools/vcpkg" -$VCPKG_DIR = (Get-Item -Path ".\").FullName -setx VCPKG_DIR "$VCPKG_DIR" -./bootstrap-vcpkg.bat - -# boost needed for thrift -./vcpkg "--vcpkg-root=$VCPKG_DIR" install boost-predef[core]:x64-windows boost-locale[core]:x64-windows boost-numeric-conversion[core]:x64-windows boost-scope-exit[core]:x64-windows openssl:x64-windows - -Pop-Location diff --git a/ci/setup_thrift.sh b/ci/setup_thrift.sh deleted file mode 100755 index 1c8897089f..0000000000 --- a/ci/setup_thrift.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash - -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -set -e -export DEBIAN_FRONTEND=noninteractive -export THRIFT_VERSION=0.14.1 - -install_dir='/usr/local/' -while getopts ":i:" o; do - case "${o}" in - i) - install_dir=${OPTARG} - ;; - *) - ;; - esac -done - -apt update - -if ! type cmake > /dev/null; then - #cmake not installed, exiting - exit 1 -fi -export BUILD_DIR=/tmp/ -export INSTALL_DIR=${install_dir} - -apt install -y --no-install-recommends \ - libboost-locale-dev \ - libevent-dev \ - libssl-dev \ - ninja-build - -if [[ "$1" == "dependencies_only" ]]; then - exit 0; -fi - -pushd $BUILD_DIR -wget https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz -tar -zxvf v${THRIFT_VERSION}.tar.gz -cd thrift-${THRIFT_VERSION} -mkdir -p out -pushd out -cmake -G Ninja .. \ - -DBUILD_COMPILER=OFF \ - -DBUILD_CPP=ON \ - -DBUILD_LIBRARIES=ON \ - -DBUILD_NODEJS=OFF \ - -DBUILD_PYTHON=OFF \ - -DBUILD_JAVASCRIPT=OFF \ - -DBUILD_C_GLIB=OFF \ - -DBUILD_JAVA=OFF \ - -DBUILD_TESTING=OFF \ - -DBUILD_TUTORIALS=OFF \ - -DWITH_STDTHREADS=ON \ - -DWITH_BOOSTTHREADS=OFF \ - -DWITH_BOOST_FUNCTIONAL=OFF \ - -DWITH_BOOST_SMART_PTR=OFF \ - -DCMAKE_INSTALL_PREFIX=$INSTALL_DIR \ - -DCMAKE_PREFIX_PATH=$INSTALL_DIR \ - .. - -ninja -j $(nproc) -ninja install -popd -popd diff --git a/cmake/modules/FindThrift.cmake b/cmake/modules/FindThrift.cmake deleted file mode 100644 index 563e2c44d0..0000000000 --- a/cmake/modules/FindThrift.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -# This module defines Thrift_LIBRARIES, libraries to link Thrift_INCLUDE_DIR, -# Thrift_FOUND, If false, do not try to use it. - -# prefer the Thrift version supplied in Thrift_HOME (cmake -DThrift_HOME then -# environment) -find_path( - Thrift_INCLUDE_DIR - NAMES thrift/Thrift.h - HINTS ${Thrift_HOME} ENV Thrift_HOME /usr/local /opt/local - PATH_SUFFIXES include) - -# prefer the Thrift version supplied in Thrift_HOME -find_library( - Thrift_LIBRARIES - NAMES thrift libthrift - HINTS ${Thrift_HOME} ENV Thrift_HOME /usr/local /opt/local - PATH_SUFFIXES lib lib64) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Thrift DEFAULT_MSG Thrift_LIBRARIES - Thrift_INCLUDE_DIR) -mark_as_advanced(Thrift_LIBRARIES Thrift_INCLUDE_DIR) - - -if(Thrift_FOUND AND NOT (TARGET thrift::thrift)) - add_library(thrift::thrift UNKNOWN IMPORTED) - set_target_properties( - thrift::thrift - PROPERTIES IMPORTED_LOCATION ${Thrift_LIBRARIES} - INTERFACE_INCLUDE_DIRECTORIES ${Thrift_INCLUDE_DIR}) -endif() diff --git a/cmake/opentelemetry-cpp-config.cmake.in b/cmake/opentelemetry-cpp-config.cmake.in index adae58dd1b..38b3a91259 100644 --- a/cmake/opentelemetry-cpp-config.cmake.in +++ b/cmake/opentelemetry-cpp-config.cmake.in @@ -46,7 +46,6 @@ # opentelemetry-cpp::ostream_span_exporter - Imported target of opentelemetry-cpp::ostream_span_exporter # opentelemetry-cpp::elasticsearch_log_record_exporter - Imported target of opentelemetry-cpp::elasticsearch_log_record_exporter # opentelemetry-cpp::etw_exporter - Imported target of opentelemetry-cpp::etw_exporter -# opentelemetry-cpp::jaeger_trace_exporter - Imported target of opentelemetry-cpp::jaeger_trace_exporter # opentelemetry-cpp::zpages - Imported target of opentelemetry-cpp::zpages # opentelemetry-cpp::http_client_curl - Imported target of opentelemetry-cpp::http_client_curl # opentelemetry-cpp::opentracing_shim - Imported target of opentelemetry-cpp::opentracing_shim @@ -101,7 +100,6 @@ set(_OPENTELEMETRY_CPP_LIBRARIES_TEST_TARGETS prometheus_exporter elasticsearch_log_record_exporter etw_exporter - jaeger_trace_exporter zpages http_client_curl opentracing_shim) diff --git a/docker/Dockerfile b/docker/Dockerfile index 75360e6cbb..5fe143c4f7 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -3,10 +3,8 @@ ARG BASE_IMAGE=ubuntu:latest ARG GRPC_IMAGE=grpc-${BASE_IMAGE} -ARG THRIFT_IMAGE=thrift-${BASE_IMAGE} FROM ${GRPC_IMAGE} as grpc -FROM ${THRIFT_IMAGE} as thrift FROM base-${BASE_IMAGE}-dev AS otel-cpp @@ -14,7 +12,6 @@ ARG CORES=${nproc} ARG OTEL_GIT_TAG=v1.3.0 COPY --from=grpc / /usr/local -COPY --from=thrift / /usr/local #install opentelemetry-cpp RUN git clone --recurse-submodules -j ${CORES} --depth=1 \ @@ -25,7 +22,6 @@ RUN git clone --recurse-submodules -j ${CORES} --depth=1 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=ON \ -DCMAKE_INSTALL_PREFIX=/opt/third_party/install \ -DBUILD_TESTING=OFF \ -DWITH_OTLP_GRPC=ON \ diff --git a/docker/Dockerfile.alpine.base b/docker/Dockerfile.alpine.base index 0a92f26af5..d4f5932cc6 100644 --- a/docker/Dockerfile.alpine.base +++ b/docker/Dockerfile.alpine.base @@ -11,7 +11,7 @@ RUN apk update RUN apk add --update alpine-sdk \ && apk add cmake openssl openssl-dev g++ \ curl-dev git autoconf libtool linux-headers \ - boost-dev libevent-dev openssl-dev + libevent-dev openssl-dev RUN mkdir -p /opt/third_party/install diff --git a/docker/Dockerfile.centos b/docker/Dockerfile.centos index 25a6f2442f..c38b32b174 100644 --- a/docker/Dockerfile.centos +++ b/docker/Dockerfile.centos @@ -13,8 +13,6 @@ RUN yum install -y devtoolset-${TOOLSET_VER} \ && source /opt/rh/devtoolset-${TOOLSET_VER}/enable RUN echo "source /opt/rh/devtoolset-${TOOLSET_VER}/enable" >> /etc/bashrc -RUN echo "BOOST_LIBRARYDIR=/usr/lib64/boost169" >> /etc/bashrc -RUN echo "BOOST_INCLUDEDIR=/usr/include/boost169" >> /etc/bashrc ARG GRPC_VERSION=v1.43.2 @@ -36,49 +34,15 @@ RUN git clone --depth=1 -b $GRPC_VERSION https://github.com/grpc/grpc.git \ .. && \ make -j${nproc} install && make clean && ldconfig -# install thrift -ARG THRIFT_VERSION=0.14.1 -RUN yum install -y \ - boost169-devel \ - libevent-devel \ - wget \ - && wget https://github.com/apache/thrift/archive/refs/tags/v$THRIFT_VERSION.tar.gz \ - && tar -xvf v$THRIFT_VERSION.tar.gz \ - && mkdir -p thrift-$THRIFT_VERSION/build && cd thrift-$THRIFT_VERSION/build \ - && source /opt/rh/devtoolset-${TOOLSET_VER}/enable \ - && export BOOST_INCLUDEDIR=/usr/include/boost169 \ - && export BOOST_LIBRARYDIR=/usr/lib64/boost169 \ - && cmake3 \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_COMPILER=OFF \ - -DBUILD_CPP=ON \ - -DBUILD_LIBRARIES=ON \ - -DBUILD_NODEJS=OFF \ - -DBUILD_PYTHON=OFF \ - -DBUILD_JAVASCRIPT=OFF \ - -DBUILD_C_GLIB=OFF \ - -DBUILD_JAVA=OFF \ - -DBUILD_TESTING=OFF \ - -DBUILD_TUTORIALS=OFF \ - -DWITH_STDTHREADS=ON \ - -DWITH_BOOSTTHREADS=OFF \ - -DWITH_BOOST_FUNCTIONAL=OFF \ - -DWITH_BOOST_SMART_PTR=OFF \ - .. \ - && make -j${nproc} && make install && ldconfig - #install opentelemetry-cpp RUN git clone --depth=1 https://github.com/open-telemetry/opentelemetry-cpp.git \ && cd opentelemetry-cpp && git submodule update --init \ && mkdir -p build && cd build \ && source /opt/rh/devtoolset-${TOOLSET_VER}/enable \ - && export BOOST_INCLUDEDIR=/usr/include/boost169 \ - && export BOOST_LIBRARYDIR=/usr/lib64/boost169 \ && cmake3 \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=ON \ -DBUILD_TESTING=OFF \ -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ diff --git a/docker/Dockerfile.debian.deps b/docker/Dockerfile.debian.deps index 9ee7e9519b..3fe4fe28d9 100644 --- a/docker/Dockerfile.debian.deps +++ b/docker/Dockerfile.debian.deps @@ -22,18 +22,9 @@ ARG GRPC_VERSION=1.43.2 ADD setup_grpc.sh . RUN ./setup_grpc.sh -i "/opt/otel-cpp" -v ${GRPC_VERSION} -FROM base as thrift -RUN apt-get install -y --no-install-recommends wget - -# install thrift -ARG THRIFT_VERSION=0.14.1 -ADD setup_thrift.sh . -RUN ./setup_thrift.sh -i "/opt/otel-cpp" - FROM scratch as final COPY --from=grpc /opt/otel-cpp / -COPY --from=thrift /opt/otel-cpp / # how to use: # diff --git a/docker/README.md b/docker/README.md index 165667117c..8c7ca3ce34 100644 --- a/docker/README.md +++ b/docker/README.md @@ -17,8 +17,4 @@ docker rm -f otel docker create -ti --name grpc grpc- bash docker cp grpc:/ ./ docker rm -f grpc - -docker create -ti --name thrift thrift- bash -docker cp thrift:/ ./ -docker rm -f thrift ``` diff --git a/docker/build.sh b/docker/build.sh index 53773b739f..d418a909d0 100644 --- a/docker/build.sh +++ b/docker/build.sh @@ -18,7 +18,6 @@ Help() echo "o OpenTelemetry-cpp git tag" echo "h Print Help." echo "g gRPC git tag" - echo "t thrift version" echo "j Parallel jobs" echo echo "how to use:" @@ -34,11 +33,10 @@ Help() base_image=${base_image:="alpine"} grpc_git_tag=${grpc_git_tag:="v1.43.2"} -thrift_version=${thrift_version:="0.14.1"} otel_git_tag=${otel_git_tag:="v1.3.0"} cores=${cores:=1} -while getopts ":h:b:o:g:j:t:" option; do +while getopts ":h:b:o:g:j:" option; do case $option in h) # display Help Help @@ -52,9 +50,6 @@ while getopts ":h:b:o:g:j:t:" option; do g) # gRPC git tag grpc_git_tag=$OPTARG ;; - t) # thrfit version - thrift_version=$OPTARG - ;; j) # number of cores cores=$OPTARG ;; @@ -73,13 +68,6 @@ docker build --build-arg BASE_IMAGE=base-${base_image}-dev \ -t grpc-${base_image} -f Dockerfile . popd -pushd thrift/ -docker build --build-arg BASE_IMAGE=base-${base_image}-dev \ - --build-arg THRIFT_VERSION=${thrift_version} \ - --build-arg CORES=${cores} \ - -t thrift-${base_image} -f Dockerfile . -popd - docker build --build-arg BASE_IMAGE=${base_image} \ --build-arg CORES=${cores} \ --build-arg OTEL_GIT_TAG=${otel_git_tag} \ diff --git a/docker/thrift/CMakeLists.txt b/docker/thrift/CMakeLists.txt deleted file mode 100644 index aa94362986..0000000000 --- a/docker/thrift/CMakeLists.txt +++ /dev/null @@ -1,90 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -cmake_minimum_required(VERSION 3.11 FATAL_ERROR) - -project( - dependencies - LANGUAGES CXX - VERSION 0.0.1) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_EXTENSIONS OFF) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_FLAGS "-O2") - -set(CMAKE_BUILD_TYPE - Release - CACHE STRING "Build type" FORCE) - -include(GNUInstallDirs) - -set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_LIBRARY_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY - ${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) - -set(INSTALL_LIBDIR - ${CMAKE_INSTALL_LIBDIR} - CACHE PATH "directory for libraries") -set(INSTALL_BINDIR - ${CMAKE_INSTALL_BINDIR} - CACHE PATH "directory for executables") -set(INSTALL_INCLUDEDIR - ${CMAKE_INSTALL_INCLUDEDIR} - CACHE PATH "directory for header files") - -set(DEF_INSTALL_CMAKEDIR share/cmake/${PROJECT_NAME}) -set(INSTALL_CMAKEDIR - ${DEF_INSTALL_CMAKEDIR} - CACHE PATH "directory for CMake files") - -set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/subs) - -set(STAGED_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/stage) -message(STATUS "${PROJECT_NAME} staged install: ${STAGED_INSTALL_PREFIX}") - -find_package(OpenSSL REQUIRED) -message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") -message("OpenSSL libraries: ${OPENSSL_LIBRARIES}") - -set(THRIFT_VERSION - "0.14.1" - CACHE STRING "thrift version") - -include(ExternalProject) -ExternalProject_Add( - thrift - URL https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz - UPDATE_COMMAND "" - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX} - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} - -DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} - -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE - -DBUILD_COMPILER=OFF - -DBUILD_CPP=ON - -DBUILD_LIBRARIES=ON - -DBUILD_NODEJS=OFF - -DBUILD_PYTHON=OFF - -DBUILD_JAVASCRIPT=OFF - -DBUILD_C_GLIB=OFF - -DBUILD_JAVA=OFF - -DBUILD_TESTING=OFF - -DBUILD_TUTORIALS=OFF - -DWITH_STDTHREADS=ON - -DWITH_BOOSTTHREADS=OFF - -DWITH_BOOST_FUNCTIONAL=OFF - -DWITH_BOOST_SMART_PTR=OFF - CMAKE_CACHE_ARGS -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} - TEST_AFTER_INSTALL 0 - DOWNLOAD_NO_PROGRESS 1 - LOG_CONFIGURE 1 - LOG_BUILD 0 - LOG_INSTALL 1) - -install( - DIRECTORY ${STAGED_INSTALL_PREFIX}/ - DESTINATION . - USE_SOURCE_PERMISSIONS) diff --git a/docker/thrift/Dockerfile b/docker/thrift/Dockerfile deleted file mode 100644 index 60792e597b..0000000000 --- a/docker/thrift/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -ARG BASE_IMAGE=ubuntu:latest -FROM ${BASE_IMAGE} AS thrift - -ARG CORES=${nproc} -ARG THRIFT_VERSION=0.14.1 - -RUN mkdir mkdir -p /opt/third_party/thrift - -WORKDIR /opt/third_party/th - -ADD CMakeLists.txt /opt/third_party/thrift - -RUN mkdir build \ - && cd build \ - && cmake -DCMAKE_INSTALL_PREFIX=/opt/third_party/install \ - -DTHRIFT_VERSION=${THRIFT_VERSION} /opt/third_party/thrift \ - && cmake --build . -j ${CORES} --target install - -FROM scratch as final - -COPY --from=thrift /opt/third_party/install / diff --git a/docker/ubuntuLatest/Dockerfile b/docker/ubuntuLatest/Dockerfile index aec2296401..f2c69d0a49 100644 --- a/docker/ubuntuLatest/Dockerfile +++ b/docker/ubuntuLatest/Dockerfile @@ -24,31 +24,6 @@ RUN apt-get update && apt-get install -y build-essential autoconf libtool pkg-co make -j${nproc} install && make clean && ldconfig && \ cd ../.. -#install thrift -ARG THRIFT_VERSION=0.14.1 -RUN apt-get install -y --no-install-recommends \ - libboost-all-dev \ - libevent-dev \ - wget && \ - wget https://github.com/apache/thrift/archive/refs/tags/v$THRIFT_VERSION.tar.gz && \ - tar -xvf v$THRIFT_VERSION.tar.gz && \ - mkdir -p thrift-$THRIFT_VERSION/build && cd thrift-$THRIFT_VERSION/build && \ - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DBUILD_COMPILER=OFF \ - -DBUILD_CPP=ON \ - -DBUILD_LIBRARIES=ON \ - -DBUILD_NODEJS=OFF \ - -DBUILD_PYTHON=OFF \ - -DBUILD_JAVASCRIPT=OFF \ - -DBUILD_C_GLIB=OFF \ - -DBUILD_JAVA=OFF \ - -DBUILD_TESTING=OFF \ - -DBUILD_TUTORIALS=OFF \ - .. && \ - make -j${nproc} install && make clean && ldconfig && \ - cd ../.. - #install opentelemetry-cpp RUN apt-get install -y --no-install-recommends libcurl4-openssl-dev && git clone --depth=1 https://github.com/open-telemetry/opentelemetry-cpp.git && \ cd opentelemetry-cpp && git submodule update --init && \ @@ -57,7 +32,6 @@ RUN apt-get install -y --no-install-recommends libcurl4-openssl-dev && git clone -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ -DWITH_ZIPKIN=ON \ - -DWITH_JAEGER=ON \ -DBUILD_TESTING=OFF \ -DWITH_OTLP_GRPC=ON \ -DWITH_OTLP_HTTP=ON \ diff --git a/docs/dependencies.md b/docs/dependencies.md index 06c3806d34..62fbefc297 100644 --- a/docs/dependencies.md +++ b/docs/dependencies.md @@ -75,17 +75,6 @@ Both these dependencies are listed here: - `libcurl` for connecting with Zipkin server over HTTP protocol. - `nlohmann/json` for encoding Zipkin messages. -- [Jaeger](/exporters/jaeger) - exporter: - - [Thrift](https://github.com/apache/thrift) - Serialization and RPC - framework. - - `thrift` compiler to generate C++ stubs for IDL data model for Jaeger. - - `libthrift` library to generate serialized trace/metrics/log data to be - sent to remote Jaeger service. Note: libthrift **0.12.0** doesn't work - with this Jaeger exporter. See - [#1680](https://github.com/open-telemetry/opentelemetry-cpp/issues/1680). - - License: `Apache License 2.0` - - [ETW](/exporters/etw) exporter: - `nlohmann/json` for generating MessagePack serialization for message to be diff --git a/docs/public/sdk/GettingStarted.rst b/docs/public/sdk/GettingStarted.rst index 330507d7c1..d93e778d9f 100644 --- a/docs/public/sdk/GettingStarted.rst +++ b/docs/public/sdk/GettingStarted.rst @@ -13,7 +13,6 @@ An exporter is responsible for sending the telemetry data to a particular backen OpenTelemetry offers six tracing exporters out of the box: - In-Memory Exporter: keeps the data in memory, useful for debugging. -- Jaeger Exporter: prepares and sends the collected telemetry data to a Jaeger backend via UDP and HTTP. - Zipkin Exporter: prepares and sends the collected telemetry data to a Zipkin backend via the Zipkin APIs. - Logging Exporter: saves the telemetry data into log streams. - OpenTelemetry(otlp) Exporter: sends the data to the OpenTelemetry Collector using protobuf/gRPC or protobuf/HTTP. @@ -39,23 +38,6 @@ OpenTelemetry offers six tracing exporters out of the box: auto zipkin_exporter = std::unique_ptr(new opentelemetry::exporter::zipkin::ZipkinExporter(opts)); - // Jaeger UDP exporter - opentelemetry::exporter::jaeger::JaegerExporterOptions opts; - opts.endpoint = "localhost"; - opts.server_port = 6831; - auto jaeger_udp_exporter = - std::unique_ptr(new opentelemetry::exporter::jaeger::JaegerExporter(opts)); - - // Jaeger HTTP exporter - opentelemetry::exporter::jaeger::JaegerExporterOptions opts; - opts.transport_format = opentelemetry::exporter::jaeger::TransportFormat::kThriftHttp; - opts.endpoint = "localhost"; - opts.server_port = 14268; - opts.headers = {{}}; // optional headers - auto jaeger_http_exporter = - std::unique_ptr(new opentelemetry::exporter::jaeger::JaegerExporter(opts)); - - // otlp grpc exporter opentelemetry::exporter::otlp::OtlpGrpcExporterOptions opts; opts.endpoint = "localhost:4317"; diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 7ffec0fab4..fb64ed21c0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -12,9 +12,6 @@ endif() if(WITH_ETW) add_subdirectory(etw_threads) endif() -if(WITH_JAEGER) - add_subdirectory(jaeger) -endif() if(WITH_ZIPKIN) add_subdirectory(zipkin) endif() diff --git a/examples/jaeger/BUILD b/examples/jaeger/BUILD deleted file mode 100644 index e2f0ec7bce..0000000000 --- a/examples/jaeger/BUILD +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -cc_binary( - name = "example_jaeger", - srcs = [ - "main.cc", - ], - tags = ["jaeger"], - deps = [ - "//api", - "//examples/common/foo_library:common_foo_library", - "//exporters/jaeger:opentelemetry_exporter_jaeger_trace", - "//sdk/src/trace", - ], -) diff --git a/examples/jaeger/CMakeLists.txt b/examples/jaeger/CMakeLists.txt deleted file mode 100644 index 0c75ff4b6d..0000000000 --- a/examples/jaeger/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -include_directories(${CMAKE_SOURCE_DIR}/exporters/jaeger/include) - -add_executable(example_jaeger main.cc) -target_link_libraries( - example_jaeger ${CMAKE_THREAD_LIBS_INIT} common_foo_library - opentelemetry_trace opentelemetry_exporter_jaeger_trace) diff --git a/examples/jaeger/README.md b/examples/jaeger/README.md deleted file mode 100644 index 42ac4e125a..0000000000 --- a/examples/jaeger/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# Jaeger Exporter Example - -This is an example of how to use the Jaeger exporter. - -The application in `main.cc` initializes an `JaegerExporter` instance and uses it -to register a tracer provider from the [OpenTelemetry -SDK](https://github.com/open-telemetry/opentelemetry-cpp). The application then -calls a `foo_library` which has been instrumented using the [OpenTelemetry -API](https://github.com/open-telemetry/opentelemetry-cpp/tree/main/api). - -Resulting spans are exported to the Jaeger agent using the Jaeger exporter. - -Note that the Jaeger exporter connects to the agent at `localhost:6831` by -default. - -Once you have the Collector running, see -[CONTRIBUTING.md](../../CONTRIBUTING.md) for instructions on building and -running the example. diff --git a/examples/jaeger/main.cc b/examples/jaeger/main.cc deleted file mode 100644 index a5b3c38c35..0000000000 --- a/examples/jaeger/main.cc +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include "opentelemetry/exporters/jaeger/jaeger_exporter_factory.h" -#include "opentelemetry/sdk/trace/exporter.h" -#include "opentelemetry/sdk/trace/processor.h" -#include "opentelemetry/sdk/trace/simple_processor_factory.h" -#include "opentelemetry/sdk/trace/tracer_provider_factory.h" -#include "opentelemetry/trace/provider.h" - -#ifdef BAZEL_BUILD -# include "examples/common/foo_library/foo_library.h" -#else -# include "foo_library/foo_library.h" -#endif - -namespace trace = opentelemetry::trace; -namespace trace_sdk = opentelemetry::sdk::trace; -namespace jaeger = opentelemetry::exporter::jaeger; - -namespace -{ -opentelemetry::exporter::jaeger::JaegerExporterOptions opts; -void InitTracer() -{ - // Create Jaeger exporter instance - auto exporter = jaeger::JaegerExporterFactory::Create(opts); - auto processor = trace_sdk::SimpleSpanProcessorFactory::Create(std::move(exporter)); - std::shared_ptr provider = - trace_sdk::TracerProviderFactory::Create(std::move(processor)); - // Set the global trace provider - trace::Provider::SetTracerProvider(provider); -} - -void CleanupTracer() -{ - std::shared_ptr none; - trace::Provider::SetTracerProvider(none); -} -} // namespace - -int main(int argc, char *argv[]) -{ - if (argc == 2) - { - opts.endpoint = argv[1]; - } - // Removing this line will leave the default noop TracerProvider in place. - InitTracer(); - - foo_library(); - - CleanupTracer(); -} diff --git a/exporters/CMakeLists.txt b/exporters/CMakeLists.txt index d980fbd838..78f845aadf 100644 --- a/exporters/CMakeLists.txt +++ b/exporters/CMakeLists.txt @@ -23,7 +23,3 @@ endif() if(WITH_ETW) add_subdirectory(etw) endif() - -if(WITH_JAEGER) - add_subdirectory(jaeger) -endif() diff --git a/exporters/jaeger/BUILD b/exporters/jaeger/BUILD deleted file mode 100644 index 6f0e030b4d..0000000000 --- a/exporters/jaeger/BUILD +++ /dev/null @@ -1,226 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -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 = [ - "@platforms//os: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({ - "@platforms//os:osx": THRIFT_CACHE_ENTRIES, - "@platforms//os:linux": THRIFT_CACHE_ENTRIES, - "@platforms//os:windows": THRIFT_CACHE_ENTRIES_WIN, - }), - copts = [ - "-Ilibs/exporters/jaeger/openssl/include", - "-fexceptions", - ], - generate_args = select({ - "@platforms//os:osx": [], - "@platforms//os:linux": [], - "@platforms//os:windows": [ - "-G \"NMake Makefiles\"", - ], - }), - install = True, - lib_source = "@com_github_thrift//:all_srcs", - out_lib_dir = select({ - "@platforms//os:osx": "lib", - "@platforms//os:linux": "lib", - "@platforms//os:windows": "bin", - }), - out_static_libs = select({ - "@platforms//os:osx": [ - "libthrift.a", - "libthriftz.a", - ], - "@platforms//os:linux": [ - "libthrift.a", - "libthriftz.a", - ], - "@platforms//os: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({ - "@platforms//os:osx": THRIFT_GEN_DEPS, - "@platforms//os:linux": THRIFT_GEN_DEPS, - "@platforms//os: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/jaeger_exporter_factory.cc", - "src/recordable.cc", - "src/thrift_sender.cc", - "src/udp_transport.cc", - ], - hdrs = [ - "include/opentelemetry/exporters/jaeger/jaeger_exporter.h", - "include/opentelemetry/exporters/jaeger/jaeger_exporter_factory.h", - "include/opentelemetry/exporters/jaeger/jaeger_exporter_options.h", - "include/opentelemetry/exporters/jaeger/recordable.h", - "include/opentelemetry/exporters/jaeger/thrift_include_prefix.h", - "include/opentelemetry/exporters/jaeger/thrift_include_suffix.h", - ], - copts = ["-fexceptions"], - strip_include_prefix = "include", - tags = ["jaeger"], - deps = [ - ":jaeger_exporter", - "//sdk/src/common:global_log_handler", - "//sdk/src/trace", - ], -) - -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/exporters/jaeger/CMakeLists.txt b/exporters/jaeger/CMakeLists.txt deleted file mode 100644 index 222084eeb7..0000000000 --- a/exporters/jaeger/CMakeLists.txt +++ /dev/null @@ -1,111 +0,0 @@ -# Copyright The OpenTelemetry Authors -# SPDX-License-Identifier: Apache-2.0 - -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) - -if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - message("Relaxing GCC warnings on thrift-gen") - # THRIFT generated code is not warning clean for gcc. - set_source_files_properties( - ${JAEGER_THRIFT_GENCPP_SOURCES} PROPERTIES COMPILE_OPTIONS - "-Wno-suggest-override") -endif() - -set(JAEGER_EXPORTER_SOURCES - src/jaeger_exporter.cc - src/jaeger_exporter_factory.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) -set_target_version(opentelemetry_exporter_jaeger_trace) - -target_include_directories( - opentelemetry_exporter_jaeger_trace - PUBLIC "$" - "$") - -target_link_libraries( - opentelemetry_exporter_jaeger_trace - PUBLIC opentelemetry_resources opentelemetry_trace - 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() - -if(OPENTELEMETRY_INSTALL) - 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) -endif() - -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/exporters/jaeger/README.md b/exporters/jaeger/README.md deleted file mode 100644 index 2a795596a4..0000000000 --- a/exporters/jaeger/README.md +++ /dev/null @@ -1,67 +0,0 @@ -# Jaeger Exporter for OpenTelemetry C++ - -## DEPRECATED - -The Jaeger Exporter is deprecated, and will be removed in a future release. - -See [DEPRECATED](../../DEPRECATED.md) for details. - -## 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//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( - new opentelemetry::exporter::jaeger::JaegerExporter(options)); -auto processor = std::shared_ptr( - new sdktrace::SimpleSpanProcessor(std::move(exporter))); -auto provider = nostd::shared_ptr( - new sdktrace::TracerProvider(processor)); - -// Set the global trace provider -opentelemetry::trace::Provider::SetTracerProvider(provider); - -``` - -## Viewing your traces - -Please visit the Jaeger UI endpoint . diff --git a/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h b/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h deleted file mode 100644 index eac6dc6940..0000000000 --- a/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter.h +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE -# error "header is deprecated." -#endif - -#include -#include -#include -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ - -class ThriftSender; - -class OPENTELEMETRY_DEPRECATED 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 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> &spans) noexcept - override; - - /** - * Force flush the exporter. - * @param timeout an option timeout, default to max. - * @return return true when all data are exported, and false when timeout - */ - bool ForceFlush( - std::chrono::microseconds timeout = std::chrono::microseconds::max()) 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 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 sender); -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter_factory.h b/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter_factory.h deleted file mode 100644 index e8f4f75eb0..0000000000 --- a/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter_factory.h +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE -# error "header is deprecated." -#endif - -#include -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ - -/** - * Factory class for JaegerExporter. - */ -class OPENTELEMETRY_DEPRECATED JaegerExporterFactory -{ -public: - /** - * Create a JaegerExporter using all default options. - */ - static std::unique_ptr Create(); - - /** - * Create a JaegerExporter using the given options. - */ - static std::unique_ptr Create( - const JaegerExporterOptions &options); -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter_options.h b/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter_options.h deleted file mode 100644 index 8250f09aab..0000000000 --- a/exporters/jaeger/include/opentelemetry/exporters/jaeger/jaeger_exporter_options.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE -# error "header is deprecated." -#endif - -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ -enum class TransportFormat -{ - kThriftUdp, - kThriftUdpCompact, - kThriftHttp, - kProtobufGrpc, -}; - -/** - * Struct to hold Jaeger exporter options. - */ -struct OPENTELEMETRY_DEPRECATED 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; -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h b/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h deleted file mode 100644 index b1b944fd07..0000000000 --- a/exporters/jaeger/include/opentelemetry/exporters/jaeger/recordable.h +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -#include - -#include - -#include -#include - -#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 Tags() noexcept { return std::move(tags_); } - std::vector ResourceTags() noexcept { return std::move(resource_tags_); } - std::vector Logs() noexcept { return std::move(logs_); } - std::vector 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 SetInstrumentationScope(const opentelemetry::sdk::instrumentationscope::InstrumentationScope - &instrumentation_scope) noexcept override; - -private: - void AddTag(const std::string &key, const std::string &value, std::vector &tags); - void AddTag(const std::string &key, const char *value, std::vector &tags); - void AddTag(const std::string &key, bool value, std::vector &tags); - void AddTag(const std::string &key, int64_t value, std::vector &tags); - void AddTag(const std::string &key, double value, std::vector &tags); - - void PopulateAttribute(nostd::string_view key, - const opentelemetry::common::AttributeValue &value, - std::vector &tags); - - void PopulateAttribute(nostd::string_view key, - const sdk::common::OwnedAttributeValue &value, - std::vector &tags); - -private: - std::unique_ptr span_; - std::vector tags_; - std::vector resource_tags_; - std::vector logs_; - std::vector references_; - std::string service_name_; -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/include/opentelemetry/exporters/jaeger/thrift_include_prefix.h b/exporters/jaeger/include/opentelemetry/exporters/jaeger/thrift_include_prefix.h deleted file mode 100644 index 92754d4800..0000000000 --- a/exporters/jaeger/include/opentelemetry/exporters/jaeger/thrift_include_prefix.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// This file may be include multiple times, do not add #pragma once here - -#if defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__) -# if (__GNUC__ * 100 + __GNUC_MINOR__ * 10) >= 460 -# pragma GCC diagnostic push -# endif -# pragma GCC diagnostic ignored "-Wsuggest-override" -#endif diff --git a/exporters/jaeger/include/opentelemetry/exporters/jaeger/thrift_include_suffix.h b/exporters/jaeger/include/opentelemetry/exporters/jaeger/thrift_include_suffix.h deleted file mode 100644 index fc276705c3..0000000000 --- a/exporters/jaeger/include/opentelemetry/exporters/jaeger/thrift_include_suffix.h +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -// This file may be include multiple times, do not add #pragma once here - -#if defined(__GNUC__) && !defined(__clang__) && !defined(__apple_build_version__) -# if (__GNUC__ * 100 + __GNUC_MINOR__ * 10) >= 460 -# pragma GCC diagnostic pop -# endif -#endif diff --git a/exporters/jaeger/src/THttpTransport.cc b/exporters/jaeger/src/THttpTransport.cc deleted file mode 100644 index db2c8a0cd2..0000000000 --- a/exporters/jaeger/src/THttpTransport.cc +++ /dev/null @@ -1,61 +0,0 @@ -// 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->PostNoSsl(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/exporters/jaeger/src/THttpTransport.h b/exporters/jaeger/src/THttpTransport.h deleted file mode 100644 index 9c796e67a0..0000000000 --- a/exporters/jaeger/src/THttpTransport.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include -#include - -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ - -class THttpTransport : public apache::thrift::transport::TVirtualTransport -{ -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 client; - std::vector request_buffer; -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/TUDPTransport.cc b/exporters/jaeger/src/TUDPTransport.cc deleted file mode 100644 index e411127392..0000000000 --- a/exporters/jaeger/src/TUDPTransport.cc +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include // 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(buf), len, 0, server_addr_info_->ai_addr, - reinterpret_cast(&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(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/exporters/jaeger/src/TUDPTransport.h b/exporters/jaeger/src/TUDPTransport.h deleted file mode 100644 index df3151d110..0000000000 --- a/exporters/jaeger/src/TUDPTransport.h +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#ifdef _WIN32 -# include -#else -# include -# include -# include -# include -#endif - -#include -#include -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ - -class TUDPTransport : public apache::thrift::transport::TVirtualTransport -{ -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/exporters/jaeger/src/http_transport.cc b/exporters/jaeger/src/http_transport.cc deleted file mode 100644 index f804ccc843..0000000000 --- a/exporters/jaeger/src/http_transport.cc +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include "http_transport.h" - -#include - -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(std::move(endpoint), std::move(headers)); - protocol_ = std::shared_ptr(new TBinaryProtocol(endpoint_transport_)); -} - -int HttpTransport::EmitBatch(const thrift::Batch &batch) -{ - batch.write(protocol_.get()); - - if (!endpoint_transport_->sendSpans()) - { - return 0; - } - - return static_cast(batch.spans.size()); -} - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/http_transport.h b/exporters/jaeger/src/http_transport.h deleted file mode 100644 index 8748ae53a2..0000000000 --- a/exporters/jaeger/src/http_transport.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "THttpTransport.h" -#include "transport.h" - -#include -#include -#include -#include - -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 endpoint_transport_; - std::shared_ptr protocol_; -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/jaeger_exporter.cc b/exporters/jaeger/src/jaeger_exporter.cc deleted file mode 100644 index 7f413caf30..0000000000 --- a/exporters/jaeger/src/jaeger_exporter.cc +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include - -#include - -#include - -#include -#include -#include "opentelemetry/sdk_config.h" - -#include "http_transport.h" -#include "thrift_sender.h" -#include "udp_transport.h" - -#include -#include - -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 sender) - : options_(JaegerExporterOptions()), sender_(std::move(sender)) -{} - -std::unique_ptr JaegerExporter::MakeRecordable() noexcept -{ - return std::unique_ptr(new JaegerRecordable); -} - -sdk_common::ExportResult JaegerExporter::Export( - const nostd::span> &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(static_cast(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( - static_cast(new UDPTransport(options_.endpoint, options_.server_port))); - sender_ = std::unique_ptr(new ThriftSender(std::move(transport))); - return; - } - - if (options_.transport_format == TransportFormat::kThriftHttp) - { - auto transport = - std::unique_ptr(new HttpTransport(options_.endpoint, options_.headers)); - sender_ = std::unique_ptr(new ThriftSender(std::move(transport))); - return; - } - - // The transport format is not implemented. - assert(false); -} - -bool JaegerExporter::ForceFlush(std::chrono::microseconds /* timeout */) noexcept -{ - return true; -} - -bool JaegerExporter::Shutdown(std::chrono::microseconds /* timeout */) noexcept -{ - const std::lock_guard locked(lock_); - is_shutdown_ = true; - return true; -} - -bool JaegerExporter::isShutdown() const noexcept -{ - const std::lock_guard locked(lock_); - return is_shutdown_; -} - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/jaeger_exporter_factory.cc b/exporters/jaeger/src/jaeger_exporter_factory.cc deleted file mode 100644 index 5eae137cff..0000000000 --- a/exporters/jaeger/src/jaeger_exporter_factory.cc +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include -#include -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ - -std::unique_ptr JaegerExporterFactory::Create() -{ - JaegerExporterOptions options; - return Create(options); -} - -std::unique_ptr JaegerExporterFactory::Create( - const JaegerExporterOptions &options) -{ - std::unique_ptr exporter(new JaegerExporter(options)); - return exporter; -} - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/recordable.cc b/exporters/jaeger/src/recordable.cc deleted file mode 100644 index 1fd7e99dff..0000000000 --- a/exporters/jaeger/src/recordable.cc +++ /dev/null @@ -1,366 +0,0 @@ -// 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/resource.h" -#include "opentelemetry/sdk/resource/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 &tags) -{ - if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, int64_t{nostd::get(value)}, tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, int64_t{nostd::get(value)}, tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, nostd::get(value), tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, nostd::get(value), tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, nostd::get(value), tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, std::string{nostd::get(value)}, tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, std::string{nostd::get(value)}, tags); - } - else if (nostd::holds_alternative>(value)) - { - for (const auto &val : nostd::get>(value)) - { - AddTag(std::string{key}, val, tags); - } - } - else if (nostd::holds_alternative>(value)) - { - for (const auto &val : nostd::get>(value)) - { - AddTag(std::string{key}, int64_t{val}, tags); - } - } - else if (nostd::holds_alternative>(value)) - { - for (const auto &val : nostd::get>(value)) - { - AddTag(std::string{key}, val, tags); - } - } - else if (nostd::holds_alternative>(value)) - { - for (const auto &val : nostd::get>(value)) - { - AddTag(std::string{key}, int64_t{val}, tags); - } - } - else if (nostd::holds_alternative>(value)) - { - for (const auto &val : nostd::get>(value)) - { - AddTag(std::string{key}, val, tags); - } - } - else if (nostd::holds_alternative>(value)) - { - for (const auto &val : nostd::get>(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 &tags) -{ - if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, int64_t{nostd::get(value)}, tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, int64_t{nostd::get(value)}, tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, nostd::get(value), tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, nostd::get(value), tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, nostd::get(value), tags); - } - else if (nostd::holds_alternative(value)) - { - AddTag(std::string{key}, std::string{nostd::get(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(span_context.trace_id().Id().data())))); - span_->__set_traceIdLow( - otel_bswap_64(*(reinterpret_cast(span_context.trace_id().Id().data()) + 1))); - span_->__set_spanId( - otel_bswap_64(*(reinterpret_cast(span_context.span_id().Id().data())))); - span_->__set_parentSpanId( - otel_bswap_64(*(reinterpret_cast(parent_span_id.Id().data())))); -#else - span_->__set_traceIdLow( - *(reinterpret_cast(span_context.trace_id().Id().data()))); - span_->__set_traceIdHigh( - *(reinterpret_cast(span_context.trace_id().Id().data()) + 1)); - span_->__set_spanId(*(reinterpret_cast(span_context.span_id().Id().data()))); - span_->__set_parentSpanId(*(reinterpret_cast(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 tags; - PopulateAttribute("event", static_cast(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(timestamp.time_since_epoch()).count()); - logs_.push_back(log); -} - -void JaegerRecordable::SetInstrumentationScope( - const opentelemetry::sdk::instrumentationscope::InstrumentationScope - &instrumentation_scope) noexcept -{ - AddTag("otel.library.name", instrumentation_scope.GetName(), tags_); - AddTag("otel.library.version", instrumentation_scope.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(span_context.trace_id().Id().data())))); - reference.__set_traceIdLow( - otel_bswap_64(*(reinterpret_cast(span_context.trace_id().Id().data()) + 1))); - reference.__set_spanId( - otel_bswap_64(*(reinterpret_cast(span_context.span_id().Id().data())))); -#else - reference.__set_traceIdLow( - *(reinterpret_cast(span_context.trace_id().Id().data()))); - reference.__set_traceIdHigh( - *(reinterpret_cast(span_context.trace_id().Id().data()) + 1)); - reference.__set_spanId(*(reinterpret_cast(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(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(attribute_iter.second); - } - } -} - -void JaegerRecordable::SetStartTime(common::SystemTimestamp start_time) noexcept -{ - span_->__set_startTime( - std::chrono::duration_cast(start_time.time_since_epoch()).count()); -} - -void JaegerRecordable::SetDuration(std::chrono::nanoseconds duration) noexcept -{ - span_->__set_duration(std::chrono::duration_cast(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 &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 &tags) -{ - AddTag(key, std::string{value}, tags); -} - -void JaegerRecordable::AddTag(const std::string &key, bool value, std::vector &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 &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 &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/exporters/jaeger/src/sender.h b/exporters/jaeger/src/sender.h deleted file mode 100644 index f4827b5502..0000000000 --- a/exporters/jaeger/src/sender.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include -#include - -OPENTELEMETRY_BEGIN_NAMESPACE -namespace exporter -{ -namespace jaeger -{ - -using namespace jaegertracing; - -class Sender -{ -public: - Sender() = default; - virtual ~Sender() = default; - - virtual int Append(std::unique_ptr &&span) = 0; - - virtual int Flush() = 0; - - virtual void Close() = 0; -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/thrift_sender.cc b/exporters/jaeger/src/thrift_sender.cc deleted file mode 100644 index 46f0dcd5aa..0000000000 --- a/exporters/jaeger/src/thrift_sender.cc +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include "thrift_sender.h" -#include -#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_(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 &&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(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/exporters/jaeger/src/thrift_sender.h b/exporters/jaeger/src/thrift_sender.h deleted file mode 100644 index 687f6fac45..0000000000 --- a/exporters/jaeger/src/thrift_sender.h +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#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); - ~ThriftSender() override { Close(); } - - int Append(std::unique_ptr &&span) noexcept override; - int Flush() override; - void Close() override; - -private: - void ResetBuffers() - { - span_buffer_.clear(); - byte_buffer_size_ = process_bytes_size_; - } - - template - 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> spans_; - std::vector span_buffer_; - std::unique_ptr transport_; - std::unique_ptr protocol_factory_; - std::shared_ptr 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/exporters/jaeger/src/transport.h b/exporters/jaeger/src/transport.h deleted file mode 100644 index d7ba8fa604..0000000000 --- a/exporters/jaeger/src/transport.h +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include - -#include - -#include - -#include - -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/exporters/jaeger/src/udp_transport.cc b/exporters/jaeger/src/udp_transport.cc deleted file mode 100644 index 9b1fe0cafb..0000000000 --- a/exporters/jaeger/src/udp_transport.cc +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include // 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(new TUDPTransport(addr, port)); - endpoint_transport_->open(); - transport_ = - std::shared_ptr(new TBufferedTransport(endpoint_transport_, max_packet_size_)); - protocol_ = std::shared_ptr(new TCompactProtocol(transport_)); - agent_ = std::unique_ptr(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(batch.spans.size()); -} - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/src/udp_transport.h b/exporters/jaeger/src/udp_transport.h deleted file mode 100644 index ce1f51e647..0000000000 --- a/exporters/jaeger/src/udp_transport.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#pragma once - -#include "TUDPTransport.h" -#include "transport.h" - -#include - -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -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); - ~UDPTransport() override; - - int EmitBatch(const thrift::Batch &batch) override; - - uint32_t MaxPacketSize() const override { return max_packet_size_; } - - void InitSocket(); - void CleanSocket(); - -private: - std::unique_ptr agent_; - std::shared_ptr endpoint_transport_; - std::shared_ptr transport_; - std::shared_ptr protocol_; - uint32_t max_packet_size_; -}; - -} // namespace jaeger -} // namespace exporter -OPENTELEMETRY_END_NAMESPACE diff --git a/exporters/jaeger/test/jaeger_exporter_test.cc b/exporters/jaeger/test/jaeger_exporter_test.cc deleted file mode 100644 index ea305267c5..0000000000 --- a/exporters/jaeger/test/jaeger_exporter_test.cc +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include "opentelemetry/exporters/jaeger/jaeger_exporter.h" -#include "opentelemetry/sdk/trace/batch_span_processor.h" -#include "opentelemetry/sdk/trace/batch_span_processor_options.h" -#include "opentelemetry/sdk/trace/tracer.h" -#include "opentelemetry/sdk/trace/tracer_provider.h" -#include "opentelemetry/trace/span_startoptions.h" - -#ifdef BAZEL_BUILD -# include "exporters/jaeger/src/thrift_sender.h" -#else -# include "thrift_sender.h" -#endif - -#include -#include "gmock/gmock.h" - -#include -#include - -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 -static nostd::span MakeSpan(T (&array)[N]) -{ - return nostd::span(array); -} - -class JaegerExporterTestPeer : public ::testing::Test -{ -public: - std::unique_ptr GetExporter(std::unique_ptr sender) - { - return std::unique_ptr(new JaegerExporter(std::move(sender))); - } - - // Get the options associated with the given exporter. - const JaegerExporterOptions &GetOptions(std::unique_ptr &exporter) - { - return exporter->options_; - } -}; - -class MockThriftSender : public ThriftSender -{ -public: - MOCK_METHOD(int, Append, (std::unique_ptr &&), (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{mock_transport}); - auto exporter = GetExporter(std::unique_ptr{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(1); - resource_attributes["uint32_value"] = static_cast(2); - resource_attributes["int64_value"] = static_cast(0x1100000000LL); - resource_attributes["double_value"] = static_cast(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( - new sdk::trace::BatchSpanProcessor(std::move(exporter), processor_opts)); - auto provider = nostd::shared_ptr( - 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{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> 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> 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{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> 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> 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 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/exporters/jaeger/test/jaeger_recordable_test.cc b/exporters/jaeger/test/jaeger_recordable_test.cc deleted file mode 100644 index bcfbd35032..0000000000 --- a/exporters/jaeger/test/jaeger_recordable_test.cc +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -#include -#include "opentelemetry/exporters/jaeger/recordable.h" -#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.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 - -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::instrumentationscope; -using std::vector; - -using Attributes = std::initializer_list>; - -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(reinterpret_cast(trace_id_val), 16)}; - - const trace::SpanId span_id( - nostd::span(reinterpret_cast(&span_id_val), 8)); - - const trace::SpanId parent_span_id( - nostd::span(reinterpret_cast(&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 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 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(start_time.time_since_epoch()).count(); - rec.SetStartTime(start_timestamp); - - std::unique_ptr 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 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(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 attributes = { - {keys[0], values[0]}, {keys[1], values[1]}, {keys[2], values[2]}}; - - rec.AddEvent("Test Event", event_timestamp, - common::KeyValueIterableView>(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 -void addTag(thrift::TagType::type tag_type, - const std::string &key, - value_type value, - vector &tags) -{ - thrift::Tag tag; - - tag.__set_key(key); - tag.__set_vType(tag_type); - if (tag_type == thrift::TagType::LONG) - { - tag.__set_vLong(static_cast(value)); - } - else if (tag_type == thrift::TagType::DOUBLE) - { - tag.__set_vDouble(static_cast(value)); - } - else if (tag_type == thrift::TagType::BOOL) - { - tag.__set_vBool(static_cast(value)); - } - - tags.push_back(tag); -} - -void addTag(const std::string &key, std::string value, vector &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 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{{false, true}}); - rec.SetAttribute("key3", nostd::span{{-320, 320}}); - rec.SetAttribute("key4", nostd::span{{-640, 640}}); - rec.SetAttribute("key5", nostd::span{{320, 322}}); - rec.SetAttribute("key6", nostd::span{{4.15, 5.15}}); - rec.SetAttribute("key7", nostd::span{{"string_v1", "string_v2"}}); - - auto tags = rec.Tags(); - EXPECT_EQ(tags.size(), values.size() + 12); - - vector 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, SetInstrumentationScope) -{ - JaegerRecordable rec; - - std::string library_name = "opentelemetry-cpp"; - std::string library_version = "0.1.0"; - auto instrumentation_scope = InstrumentationScope::Create(library_name, library_version); - - rec.SetInstrumentationScope(*instrumentation_scope); - - 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(reinterpret_cast(trace_id_val), 16)}; - - const trace::SpanId span_id( - nostd::span(reinterpret_cast(&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({{"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/exporters/jaeger/thrift-gen/Agent.cpp b/exporters/jaeger/thrift-gen/Agent.cpp deleted file mode 100644 index 4ff0236501..0000000000 --- a/exporters/jaeger/thrift-gen/Agent.cpp +++ /dev/null @@ -1,380 +0,0 @@ -/** - * 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(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((*(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/exporters/jaeger/thrift-gen/Agent.h b/exporters/jaeger/thrift-gen/Agent.h deleted file mode 100644 index 49abaf54a9..0000000000 --- a/exporters/jaeger/thrift-gen/Agent.h +++ /dev/null @@ -1,309 +0,0 @@ -/** - * 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 -#include -#include -#include "agent_types.h" - -namespace jaegertracing { namespace agent { namespace thrift { - -#ifdef _MSC_VER - #pragma warning( push ) - #pragma warning (disable : 4250 ) //inheriting methods via dominance -#endif - -class AgentIf { - public: - virtual ~AgentIf() {} - virtual void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) = 0; - virtual void emitBatch(const ::jaegertracing::thrift::Batch& batch) = 0; -}; - -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& iface) : iface_(iface) {} - virtual ~AgentIfSingletonFactory() {} - - virtual AgentIf* getHandler(const ::apache::thrift::TConnectionInfo&) { - return iface_.get(); - } - virtual void releaseHandler(AgentIf* /* handler */) {} - - protected: - ::std::shared_ptr iface_; -}; - -class AgentNull : virtual public AgentIf { - public: - virtual ~AgentNull() {} - void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & /* spans */) { - return; - } - void emitBatch(const ::jaegertracing::thrift::Batch& /* batch */) { - return; - } -}; - -typedef struct _Agent_emitZipkinBatch_args__isset { - _Agent_emitZipkinBatch_args__isset() : spans(false) {} - bool spans :1; -} _Agent_emitZipkinBatch_args__isset; - -class Agent_emitZipkinBatch_args { - public: - - 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 iface_; - virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); - private: - typedef void (AgentProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); - typedef std::map ProcessMap; - ProcessMap processMap_; - void process_emitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - void process_emitBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - public: - AgentProcessor(::std::shared_ptr 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 >& ifaces) : ifaces_(ifaces) { - } - virtual ~AgentMultiface() {} - protected: - std::vector > ifaces_; - AgentMultiface() {} - void add(::std::shared_ptr iface) { - ifaces_.push_back(iface); - } - public: - void emitZipkinBatch(const std::vector< ::twitter::zipkin::thrift::Span> & spans) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->emitZipkinBatch(spans); - } - ifaces_[i]->emitZipkinBatch(spans); - } - - void emitBatch(const ::jaegertracing::thrift::Batch& batch) { - size_t sz = ifaces_.size(); - size_t i = 0; - 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/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp b/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp deleted file mode 100644 index 60fdd94360..0000000000 --- a/exporters/jaeger/thrift-gen/Agent_server.skeleton.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// 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 -#include -#include -#include - -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 handler(new AgentHandler()); - ::std::shared_ptr processor(new AgentProcessor(handler)); - ::std::shared_ptr serverTransport(new TServerSocket(port)); - ::std::shared_ptr transportFactory(new TBufferedTransportFactory()); - ::std::shared_ptr protocolFactory(new TBinaryProtocolFactory()); - - TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); - server.serve(); - return 0; -} - diff --git a/exporters/jaeger/thrift-gen/Collector.cpp b/exporters/jaeger/thrift-gen/Collector.cpp deleted file mode 100644 index f96b40f20a..0000000000 --- a/exporters/jaeger/thrift-gen/Collector.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/** - * 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(this->batches.size())); - std::vector ::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((*(this->batches)).size())); - std::vector ::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(this->success.size())); - std::vector ::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 & _return, const std::vector & batches) -{ - send_submitBatches(batches); - recv_submitBatches(_return); -} - -void CollectorClient::send_submitBatches(const std::vector & 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 & _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 & _return, const std::vector & batches) -{ - int32_t seqid = send_submitBatches(batches); - recv_submitBatches(_return, seqid); -} - -int32_t CollectorConcurrentClient::send_submitBatches(const std::vector & batches) -{ - int32_t cseqid = this->sync_->generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.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 & _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/exporters/jaeger/thrift-gen/Collector.h b/exporters/jaeger/thrift-gen/Collector.h deleted file mode 100644 index 75daa69a75..0000000000 --- a/exporters/jaeger/thrift-gen/Collector.h +++ /dev/null @@ -1,299 +0,0 @@ -/** - * 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 -#include -#include -#include "jaeger_types.h" - -namespace jaegertracing { namespace thrift { - -#ifdef _MSC_VER - #pragma warning( push ) - #pragma warning (disable : 4250 ) //inheriting methods via dominance -#endif - -class CollectorIf { - public: - virtual ~CollectorIf() {} - virtual void submitBatches(std::vector & _return, const std::vector & 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& iface) : iface_(iface) {} - virtual ~CollectorIfSingletonFactory() {} - - virtual CollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) { - return iface_.get(); - } - virtual void releaseHandler(CollectorIf* /* handler */) {} - - protected: - ::std::shared_ptr iface_; -}; - -class CollectorNull : virtual public CollectorIf { - public: - virtual ~CollectorNull() {} - void submitBatches(std::vector & /* _return */, const std::vector & /* 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 batches; - - _Collector_submitBatches_args__isset __isset; - - void __set_batches(const std::vector & 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 * 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 success; - - _Collector_submitBatches_result__isset __isset; - - void __set_success(const std::vector & 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 * 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 & _return, const std::vector & batches); - void send_submitBatches(const std::vector & batches); - void recv_submitBatches(std::vector & _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 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 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 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 >& ifaces) : ifaces_(ifaces) { - } - virtual ~CollectorMultiface() {} - protected: - std::vector > ifaces_; - CollectorMultiface() {} - void add(::std::shared_ptr iface) { - ifaces_.push_back(iface); - } - public: - void submitBatches(std::vector & _return, const std::vector & 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 & _return, const std::vector & batches); - int32_t send_submitBatches(const std::vector & batches); - void recv_submitBatches(std::vector & _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/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp b/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp deleted file mode 100644 index c59c8aa49a..0000000000 --- a/exporters/jaeger/thrift-gen/Collector_server.skeleton.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// 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 -#include -#include -#include - -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 & _return, const std::vector & batches) { - // Your implementation goes here - printf("submitBatches\n"); - } - -}; - -int main(int argc, char **argv) { - int port = 9090; - ::std::shared_ptr handler(new CollectorHandler()); - ::std::shared_ptr processor(new CollectorProcessor(handler)); - ::std::shared_ptr serverTransport(new TServerSocket(port)); - ::std::shared_ptr transportFactory(new TBufferedTransportFactory()); - ::std::shared_ptr protocolFactory(new TBinaryProtocolFactory()); - - TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); - server.serve(); - return 0; -} - diff --git a/exporters/jaeger/thrift-gen/ZipkinCollector.cpp b/exporters/jaeger/thrift-gen/ZipkinCollector.cpp deleted file mode 100644 index 42d813dfd4..0000000000 --- a/exporters/jaeger/thrift-gen/ZipkinCollector.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/** - * 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(this->spans.size())); - std::vector ::const_iterator _iter28; - for (_iter28 = this->spans.begin(); _iter28 != this->spans.end(); ++_iter28) - { - xfer += (*_iter28).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - 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((*(this->spans)).size())); - std::vector ::const_iterator _iter29; - for (_iter29 = (*(this->spans)).begin(); _iter29 != (*(this->spans)).end(); ++_iter29) - { - xfer += (*_iter29).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - 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(this->success.size())); - std::vector ::const_iterator _iter35; - for (_iter35 = this->success.begin(); _iter35 != this->success.end(); ++_iter35) - { - xfer += (*_iter35).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - return xfer; -} - - -ZipkinCollector_submitZipkinBatch_presult::~ZipkinCollector_submitZipkinBatch_presult() 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 & _return, const std::vector & spans) -{ - send_submitZipkinBatch(spans); - recv_submitZipkinBatch(_return); -} - -void ZipkinCollectorClient::send_submitZipkinBatch(const std::vector & spans) -{ - int32_t cseqid = 0; - oprot_->writeMessageBegin("submitZipkinBatch", ::apache::thrift::protocol::T_CALL, cseqid); - - ZipkinCollector_submitZipkinBatch_pargs args; - args.spans = &spans; - args.write(oprot_); - - oprot_->writeMessageEnd(); - oprot_->getTransport()->writeEnd(); - oprot_->getTransport()->flush(); -} - -void ZipkinCollectorClient::recv_submitZipkinBatch(std::vector & _return) -{ - - int32_t rseqid = 0; - std::string fname; - ::apache::thrift::protocol::TMessageType mtype; - - iprot_->readMessageBegin(fname, mtype, rseqid); - if (mtype == ::apache::thrift::protocol::T_EXCEPTION) { - ::apache::thrift::TApplicationException x; - x.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - throw x; - } - if (mtype != ::apache::thrift::protocol::T_REPLY) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - if (fname.compare("submitZipkinBatch") != 0) { - iprot_->skip(::apache::thrift::protocol::T_STRUCT); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - } - ZipkinCollector_submitZipkinBatch_presult result; - result.success = &_return; - result.read(iprot_); - iprot_->readMessageEnd(); - iprot_->getTransport()->readEnd(); - - if (result.__isset.success) { - // _return pointer has now been filled - return; - } - throw ::apache::thrift::TApplicationException(::apache::thrift::TApplicationException::MISSING_RESULT, "submitZipkinBatch failed: unknown result"); -} - -bool ZipkinCollectorProcessor::dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext) { - ProcessMap::iterator pfn; - pfn = processMap_.find(fname); - if (pfn == processMap_.end()) { - iprot->skip(::apache::thrift::protocol::T_STRUCT); - iprot->readMessageEnd(); - iprot->getTransport()->readEnd(); - ::apache::thrift::TApplicationException x(::apache::thrift::TApplicationException::UNKNOWN_METHOD, "Invalid method name: '"+fname+"'"); - oprot->writeMessageBegin(fname, ::apache::thrift::protocol::T_EXCEPTION, seqid); - x.write(oprot); - oprot->writeMessageEnd(); - oprot->getTransport()->writeEnd(); - oprot->getTransport()->flush(); - return true; - } - (this->*(pfn->second))(seqid, iprot, oprot, callContext); - return true; -} - -void ZipkinCollectorProcessor::process_submitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext) -{ - void* ctx = 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 & _return, const std::vector & spans) -{ - int32_t seqid = send_submitZipkinBatch(spans); - recv_submitZipkinBatch(_return, seqid); -} - -int32_t ZipkinCollectorConcurrentClient::send_submitZipkinBatch(const std::vector & spans) -{ - int32_t cseqid = this->sync_->generateSeqId(); - ::apache::thrift::async::TConcurrentSendSentry sentry(this->sync_.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 & _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/exporters/jaeger/thrift-gen/ZipkinCollector.h b/exporters/jaeger/thrift-gen/ZipkinCollector.h deleted file mode 100644 index 97e111d249..0000000000 --- a/exporters/jaeger/thrift-gen/ZipkinCollector.h +++ /dev/null @@ -1,299 +0,0 @@ -/** - * 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 -#include -#include -#include "zipkincore_types.h" - -namespace twitter { namespace zipkin { namespace thrift { - -#ifdef _MSC_VER - #pragma warning( push ) - #pragma warning (disable : 4250 ) //inheriting methods via dominance -#endif - -class ZipkinCollectorIf { - public: - virtual ~ZipkinCollectorIf() {} - virtual void submitZipkinBatch(std::vector & _return, const std::vector & spans) = 0; -}; - -class ZipkinCollectorIfFactory { - public: - typedef ZipkinCollectorIf Handler; - - virtual ~ZipkinCollectorIfFactory() {} - - virtual ZipkinCollectorIf* getHandler(const ::apache::thrift::TConnectionInfo& connInfo) = 0; - virtual void releaseHandler(ZipkinCollectorIf* /* handler */) = 0; -}; - -class ZipkinCollectorIfSingletonFactory : virtual public ZipkinCollectorIfFactory { - public: - ZipkinCollectorIfSingletonFactory(const ::std::shared_ptr& iface) : iface_(iface) {} - virtual ~ZipkinCollectorIfSingletonFactory() {} - - virtual ZipkinCollectorIf* getHandler(const ::apache::thrift::TConnectionInfo&) { - return iface_.get(); - } - virtual void releaseHandler(ZipkinCollectorIf* /* handler */) {} - - protected: - ::std::shared_ptr iface_; -}; - -class ZipkinCollectorNull : virtual public ZipkinCollectorIf { - public: - virtual ~ZipkinCollectorNull() {} - void submitZipkinBatch(std::vector & /* _return */, const std::vector & /* spans */) { - return; - } -}; - -typedef struct _ZipkinCollector_submitZipkinBatch_args__isset { - _ZipkinCollector_submitZipkinBatch_args__isset() : spans(false) {} - bool spans :1; -} _ZipkinCollector_submitZipkinBatch_args__isset; - -class ZipkinCollector_submitZipkinBatch_args { - public: - - 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 spans; - - _ZipkinCollector_submitZipkinBatch_args__isset __isset; - - void __set_spans(const std::vector & val); - - bool operator == (const ZipkinCollector_submitZipkinBatch_args & rhs) const - { - if (!(spans == rhs.spans)) - return false; - return true; - } - bool operator != (const ZipkinCollector_submitZipkinBatch_args &rhs) const { - return !(*this == rhs); - } - - bool operator < (const ZipkinCollector_submitZipkinBatch_args & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - - -class ZipkinCollector_submitZipkinBatch_pargs { - public: - - - virtual ~ZipkinCollector_submitZipkinBatch_pargs() noexcept; - const std::vector * 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 success; - - _ZipkinCollector_submitZipkinBatch_result__isset __isset; - - void __set_success(const std::vector & val); - - bool operator == (const ZipkinCollector_submitZipkinBatch_result & rhs) const - { - if (!(success == rhs.success)) - return false; - return true; - } - bool operator != (const ZipkinCollector_submitZipkinBatch_result &rhs) const { - return !(*this == rhs); - } - - bool operator < (const ZipkinCollector_submitZipkinBatch_result & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - -}; - -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 * 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 & _return, const std::vector & spans); - void send_submitZipkinBatch(const std::vector & spans); - void recv_submitZipkinBatch(std::vector & _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 iface_; - virtual bool dispatchCall(::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, void* callContext); - private: - typedef void (ZipkinCollectorProcessor::*ProcessFunction)(int32_t, ::apache::thrift::protocol::TProtocol*, ::apache::thrift::protocol::TProtocol*, void*); - typedef std::map ProcessMap; - ProcessMap processMap_; - void process_submitZipkinBatch(int32_t seqid, ::apache::thrift::protocol::TProtocol* iprot, ::apache::thrift::protocol::TProtocol* oprot, void* callContext); - public: - ZipkinCollectorProcessor(::std::shared_ptr 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 >& ifaces) : ifaces_(ifaces) { - } - virtual ~ZipkinCollectorMultiface() {} - protected: - std::vector > ifaces_; - ZipkinCollectorMultiface() {} - void add(::std::shared_ptr iface) { - ifaces_.push_back(iface); - } - public: - void submitZipkinBatch(std::vector & _return, const std::vector & spans) { - size_t sz = ifaces_.size(); - size_t i = 0; - for (; i < (sz - 1); ++i) { - ifaces_[i]->submitZipkinBatch(_return, spans); - } - ifaces_[i]->submitZipkinBatch(_return, spans); - return; - } - -}; - -// 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 & _return, const std::vector & spans); - int32_t send_submitZipkinBatch(const std::vector & spans); - void recv_submitZipkinBatch(std::vector & _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/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp b/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp deleted file mode 100644 index cca6ef752f..0000000000 --- a/exporters/jaeger/thrift-gen/ZipkinCollector_server.skeleton.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// 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 -#include -#include -#include - -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 & _return, const std::vector & spans) { - // Your implementation goes here - printf("submitZipkinBatch\n"); - } - -}; - -int main(int argc, char **argv) { - int port = 9090; - ::std::shared_ptr handler(new ZipkinCollectorHandler()); - ::std::shared_ptr processor(new ZipkinCollectorProcessor(handler)); - ::std::shared_ptr serverTransport(new TServerSocket(port)); - ::std::shared_ptr transportFactory(new TBufferedTransportFactory()); - ::std::shared_ptr protocolFactory(new TBinaryProtocolFactory()); - - TSimpleServer server(processor, serverTransport, transportFactory, protocolFactory); - server.serve(); - return 0; -} - diff --git a/exporters/jaeger/thrift-gen/agent_types.h b/exporters/jaeger/thrift-gen/agent_types.h deleted file mode 100644 index 0b576e34f5..0000000000 --- a/exporters/jaeger/thrift-gen/agent_types.h +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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 - -#include -#include -#include -#include -#include - -#include -#include -#include "jaeger_types.h" -#include "zipkincore_types.h" - - -namespace jaegertracing { namespace agent { namespace thrift { - -}}} // namespace - -#endif diff --git a/exporters/jaeger/thrift-gen/jaeger_types.cpp b/exporters/jaeger/thrift-gen/jaeger_types.cpp deleted file mode 100644 index 5e4140cc96..0000000000 --- a/exporters/jaeger/thrift-gen/jaeger_types.cpp +++ /dev/null @@ -1,1354 +0,0 @@ -/** - * 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 -#include - -#include - -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 _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::const_iterator it = _TagType_VALUES_TO_NAMES.find(val); - if (it != _TagType_VALUES_TO_NAMES.end()) { - out << it->second; - } else { - out << static_cast(val); - } - return out; -} - -std::string to_string(const TagType::type& val) { - std::map::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(val)); - } -} - -int _kSpanRefTypeValues[] = { - SpanRefType::CHILD_OF, - SpanRefType::FOLLOWS_FROM -}; -const char* _kSpanRefTypeNames[] = { - "CHILD_OF", - "FOLLOWS_FROM" -}; -const std::map _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::const_iterator it = _SpanRefType_VALUES_TO_NAMES.find(val); - if (it != _SpanRefType_VALUES_TO_NAMES.end()) { - out << it->second; - } else { - out << static_cast(val); - } - return out; -} - -std::string to_string(const SpanRefType::type& val) { - std::map::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(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 << "")); - out << ", " << "vDouble="; (__isset.vDouble ? (out << to_string(vDouble)) : (out << "")); - out << ", " << "vBool="; (__isset.vBool ? (out << to_string(vBool)) : (out << "")); - out << ", " << "vLong="; (__isset.vLong ? (out << to_string(vLong)) : (out << "")); - out << ", " << "vBinary="; (__isset.vBinary ? (out << to_string(vBinary)) : (out << "")); - out << ")"; -} - - -Log::~Log() noexcept { -} - - -void Log::__set_timestamp(const int64_t val) { - this->timestamp = val; -} - -void Log::__set_fields(const std::vector & val) { - this->fields = val; -} -std::ostream& operator<<(std::ostream& out, const Log& obj) -{ - obj.printTo(out); - return out; -} - - -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(this->fields.size())); - std::vector ::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 & 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 & val) { - this->tags = val; -__isset.tags = true; -} - -void Span::__set_logs(const std::vector & val) { - this->logs = val; -__isset.logs = true; -} -std::ostream& operator<<(std::ostream& out, const Span& obj) -{ - obj.printTo(out); - return out; -} - - -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(this->references.size())); - std::vector ::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(this->tags.size())); - std::vector ::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(this->logs.size())); - std::vector ::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 << "")); - out << ", " << "flags=" << to_string(flags); - out << ", " << "startTime=" << to_string(startTime); - out << ", " << "duration=" << to_string(duration); - out << ", " << "tags="; (__isset.tags ? (out << to_string(tags)) : (out << "")); - out << ", " << "logs="; (__isset.logs ? (out << to_string(logs)) : (out << "")); - out << ")"; -} - - -Process::~Process() noexcept { -} - - -void Process::__set_serviceName(const std::string& val) { - this->serviceName = val; -} - -void Process::__set_tags(const std::vector & val) { - this->tags = val; -__isset.tags = true; -} -std::ostream& operator<<(std::ostream& out, const Process& obj) -{ - obj.printTo(out); - return out; -} - - -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(this->tags.size())); - std::vector ::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 << "")); - out << ")"; -} - - -Batch::~Batch() noexcept { -} - - -void Batch::__set_process(const Process& val) { - this->process = val; -} - -void Batch::__set_spans(const std::vector & val) { - this->spans = val; -} -std::ostream& operator<<(std::ostream& out, const Batch& obj) -{ - obj.printTo(out); - return out; -} - - -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(this->spans.size())); - std::vector ::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/exporters/jaeger/thrift-gen/jaeger_types.h b/exporters/jaeger/thrift-gen/jaeger_types.h deleted file mode 100644 index b30a3740b3..0000000000 --- a/exporters/jaeger/thrift-gen/jaeger_types.h +++ /dev/null @@ -1,481 +0,0 @@ -/** - * 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 - -#include -#include -#include -#include -#include - -#include -#include - - -namespace jaegertracing { namespace thrift { - -struct TagType { - enum type { - STRING = 0, - DOUBLE = 1, - BOOL = 2, - LONG = 3, - BINARY = 4 - }; -}; - -extern const std::map _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 _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 fields; - - void __set_timestamp(const int64_t val); - - void __set_fields(const std::vector & 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 references; - int32_t flags; - int64_t startTime; - int64_t duration; - std::vector tags; - std::vector 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 & 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 & val); - - void __set_logs(const std::vector & 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 tags; - - _Process__isset __isset; - - void __set_serviceName(const std::string& val); - - void __set_tags(const std::vector & 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 spans; - - void __set_process(const Process& val); - - void __set_spans(const std::vector & 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/exporters/jaeger/thrift-gen/zipkincore_constants.cpp b/exporters/jaeger/thrift-gen/zipkincore_constants.cpp deleted file mode 100644 index 8dd451e483..0000000000 --- a/exporters/jaeger/thrift-gen/zipkincore_constants.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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/exporters/jaeger/thrift-gen/zipkincore_constants.h b/exporters/jaeger/thrift-gen/zipkincore_constants.h deleted file mode 100644 index 22b4b3b67c..0000000000 --- a/exporters/jaeger/thrift-gen/zipkincore_constants.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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/exporters/jaeger/thrift-gen/zipkincore_types.cpp b/exporters/jaeger/thrift-gen/zipkincore_types.cpp deleted file mode 100644 index a8b52e902d..0000000000 --- a/exporters/jaeger/thrift-gen/zipkincore_types.cpp +++ /dev/null @@ -1,913 +0,0 @@ -/** - * 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 -#include - -#include - -namespace twitter { namespace zipkin { namespace thrift { - -int _kAnnotationTypeValues[] = { - AnnotationType::BOOL, - AnnotationType::BYTES, - AnnotationType::I16, - AnnotationType::I32, - AnnotationType::I64, - AnnotationType::DOUBLE, - AnnotationType::STRING -}; -const char* _kAnnotationTypeNames[] = { - "BOOL", - "BYTES", - "I16", - "I32", - "I64", - "DOUBLE", - "STRING" -}; -const std::map _AnnotationType_VALUES_TO_NAMES(::apache::thrift::TEnumIterator(7, _kAnnotationTypeValues, _kAnnotationTypeNames), ::apache::thrift::TEnumIterator(-1, nullptr, nullptr)); - -std::ostream& operator<<(std::ostream& out, const AnnotationType::type& val) { - std::map::const_iterator it = _AnnotationType_VALUES_TO_NAMES.find(val); - if (it != _AnnotationType_VALUES_TO_NAMES.end()) { - out << it->second; - } else { - out << static_cast(val); - } - return out; -} - -std::string to_string(const AnnotationType::type& val) { - std::map::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(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 << "")); - 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 << "")); - 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 << "")); - 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 & val) { - this->annotations = val; -} - -void Span::__set_binary_annotations(const std::vector & val) { - this->binary_annotations = val; -} - -void Span::__set_debug(const bool val) { - this->debug = val; -__isset.debug = true; -} - -void Span::__set_timestamp(const int64_t val) { - this->timestamp = val; -__isset.timestamp = true; -} - -void Span::__set_duration(const int64_t val) { - this->duration = val; -__isset.duration = true; -} - -void Span::__set_trace_id_high(const int64_t val) { - this->trace_id_high = val; -__isset.trace_id_high = true; -} -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(this->annotations.size())); - std::vector ::const_iterator _iter17; - for (_iter17 = this->annotations.begin(); _iter17 != this->annotations.end(); ++_iter17) - { - xfer += (*_iter17).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - xfer += oprot->writeFieldBegin("binary_annotations", ::apache::thrift::protocol::T_LIST, 8); - { - xfer += oprot->writeListBegin(::apache::thrift::protocol::T_STRUCT, static_cast(this->binary_annotations.size())); - std::vector ::const_iterator _iter18; - for (_iter18 = this->binary_annotations.begin(); _iter18 != this->binary_annotations.end(); ++_iter18) - { - xfer += (*_iter18).write(oprot); - } - xfer += oprot->writeListEnd(); - } - xfer += oprot->writeFieldEnd(); - - if (this->__isset.debug) { - xfer += oprot->writeFieldBegin("debug", ::apache::thrift::protocol::T_BOOL, 9); - xfer += oprot->writeBool(this->debug); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.timestamp) { - xfer += oprot->writeFieldBegin("timestamp", ::apache::thrift::protocol::T_I64, 10); - xfer += oprot->writeI64(this->timestamp); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.duration) { - xfer += oprot->writeFieldBegin("duration", ::apache::thrift::protocol::T_I64, 11); - xfer += oprot->writeI64(this->duration); - xfer += oprot->writeFieldEnd(); - } - if (this->__isset.trace_id_high) { - xfer += oprot->writeFieldBegin("trace_id_high", ::apache::thrift::protocol::T_I64, 12); - xfer += oprot->writeI64(this->trace_id_high); - xfer += oprot->writeFieldEnd(); - } - xfer += oprot->writeFieldStop(); - xfer += oprot->writeStructEnd(); - 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 << "")); - out << ", " << "annotations=" << to_string(annotations); - out << ", " << "binary_annotations=" << to_string(binary_annotations); - out << ", " << "debug="; (__isset.debug ? (out << to_string(debug)) : (out << "")); - out << ", " << "timestamp="; (__isset.timestamp ? (out << to_string(timestamp)) : (out << "")); - out << ", " << "duration="; (__isset.duration ? (out << to_string(duration)) : (out << "")); - out << ", " << "trace_id_high="; (__isset.trace_id_high ? (out << to_string(trace_id_high)) : (out << "")); - out << ")"; -} - - -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/exporters/jaeger/thrift-gen/zipkincore_types.h b/exporters/jaeger/thrift-gen/zipkincore_types.h deleted file mode 100644 index c03421f434..0000000000 --- a/exporters/jaeger/thrift-gen/zipkincore_types.h +++ /dev/null @@ -1,493 +0,0 @@ -/** - * 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 - -#include -#include -#include -#include -#include - -#include -#include - - -namespace twitter { namespace zipkin { namespace thrift { - -struct AnnotationType { - enum type { - BOOL = 0, - BYTES = 1, - I16 = 2, - I32 = 3, - I64 = 4, - DOUBLE = 5, - STRING = 6 - }; -}; - -extern const std::map _AnnotationType_VALUES_TO_NAMES; - -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 annotations; - std::vector 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 & val); - - void __set_binary_annotations(const std::vector & val); - - void __set_debug(const bool val); - - void __set_timestamp(const int64_t val); - - void __set_duration(const int64_t val); - - void __set_trace_id_high(const int64_t val); - - bool operator == (const Span & rhs) const - { - if (!(trace_id == rhs.trace_id)) - return false; - if (!(name == rhs.name)) - return false; - if (!(id == rhs.id)) - return false; - if (__isset.parent_id != rhs.__isset.parent_id) - return false; - else if (__isset.parent_id && !(parent_id == rhs.parent_id)) - return false; - if (!(annotations == rhs.annotations)) - return false; - if (!(binary_annotations == rhs.binary_annotations)) - return false; - if (__isset.debug != rhs.__isset.debug) - return false; - else if (__isset.debug && !(debug == rhs.debug)) - return false; - if (__isset.timestamp != rhs.__isset.timestamp) - return false; - else if (__isset.timestamp && !(timestamp == rhs.timestamp)) - return false; - if (__isset.duration != rhs.__isset.duration) - return false; - else if (__isset.duration && !(duration == rhs.duration)) - return false; - if (__isset.trace_id_high != rhs.__isset.trace_id_high) - return false; - else if (__isset.trace_id_high && !(trace_id_high == rhs.trace_id_high)) - return false; - return true; - } - bool operator != (const Span &rhs) const { - return !(*this == rhs); - } - - bool operator < (const Span & ) const; - - uint32_t read(::apache::thrift::protocol::TProtocol* iprot); - uint32_t write(::apache::thrift::protocol::TProtocol* oprot) const; - - 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 diff --git a/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h b/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h index 8c66a251a4..2bf12b3a35 100644 --- a/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h +++ b/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h @@ -78,7 +78,7 @@ class ZipkinExporter final : public opentelemetry::sdk::trace::SpanExporter // For testing friend class ZipkinExporterTestPeer; /** - * Create an ZipkinExporter using the specified thrift sender. + * Create an ZipkinExporter using the specified http client. * Only tests can call this constructor directly. * @param http_client the http client to be used for exporting */ diff --git a/third_party/boost/LICENSE.md b/third_party/boost/LICENSE.md deleted file mode 100644 index 44da875b02..0000000000 --- a/third_party/boost/LICENSE.md +++ /dev/null @@ -1,23 +0,0 @@ -# Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff --git a/third_party_release b/third_party_release index 53ef723721..0864c60471 100644 --- a/third_party_release +++ b/third_party_release @@ -14,7 +14,6 @@ # gRPC=v1.49.2 -thrift=0.14.1 abseil=20220623.1 benchmark=v1.7.1 googletest=release-1.12.1 diff --git a/tools/format.sh b/tools/format.sh index 2c16204acb..5b4e91277d 100755 --- a/tools/format.sh +++ b/tools/format.sh @@ -10,7 +10,7 @@ fi set -e -FIND="find . -name third_party -prune -o -name tools -prune -o -name .git -prune -o -name _deps -prune -o -name .build -prune -o -name out -prune -o -name .vs -prune -o -name opentelemetry_logo.png -prune -o -name TraceLoggingDynamic.h -prune -o -name thrift-gen -prune -o" +FIND="find . -name third_party -prune -o -name tools -prune -o -name .git -prune -o -name _deps -prune -o -name .build -prune -o -name out -prune -o -name .vs -prune -o -name opentelemetry_logo.png -prune -o -name TraceLoggingDynamic.h -prune -o" # GNU syntax. SED=(sed -i)