Skip to content

Commit

Permalink
Merge branch 'main' into maxgolov/win32_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgolov authored Jun 14, 2021
2 parents 5406491 + fa2caa8 commit 65526a5
Show file tree
Hide file tree
Showing 27 changed files with 326 additions and 168 deletions.
4 changes: 4 additions & 0 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,7 @@ if(WITH_STL)
else()
message("Building with nostd types...")
endif()

if(CORE_RUNTIME_LIBS)
target_link_libraries(opentelemetry_api INTERFACE ${CORE_RUNTIME_LIBS})
endif()
3 changes: 3 additions & 0 deletions api/include/opentelemetry/nostd/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ OPENTELEMETRY_END_NAMESPACE
OPENTELEMETRY_BEGIN_NAMESPACE
namespace nostd
{
# ifdef HAVE_ABSEIL
using absl::bad_variant_access;
# endif
using absl::get;
using absl::get_if;
using absl::holds_alternative;
Expand Down
5 changes: 2 additions & 3 deletions api/test/baggage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ include(GoogleTest)

foreach(testname baggage_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX baggage.
Expand Down
5 changes: 2 additions & 3 deletions api/test/baggage/propagation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
foreach(testname baggage_propagator_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX baggage.
Expand Down
5 changes: 2 additions & 3 deletions api/test/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ include(GoogleTest)

foreach(testname kv_properties_test string_util_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX common.
Expand Down
5 changes: 2 additions & 3 deletions api/test/context/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ include(GoogleTest)

foreach(testname context_test runtime_context_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX context.
Expand Down
5 changes: 2 additions & 3 deletions api/test/context/propagation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
foreach(testname composite_propagator_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX trace.
Expand Down
5 changes: 2 additions & 3 deletions api/test/core/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
include(GoogleTest)

add_executable(timestamp_test timestamp_test.cc)
target_link_libraries(
timestamp_test ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(timestamp_test ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET timestamp_test
TEST_PREFIX trace.
Expand Down
5 changes: 2 additions & 3 deletions api/test/metrics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
foreach(testname noop_instrument_test meter_provider_test noop_metrics_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX metrics.
Expand Down
5 changes: 2 additions & 3 deletions api/test/nostd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ foreach(
shared_ptr_test
variant_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX nostd.
Expand Down
5 changes: 2 additions & 3 deletions api/test/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
include(GoogleTest)

add_executable(dynamic_load_test dynamic_load_test.cc)
target_link_libraries(
dynamic_load_test ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(dynamic_load_test ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(dynamic_load_test ${CMAKE_DL_LIBS})
gtest_add_tests(
TARGET dynamic_load_test
Expand Down
5 changes: 2 additions & 3 deletions api/test/trace/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,8 @@ foreach(
trace_state_test
tracer_test)
add_executable(api_${testname} "${testname}.cc")
target_link_libraries(
api_${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(api_${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET api_${testname}
TEST_PREFIX trace.
Expand Down
5 changes: 2 additions & 3 deletions api/test/trace/propagation/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
foreach(testname http_text_format_test b3_propagation_test
jaeger_propagation_test)
add_executable(${testname} "${testname}.cc")
target_link_libraries(
${testname} ${GTEST_BOTH_LIBRARIES} ${CORE_RUNTIME_LIBS}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
target_link_libraries(${testname} ${GTEST_BOTH_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT} opentelemetry_api)
gtest_add_tests(
TARGET ${testname}
TEST_PREFIX trace.
Expand Down
5 changes: 2 additions & 3 deletions examples/batch/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include)

add_executable(batch_span_processor_example main.cc)

target_link_libraries(
batch_span_processor_example ${CMAKE_THREAD_LIBS_INIT} ${CORE_RUNTIME_LIBS}
opentelemetry_exporter_ostream_span opentelemetry_trace)
target_link_libraries(batch_span_processor_example ${CMAKE_THREAD_LIBS_INIT}
opentelemetry_exporter_ostream_span opentelemetry_trace)
13 changes: 4 additions & 9 deletions examples/http/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,10 @@ else()
add_executable(http_server server.cc)

target_link_libraries(
http_client
${CMAKE_THREAD_LIBS_INIT}
${CORE_RUNTIME_LIBS}
opentelemetry_trace
http_client_curl
opentelemetry_exporter_ostream_span
${CURL_LIBRARIES})
http_client ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace http_client_curl
opentelemetry_exporter_ostream_span ${CURL_LIBRARIES})

target_link_libraries(
http_server ${CMAKE_THREAD_LIBS_INIT} ${CORE_RUNTIME_LIBS}
opentelemetry_trace http_client_curl opentelemetry_exporter_ostream_span)
http_server ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace http_client_curl
opentelemetry_exporter_ostream_span)
endif()
4 changes: 2 additions & 2 deletions examples/jaeger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/jaeger/include)

add_library(jaeger_foo_library foo_library/foo_library.cc)
target_link_libraries(jaeger_foo_library ${CMAKE_THREAD_LIBS_INIT}
${CORE_RUNTIME_LIBS} opentelemetry_api)
opentelemetry_api)

add_executable(example_jaeger main.cc)
target_link_libraries(
example_jaeger ${CMAKE_THREAD_LIBS_INIT} jaeger_foo_library
opentelemetry_trace ${CORE_RUNTIME_LIBS} jaeger_trace_exporter)
opentelemetry_trace jaeger_trace_exporter)
2 changes: 1 addition & 1 deletion examples/metrics_simple/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/ostream/include)
add_executable(simple_metrics main.cc)
target_link_libraries(
simple_metrics ${CMAKE_THREAD_LIBS_INIT} opentelemetry_metrics
${CORE_RUNTIME_LIBS} opentelemetry_exporter_ostream_metrics)
opentelemetry_exporter_ostream_metrics)
13 changes: 4 additions & 9 deletions examples/otlp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,18 @@ include_directories(${CMAKE_SOURCE_DIR}/exporters/otlp/include)

add_library(otlp_foo_library foo_library/foo_library.cc)
target_link_libraries(otlp_foo_library ${CMAKE_THREAD_LIBS_INIT}
${CORE_RUNTIME_LIBS} opentelemetry_api)
opentelemetry_api)

if(WITH_OTLP_GRPC)
add_executable(example_otlp_grpc grpc_main.cc)
target_link_libraries(
example_otlp_grpc
${CMAKE_THREAD_LIBS_INIT}
otlp_foo_library
opentelemetry_trace
${CORE_RUNTIME_LIBS}
opentelemetry_exporter_otlp_grpc
gRPC::grpc++)
example_otlp_grpc ${CMAKE_THREAD_LIBS_INIT} otlp_foo_library
opentelemetry_trace opentelemetry_exporter_otlp_grpc gRPC::grpc++)
endif()

if(WITH_OTLP_HTTP)
add_executable(example_otlp_http http_main.cc)
target_link_libraries(
example_otlp_http ${CMAKE_THREAD_LIBS_INIT} otlp_foo_library
opentelemetry_trace ${CORE_RUNTIME_LIBS} opentelemetry_exporter_otlp_http)
opentelemetry_trace opentelemetry_exporter_otlp_http)
endif()
2 changes: 1 addition & 1 deletion examples/plugin/load/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
add_executable(load_plugin_example main.cc)
target_link_libraries(load_plugin_example ${CMAKE_DL_LIBS})
target_link_libraries(load_plugin_example opentelemetry_api ${CMAKE_DL_LIBS})
1 change: 1 addition & 0 deletions examples/plugin/plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
add_library(example_plugin SHARED tracer.cc factory_impl.cc)
target_link_libraries(example_plugin opentelemetry_api)
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
// We need include exporter.h first, which will include Windows.h with NOMINMAX on Windows
#include "opentelemetry/sdk/trace/exporter.h"

#include "opentelemetry/ext/http/client/http_client.h"

#include <chrono>
#include <memory>
#include <mutex>
#include <string>
Expand Down Expand Up @@ -65,6 +68,7 @@ struct OtlpHttpExporterOptions

// TODO: Enable/disable to verify SSL certificate
// TODO: Reuqest timeout
std::chrono::milliseconds timeout = std::chrono::milliseconds(30000);
};

/**
Expand Down Expand Up @@ -113,6 +117,11 @@ class OtlpHttpExporter final : public opentelemetry::sdk::trace::SpanExporter

// The configuration options associated with this exporter.
const OtlpHttpExporterOptions options_;

// Object that stores the HTTP sessions that have been created
std::shared_ptr<ext::http::client::HttpClient> http_client_;
// Cached parsed URI
std::string http_uri_;
};
} // namespace otlp
} // namespace exporter
Expand Down
Loading

0 comments on commit 65526a5

Please sign in to comment.