diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h index f698b8fb5d..8c2b6d791a 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h @@ -6,21 +6,16 @@ #include #include -// clang-format off -#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -// clang-format on - -#include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" - -// clang-format off -#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" -// clang-format on - +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" #include "opentelemetry/nostd/shared_ptr.h" #include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/version.h" -#include "opentelemetry/exporters/otlp/otlp_environment.h" -#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep +#include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep +// clang-format on OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -28,9 +23,8 @@ namespace exporter namespace otlp { -class OtlpGrpcClientReferenceGuard; - -class OtlpGrpcClient; +class OtlpGrpcClientReferenceGuard; // IWYU pragma: keep +class OtlpGrpcClient; // IWYU pragma: keep /** * The OTLP exporter exports span data in OpenTelemetry Protocol (OTLP) format. diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h index 4272bf2126..c49ab713b9 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h @@ -3,22 +3,22 @@ #pragma once -// clang-format off -#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" -// clang-format on - -#include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h" - -// clang-format off -#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" -// clang-format on +#include +#include -#include "opentelemetry/exporters/otlp/otlp_environment.h" #include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" #include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/metrics/instruments.h" #include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/version.h" -#include +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep +#include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep +// clang-format on + +// IWYU pragma: no_include "opentelemetry/exporters/otlp/otlp_grpc_client.h" OPENTELEMETRY_BEGIN_NAMESPACE namespace exporter @@ -26,8 +26,8 @@ namespace exporter namespace otlp { -class OtlpGrpcClientReferenceGuard; -class OtlpGrpcClient; +class OtlpGrpcClientReferenceGuard; // IWYU pragma: keep +class OtlpGrpcClient; // IWYU pragma: keep /** * The OTLP exporter exports metrics data in OpenTelemetry Protocol (OTLP) format in gRPC. diff --git a/exporters/otlp/src/otlp_grpc_exporter_factory.cc b/exporters/otlp/src/otlp_grpc_exporter_factory.cc index 3615e099c9..6ef5c21404 100644 --- a/exporters/otlp/src/otlp_grpc_exporter_factory.cc +++ b/exporters/otlp/src/otlp_grpc_exporter_factory.cc @@ -8,6 +8,7 @@ #include +#include "opentelemetry/exporters/otlp/otlp_grpc_client.h" #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" #include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" #include "opentelemetry/sdk/trace/exporter.h" diff --git a/exporters/otlp/test/otlp_grpc_exporter_test.cc b/exporters/otlp/test/otlp_grpc_exporter_test.cc index 239f788c49..3299ff9110 100644 --- a/exporters/otlp/test/otlp_grpc_exporter_test.cc +++ b/exporters/otlp/test/otlp_grpc_exporter_test.cc @@ -1,54 +1,65 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION -// Unfortunately as of 04/27/2021 the fix is NOT in the vcpkg snapshot of Google Test. -// Remove above `#ifdef` once the GMock fix for C++20 is in the mainline. -// -// Please refer to this GitHub issue for additional details: -// https://github.com/google/googletest/issues/2914 -// https://github.com/google/googletest/commit/61f010d703b32de9bfb20ab90ece38ab2f25977f -// -// If we compile using Visual Studio 2019 with `c++latest` (C++20) without the GMock fix, -// then the compilation here fails in `gmock-actions.h` from: -// .\tools\vcpkg\installed\x64-windows\include\gmock\gmock-actions.h(819): -// error C2653: 'result_of': is not a class or namespace name -// -// That is because `std::result_of` has been removed in C++20. - -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" - -// Problematic code that pulls in Gmock and breaks with vs2019/c++latest : -# include "opentelemetry/proto/collector/trace/v1/trace_service_mock.grpc.pb.h" - -# include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gmock/gmock.h" + +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_exporter_options.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/proto/collector/trace/v1/trace_service.pb.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/recordable.h" +#include "opentelemetry/sdk/trace/simple_processor.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/tracer.h" +#include "opentelemetry/trace/tracer_provider.h" +#include "opentelemetry/version.h" + +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep +#include "opentelemetry/proto/collector/trace/v1/trace_service_mock.grpc.pb.h" +#include "opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep +// clang-format on + +// IWYU pragma: no_include +// IWYU pragma: no_include + +#ifdef ENABLE_OTLP_RETRY_PREVIEW +# include +# include +# include +# include +# include -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" +// IWYU pragma: no_include -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/trace/simple_processor.h" +# include "opentelemetry/exporters/otlp/otlp_grpc_exporter_factory.h" # include "opentelemetry/sdk/trace/simple_processor_factory.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" # include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" -# include "opentelemetry/trace/provider.h" -# include "opentelemetry/trace/tracer_provider.h" - -# include -# include -# include -# include -# include -# include +#endif -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +#endif using namespace testing; @@ -64,14 +75,14 @@ class OtlpMockTraceServiceStub : public proto::collector::trace::v1::MockTraceSe { public: // Some old toolchains can only use gRPC 1.33 and it's experimental. -# if defined(GRPC_CPP_VERSION_MAJOR) && \ - (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 +#if defined(GRPC_CPP_VERSION_MAJOR) && \ + (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 using async_interface_base = proto::collector::trace::v1::TraceService::StubInterface::async_interface; -# else +#else using async_interface_base = proto::collector::trace::v1::TraceService::StubInterface::experimental_async_interface; -# endif +#endif OtlpMockTraceServiceStub() : async_interface_(this) {} @@ -91,23 +102,23 @@ class OtlpMockTraceServiceStub : public proto::collector::trace::v1::MockTraceSe } // Some old toolchains can only use gRPC 1.33 and it's experimental. -# if defined(GRPC_CPP_VERSION_MAJOR) && \ - (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 || \ - defined(GRPC_CALLBACK_API_NONEXPERIMENTAL) +#if defined(GRPC_CPP_VERSION_MAJOR) && \ + (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 || \ + defined(GRPC_CALLBACK_API_NONEXPERIMENTAL) void Export( ::grpc::ClientContext * /*context*/, const ::opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest * /*request*/, ::opentelemetry::proto::collector::trace::v1::ExportTraceServiceResponse * /*response*/, ::grpc::ClientUnaryReactor * /*reactor*/) override {} -# else +#else void Export( ::grpc::ClientContext * /*context*/, const ::opentelemetry::proto::collector::trace::v1::ExportTraceServiceRequest * /*request*/, ::opentelemetry::proto::collector::trace::v1::ExportTraceServiceResponse * /*response*/, ::grpc::experimental::ClientUnaryReactor * /*reactor*/) {} -# endif +#endif private: OtlpMockTraceServiceStub *stub_; @@ -195,12 +206,12 @@ TEST_F(OtlpGrpcExporterTestPeer, ExportUnitTest) .WillOnce(Return(grpc::Status::CANCELLED)); result = exporter->Export(batch_2); exporter->ForceFlush(); -# if defined(ENABLE_ASYNC_EXPORT) +#if defined(ENABLE_ASYNC_EXPORT) EXPECT_EQ(sdk::common::ExportResult::kSuccess, result); EXPECT_FALSE(mock_stub->GetLastAsyncStatus().ok()); -# else +#else EXPECT_EQ(sdk::common::ExportResult::kFailure, result); -# endif +#endif } // Exporter logs the rejection on partial_success. @@ -290,7 +301,7 @@ TEST_F(OtlpGrpcExporterTestPeer, ConfigSslCredentialsTest) EXPECT_EQ(GetOptions(exporter).use_ssl_credentials, true); } -# ifndef NO_GETENV +#ifndef NO_GETENV // Test exporter configuration options with use_ssl_credentials TEST_F(OtlpGrpcExporterTestPeer, ConfigFromEnv) { @@ -450,9 +461,9 @@ TEST_F(OtlpGrpcExporterTestPeer, ConfigRetryGenericValuesFromEnv) unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_MAX_BACKOFF"); unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_BACKOFF_MULTIPLIER"); } -# endif // NO_GETENV +#endif // NO_GETENV -# ifdef ENABLE_OTLP_RETRY_PREVIEW +#ifdef ENABLE_OTLP_RETRY_PREVIEW namespace { struct TestTraceService : public opentelemetry::proto::collector::trace::v1::TraceService::Service @@ -612,9 +623,8 @@ TEST_P(OtlpGrpcExporterRetryIntegrationTests, StatusCodes) ASSERT_EQ(expected_attempts, service.request_count_); } -# endif // ENABLE_OTLP_RETRY_PREVIEW +#endif // ENABLE_OTLP_RETRY_PREVIEW } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif /* OPENTELEMETRY_STL_VERSION */ diff --git a/exporters/otlp/test/otlp_grpc_metric_exporter_test.cc b/exporters/otlp/test/otlp_grpc_metric_exporter_test.cc index e752a24b7e..401ab13230 100644 --- a/exporters/otlp/test/otlp_grpc_metric_exporter_test.cc +++ b/exporters/otlp/test/otlp_grpc_metric_exporter_test.cc @@ -1,59 +1,53 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION -// Unfortunately as of 04/27/2021 the fix is NOT in the vcpkg snapshot of Google Test. -// Remove above `#ifdef` once the GMock fix for C++20 is in the mainline. -// -// Please refer to this GitHub issue for additional details: -// https://github.com/google/googletest/issues/2914 -// https://github.com/google/googletest/commit/61f010d703b32de9bfb20ab90ece38ab2f25977f -// -// If we compile using Visual Studio 2019 with `c++latest` (C++20) without the GMock fix, -// then the compilation here fails in `gmock-actions.h` from: -// .\tools\vcpkg\installed\x64-windows\include\gmock\gmock-actions.h(819): -// error C2653: 'result_of': is not a class or namespace name -// -// That is because `std::result_of` has been removed in C++20. - -# include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" - -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" - -// Problematic code that pulls in Gmock and breaks with vs2019/c++latest : -# include "opentelemetry/proto/collector/metrics/v1/metrics_service_mock.grpc.pb.h" - -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" - -# include "opentelemetry/exporters/otlp/otlp_grpc_client.h" -# include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" - -# include "opentelemetry/common/timestamp.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" -# include "opentelemetry/sdk/metrics/data/metric_data.h" -# include "opentelemetry/sdk/metrics/data/point_data.h" -# include "opentelemetry/sdk/metrics/export/metric_producer.h" -# include "opentelemetry/sdk/metrics/instruments.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/sdk/trace/simple_processor.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" -# include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" -# include "opentelemetry/trace/provider.h" - -# include -# include -# include -# include -# include -# include - -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gmock/gmock.h" + +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_client_factory.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_grpc_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_preferred_temporality.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/instrumentationscope/instrumentation_scope.h" +#include "opentelemetry/sdk/metrics/data/metric_data.h" +#include "opentelemetry/sdk/metrics/data/point_data.h" +#include "opentelemetry/sdk/metrics/export/metric_producer.h" +#include "opentelemetry/sdk/metrics/instruments.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" +#include "opentelemetry/version.h" + +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep +#include "opentelemetry/proto/collector/metrics/v1/metrics_service_mock.grpc.pb.h" +#include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h" +#include "opentelemetry/proto/collector/metrics/v1/metrics_service.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep +// clang-format on + +// IWYU pragma: no_include +// IWYU pragma: no_include + +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +#endif using namespace testing; @@ -69,14 +63,14 @@ class OtlpMockMetricsServiceStub : public proto::collector::metrics::v1::MockMet { public: // Some old toolchains can only use gRPC 1.33 and it's experimental. -# if defined(GRPC_CPP_VERSION_MAJOR) && \ - (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 +#if defined(GRPC_CPP_VERSION_MAJOR) && \ + (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 using async_interface_base = proto::collector::metrics::v1::MetricsService::StubInterface::async_interface; -# else +#else using async_interface_base = proto::collector::metrics::v1::MetricsService::StubInterface::experimental_async_interface; -# endif +#endif OtlpMockMetricsServiceStub() : async_interface_(this) {} @@ -96,9 +90,9 @@ class OtlpMockMetricsServiceStub : public proto::collector::metrics::v1::MockMet } // Some old toolchains can only use gRPC 1.33 and it's experimental. -# if defined(GRPC_CPP_VERSION_MAJOR) && \ - (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 || \ - defined(GRPC_CALLBACK_API_NONEXPERIMENTAL) +#if defined(GRPC_CPP_VERSION_MAJOR) && \ + (GRPC_CPP_VERSION_MAJOR * 1000 + GRPC_CPP_VERSION_MINOR) >= 1039 || \ + defined(GRPC_CALLBACK_API_NONEXPERIMENTAL) void Export( ::grpc::ClientContext * /*context*/, const ::opentelemetry::proto::collector::metrics::v1::ExportMetricsServiceRequest @@ -106,7 +100,7 @@ class OtlpMockMetricsServiceStub : public proto::collector::metrics::v1::MockMet ::opentelemetry::proto::collector::metrics::v1::ExportMetricsServiceResponse * /*response*/, ::grpc::ClientUnaryReactor * /*reactor*/) override {} -# else +#else void Export( ::grpc::ClientContext * /*context*/, const ::opentelemetry::proto::collector::metrics::v1::ExportMetricsServiceRequest @@ -114,7 +108,7 @@ class OtlpMockMetricsServiceStub : public proto::collector::metrics::v1::MockMet ::opentelemetry::proto::collector::metrics::v1::ExportMetricsServiceResponse * /*response*/, ::grpc::experimental::ClientUnaryReactor * /*reactor*/) {} -# endif +#endif private: OtlpMockMetricsServiceStub *stub_; @@ -193,7 +187,7 @@ TEST_F(OtlpGrpcMetricExporterTestPeer, ConfigSslCredentialsTest) EXPECT_EQ(GetOptions(exporter).use_ssl_credentials, true); } -# ifndef NO_GETENV +#ifndef NO_GETENV // Test exporter configuration options with use_ssl_credentials TEST_F(OtlpGrpcMetricExporterTestPeer, ConfigFromEnv) { @@ -361,7 +355,7 @@ TEST_F(OtlpGrpcMetricExporterTestPeer, ConfigRetryGenericValuesFromEnv) unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_MAX_BACKOFF"); unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_BACKOFF_MULTIPLIER"); } -# endif // NO_GETENV +#endif // NO_GETENV TEST_F(OtlpGrpcMetricExporterTestPeer, CheckGetAggregationTemporality) { @@ -450,4 +444,3 @@ TEST_F(OtlpGrpcMetricExporterTestPeer, ExportPartialSuccess) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif /* OPENTELEMETRY_STL_VERSION */ diff --git a/exporters/otlp/test/otlp_http_exporter_custom_client_test.cc b/exporters/otlp/test/otlp_http_exporter_custom_client_test.cc index e49ad776a7..a22278ef8e 100644 --- a/exporters/otlp/test/otlp_http_exporter_custom_client_test.cc +++ b/exporters/otlp/test/otlp_http_exporter_custom_client_test.cc @@ -1,25 +1,33 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION - -# include - -# include "opentelemetry/exporters/otlp/otlp_http_client.h" -# include "opentelemetry/exporters/otlp/otlp_http_exporter.h" -# include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_http_exporter_runtime_options.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/sdk/trace/batch_span_processor.h" -# include "opentelemetry/sdk/trace/batch_span_processor_options.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" -# include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" - -# include -# include "gmock/gmock.h" +#include +#include +#include +#include +#include "gmock/gmock.h" + +#include "opentelemetry/exporters/otlp/otlp_http_client.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter_runtime_options.h" +#include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/sdk/common/thread_instrumentation.h" +#include "opentelemetry/sdk/trace/batch_span_processor.h" +#include "opentelemetry/sdk/trace/batch_span_processor_options.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/tracer.h" +#include "opentelemetry/version.h" + +#include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" using namespace testing; @@ -148,5 +156,3 @@ TEST_F(OtlpHttpExporterCustomClientTestPeer, ExportCallsSendRequest) } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // OPENTELEMETRY_STL_VERSION diff --git a/exporters/otlp/test/otlp_http_exporter_test.cc b/exporters/otlp/test/otlp_http_exporter_test.cc index a77a5fe590..acf0f7fc1d 100644 --- a/exporters/otlp/test/otlp_http_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_exporter_test.cc @@ -1,50 +1,76 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION - -# include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gmock/gmock.h" +#include "nlohmann/json.hpp" + +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_http.h" +#include "opentelemetry/exporters/otlp/otlp_http_client.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_exporter_options.h" +#include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/common/thread_instrumentation.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/batch_span_processor.h" +#include "opentelemetry/sdk/trace/batch_span_processor_options.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/recordable.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" +#include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/span_context.h" +#include "opentelemetry/trace/span_startoptions.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/tracer.h" +#include "opentelemetry/version.h" + +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep +#include "opentelemetry/proto/trace/v1/trace.pb.h" +#include "opentelemetry/proto/collector/trace/v1/trace_service.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep +// clang-format on + +// IWYU pragma: no_include + +#ifdef ENABLE_OTLP_RETRY_PREVIEW +# include # include +# include +# include -# include "opentelemetry/exporters/otlp/otlp_http_exporter.h" # include "opentelemetry/exporters/otlp/otlp_http_exporter_factory.h" - -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" - -# include "opentelemetry/proto/collector/trace/v1/trace_service.pb.h" - -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" - -# include "opentelemetry/ext/http/client/http_client_factory.h" # include "opentelemetry/ext/http/server/http_server.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/trace/batch_span_processor.h" -# include "opentelemetry/sdk/trace/batch_span_processor_options.h" -# include "opentelemetry/sdk/trace/simple_processor.h" # include "opentelemetry/sdk/trace/simple_processor_factory.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" # include "opentelemetry/sdk/trace/tracer_provider_factory.h" -# include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" -# include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" -# include "opentelemetry/trace/provider.h" -# include "opentelemetry/trace/tracer_provider.h" - -# include -# include -# include - -# include -# include -# include "gmock/gmock.h" - -# include "nlohmann/json.hpp" +#endif -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +#endif using namespace testing; OPENTELEMETRY_BEGIN_NAMESPACE @@ -247,7 +273,7 @@ class OtlpHttpExporterTestPeer : public ::testing::Test EXPECT_GE(received_trace_id_counter, 1); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT void ExportJsonIntegrationTestAsync() { auto mock_otlp_client = @@ -362,7 +388,7 @@ class OtlpHttpExporterTestPeer : public ::testing::Test // Exporting can be retried EXPECT_GE(received_trace_id_counter, 1); } -# endif +#endif void ExportBinaryIntegrationTest() { @@ -460,7 +486,7 @@ class OtlpHttpExporterTestPeer : public ::testing::Test EXPECT_GE(received_trace_id_counter, 1); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT void ExportBinaryIntegrationTestAsync() { auto mock_otlp_client = @@ -560,7 +586,7 @@ class OtlpHttpExporterTestPeer : public ::testing::Test // Exporting can be retried EXPECT_GE(received_trace_id_counter, 1); } -# endif +#endif }; TEST(OtlpHttpExporterTest, Shutdown) @@ -581,13 +607,13 @@ TEST_F(OtlpHttpExporterTestPeer, ExportJsonIntegrationTestSync) ExportJsonIntegrationTest(); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpExporterTestPeer, ExportJsonIntegrationTestAsync) { ExportJsonIntegrationTestAsync(); static ProtobufGlobalSymbolGuard global_symbol_guard; } -# endif +#endif // Create spans, let processor call Export() TEST_F(OtlpHttpExporterTestPeer, ExportBinaryIntegrationTestSync) @@ -595,12 +621,12 @@ TEST_F(OtlpHttpExporterTestPeer, ExportBinaryIntegrationTestSync) ExportBinaryIntegrationTest(); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpExporterTestPeer, ExportBinaryIntegrationTestAsync) { ExportBinaryIntegrationTestAsync(); } -# endif +#endif // Test exporter configuration options TEST_F(OtlpHttpExporterTestPeer, ConfigTest) @@ -635,7 +661,7 @@ TEST(OtlpHttpExporterTest, ConfigDefaultProtocolTest) EXPECT_EQ(opts.content_type, HttpRequestContentType::kBinary); } -# ifndef NO_GETENV +#ifndef NO_GETENV // Test exporter configuration options with use_ssl_credentials TEST_F(OtlpHttpExporterTestPeer, ConfigFromEnv) { @@ -772,9 +798,9 @@ TEST_F(OtlpHttpExporterTestPeer, ConfigRetryGenericValuesFromEnv) unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_MAX_BACKOFF"); unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_BACKOFF_MULTIPLIER"); } -# endif // NO_GETENV +#endif // NO_GETENV -# ifdef ENABLE_OTLP_RETRY_PREVIEW +#ifdef ENABLE_OTLP_RETRY_PREVIEW using StatusCodeVector = std::vector; namespace @@ -880,7 +906,7 @@ TEST_P(OtlpHttpExporterRetryIntegrationTests, StatusCodes) ASSERT_EQ(expected_attempts, request_count); } -# endif // ENABLE_OTLP_RETRY_PREVIEW +#endif // ENABLE_OTLP_RETRY_PREVIEW using opentelemetry::test_common::ScopedTestLogHandler; @@ -967,7 +993,7 @@ TEST_F(OtlpHttpExporterTestPeer, ExportPartialSuccessJson) } // A malformed response body on a 2xx should return as kFailure for sync exports. -# ifndef ENABLE_ASYNC_EXPORT +#ifndef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpExporterTestPeer, ExportParseFailureReturnsFailure) { std::string serialized = "{some bad JSON"; @@ -993,9 +1019,8 @@ TEST_F(OtlpHttpExporterTestPeer, ExportParseFailureReturnsFailure) nostd::span> batch(&recordable, 1); EXPECT_EQ(sdk::common::ExportResult::kFailure, exporter->Export(batch)); } -# endif +#endif } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif /* OPENTELEMETRY_STL_VERSION */ diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_custom_client_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_custom_client_test.cc index 82645ab3e1..be61fc92b1 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_custom_client_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_custom_client_test.cc @@ -1,16 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION +#include +#include +#include +#include -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_runtime_options.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_runtime_options.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/version.h" -# include +#include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" namespace http_client = opentelemetry::ext::http::client; @@ -60,5 +63,3 @@ TEST(OtlpHttpLogRecordExporterCustomClientTest, RuntimeOptionsWithHttpClientCrea } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // OPENTELEMETRY_STL_VERSION diff --git a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc index 918d21b515..dafaadb1e1 100644 --- a/exporters/otlp/test/otlp_http_log_record_exporter_test.cc +++ b/exporters/otlp/test/otlp_http_log_record_exporter_test.cc @@ -1,47 +1,67 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION - -# include -# include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "gmock/gmock.h" +#include "nlohmann/json.hpp" + +#include "opentelemetry/common/key_value_iterable_view.h" +#include "opentelemetry/exporters/otlp/otlp_environment.h" +#include "opentelemetry/exporters/otlp/otlp_http.h" +#include "opentelemetry/exporters/otlp/otlp_http_client.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" +#include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter_options.h" +#include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/logs/logger.h" +#include "opentelemetry/logs/severity.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/proto/common/v1/common.pb.h" +#include "opentelemetry/proto/logs/v1/logs.pb.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/common/global_log_handler.h" +#include "opentelemetry/sdk/common/thread_instrumentation.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor.h" +#include "opentelemetry/sdk/logs/batch_log_record_processor_options.h" +#include "opentelemetry/sdk/logs/exporter.h" +#include "opentelemetry/sdk/logs/logger_provider.h" +#include "opentelemetry/sdk/logs/processor.h" +#include "opentelemetry/sdk/logs/recordable.h" +#include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" +#include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" +#include "opentelemetry/trace/span_id.h" +#include "opentelemetry/trace/trace_flags.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/version.h" + +// clang-format off +#include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" // IWYU pragma: keep +#include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" +#include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" // IWYU pragma: keep +// clang-format on + +// IWYU pragma: no_include +// IWYU pragma: no_include + +#ifdef ENABLE_ASYNC_EXPORT # include -# include -# include - -# include "opentelemetry/exporters/otlp/otlp_http_log_record_exporter.h" - -# include "opentelemetry/exporters/otlp/protobuf_include_prefix.h" - -# include "opentelemetry/proto/collector/logs/v1/logs_service.pb.h" - -# include "opentelemetry/exporters/otlp/protobuf_include_suffix.h" - -# include "opentelemetry/common/key_value_iterable_view.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/ext/http/server/http_server.h" -# include "opentelemetry/logs/provider.h" -# include "opentelemetry/nostd/shared_ptr.h" -# include "opentelemetry/sdk/common/global_log_handler.h" -# include "opentelemetry/sdk/logs/batch_log_record_processor.h" -# include "opentelemetry/sdk/logs/exporter.h" -# include "opentelemetry/sdk/logs/logger_provider.h" -# include "opentelemetry/sdk/resource/resource.h" -# include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_nosend.h" -# include "opentelemetry/test_common/sdk/common/scoped_test_log_handler.h" - -# include -# include -# include "gmock/gmock.h" - -# include "nlohmann/json.hpp" +#endif -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +#endif using namespace testing; @@ -265,7 +285,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test EXPECT_GE(received_record_counter, 1); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT void ExportJsonIntegrationTestAsync() { auto mock_otlp_client = OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient( @@ -411,7 +431,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test // Exporting can be retried EXPECT_GE(received_record_counter, 1); } -# endif +#endif void ExportBinaryIntegrationTest() { @@ -539,7 +559,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test EXPECT_GE(received_record_counter, 1); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT void ExportBinaryIntegrationTestAsync() { auto mock_otlp_client = OtlpHttpLogRecordExporterTestPeer::GetMockOtlpHttpClient( @@ -669,7 +689,7 @@ class OtlpHttpLogRecordExporterTestPeer : public ::testing::Test // Exporting can be retried EXPECT_GE(received_record_counter, 1); } -# endif +#endif }; TEST(OtlpHttpLogRecordExporterTest, Shutdown) @@ -690,13 +710,13 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportJsonIntegrationTestSync) ExportJsonIntegrationTest(); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportJsonIntegrationTestAsync) { ExportJsonIntegrationTestAsync(); static ProtobufGlobalSymbolGuard global_symbol_guard; } -# endif +#endif // Create log records, let processor call Export() TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportBinaryIntegrationTestSync) @@ -704,12 +724,12 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportBinaryIntegrationTestSync) ExportBinaryIntegrationTest(); } -# ifdef ENABLE_ASYNC_EXPORT +#ifdef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportBinaryIntegrationTestAsync) { ExportBinaryIntegrationTestAsync(); } -# endif +#endif // Test exporter configuration options TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigTest) @@ -747,7 +767,7 @@ TEST(OtlpHttpLogRecordExporterTest, ConfigDefaultProtocolTest) EXPECT_EQ(opts.content_type, HttpRequestContentType::kBinary); } -# ifndef NO_GETENV +#ifndef NO_GETENV // Test exporter configuration options with use_ssl_credentials TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigFromEnv) { @@ -896,7 +916,7 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ConfigRetryGenericValuesFromEnv) unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_MAX_BACKOFF"); unsetenv("OTEL_CPP_EXPORTER_OTLP_RETRY_BACKOFF_MULTIPLIER"); } -# endif // NO_GETENV +#endif // NO_GETENV // Exporter logs the rejection on partial_success. TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportPartialSuccess) @@ -979,7 +999,7 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportPartialSuccessJson) } // A malformed response body on a 2xx should return as kFailure for sync exports. -# ifndef ENABLE_ASYNC_EXPORT +#ifndef ENABLE_ASYNC_EXPORT TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportParseFailureReturnsFailure) { std::string serialized = "{some bad JSON"; @@ -1004,9 +1024,8 @@ TEST_F(OtlpHttpLogRecordExporterTestPeer, ExportParseFailureReturnsFailure) nostd::span> batch(&recordable, 1); EXPECT_EQ(opentelemetry::sdk::common::ExportResult::kFailure, exporter->Export(batch)); } -# endif +#endif } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif /* OPENTELEMETRY_STL_VERSION */ diff --git a/exporters/otlp/test/otlp_http_metric_exporter_custom_client_test.cc b/exporters/otlp/test/otlp_http_metric_exporter_custom_client_test.cc index 58cbfe28e8..96f3c59c75 100644 --- a/exporters/otlp/test/otlp_http_metric_exporter_custom_client_test.cc +++ b/exporters/otlp/test/otlp_http_metric_exporter_custom_client_test.cc @@ -1,16 +1,19 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION +#include +#include +#include +#include -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" -# include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_runtime_options.h" -# include "opentelemetry/ext/http/client/http_client_factory.h" -# include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_factory.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_options.h" +#include "opentelemetry/exporters/otlp/otlp_http_metric_exporter_runtime_options.h" +#include "opentelemetry/sdk/metrics/push_metric_exporter.h" +#include "opentelemetry/version.h" -# include +#include "opentelemetry/test_common/ext/http/client/http_client_test_factory.h" +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" namespace http_client = opentelemetry::ext::http::client; @@ -60,5 +63,3 @@ TEST(OtlpHttpMetricExporterCustomClientTest, RuntimeOptionsWithHttpClientCreates } // namespace otlp } // namespace exporter OPENTELEMETRY_END_NAMESPACE - -#endif // OPENTELEMETRY_STL_VERSION diff --git a/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h b/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h index cb4d8f099b..8fdd99bff4 100644 --- a/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h +++ b/exporters/zipkin/include/opentelemetry/exporters/zipkin/zipkin_exporter.h @@ -13,10 +13,7 @@ #include "opentelemetry/ext/http/client/http_client.h" #include "opentelemetry/ext/http/client/http_client_factory.h" #include "opentelemetry/ext/http/common/url_parser.h" -#include "opentelemetry/nostd/span.h" -#include "opentelemetry/sdk/common/exporter_utils.h" #include "opentelemetry/sdk/trace/exporter.h" -#include "opentelemetry/sdk/trace/recordable.h" #include "opentelemetry/version.h" OPENTELEMETRY_BEGIN_NAMESPACE diff --git a/exporters/zipkin/test/zipkin_exporter_test.cc b/exporters/zipkin/test/zipkin_exporter_test.cc index a15871cc89..a04672892d 100644 --- a/exporters/zipkin/test/zipkin_exporter_test.cc +++ b/exporters/zipkin/test/zipkin_exporter_test.cc @@ -1,31 +1,51 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -#ifndef OPENTELEMETRY_STL_VERSION - -# include "opentelemetry/exporters/zipkin/zipkin_exporter.h" -# include "opentelemetry/exporters/zipkin/zipkin_exporter_factory.h" -# include "opentelemetry/ext/http/client/curl/http_client_curl.h" -# include "opentelemetry/ext/http/server/http_server.h" -# include "opentelemetry/sdk/trace/batch_span_processor.h" -# include "opentelemetry/sdk/trace/batch_span_processor_options.h" -# include "opentelemetry/sdk/trace/tracer_provider.h" -# include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" -# include "opentelemetry/trace/provider.h" - -# include -# include "gmock/gmock.h" - -# include "nlohmann/json.hpp" - -# include -# include - -# if defined(_MSC_VER) -# include "opentelemetry/sdk/common/env_variables.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include "gmock/gmock.h" +#include "nlohmann/json.hpp" + +#include "opentelemetry/common/timestamp.h" +#include "opentelemetry/context/context.h" +#include "opentelemetry/exporters/zipkin/zipkin_exporter.h" +#include "opentelemetry/exporters/zipkin/zipkin_exporter_factory.h" +#include "opentelemetry/exporters/zipkin/zipkin_exporter_options.h" +#include "opentelemetry/ext/http/client/curl/http_client_curl.h" +#include "opentelemetry/ext/http/client/http_client.h" +#include "opentelemetry/nostd/shared_ptr.h" +#include "opentelemetry/nostd/span.h" +#include "opentelemetry/nostd/string_view.h" +#include "opentelemetry/nostd/variant.h" +#include "opentelemetry/sdk/common/exporter_utils.h" +#include "opentelemetry/sdk/resource/resource.h" +#include "opentelemetry/sdk/trace/batch_span_processor.h" +#include "opentelemetry/sdk/trace/batch_span_processor_options.h" +#include "opentelemetry/sdk/trace/exporter.h" +#include "opentelemetry/sdk/trace/processor.h" +#include "opentelemetry/sdk/trace/recordable.h" +#include "opentelemetry/sdk/trace/tracer_provider.h" +#include "opentelemetry/trace/span.h" +#include "opentelemetry/trace/span_context.h" +#include "opentelemetry/trace/span_startoptions.h" +#include "opentelemetry/trace/trace_id.h" +#include "opentelemetry/trace/tracer.h" +#include "opentelemetry/trace/tracer_provider.h" +#include "opentelemetry/version.h" + +#include "opentelemetry/test_common/ext/http/client/nosend/http_client_factory_nosend.h" + +#if defined(_MSC_VER) +# include "opentelemetry/sdk/common/env_variables.h" using opentelemetry::sdk::common::setenv; using opentelemetry::sdk::common::unsetenv; -# endif +#endif namespace sdk_common = opentelemetry::sdk::common; using namespace testing; @@ -217,7 +237,7 @@ TEST_F(ZipkinExporterTestPeer, ConfigTest) EXPECT_EQ(GetOptions(exporter).endpoint, "http://localhost:45455/v1/traces"); } -# ifndef NO_GETENV +#ifndef NO_GETENV // Test exporter configuration options from env TEST_F(ZipkinExporterTestPeer, ConfigFromEnv) { @@ -230,7 +250,7 @@ TEST_F(ZipkinExporterTestPeer, ConfigFromEnv) unsetenv("OTEL_EXPORTER_ZIPKIN_ENDPOINT"); } -# endif // NO_GETENV +#endif // NO_GETENV TEST_F(ZipkinExporterTestPeer, FactoryInjectionCreatesExporter) { @@ -253,4 +273,3 @@ TEST_F(ZipkinExporterTestPeer, HttpClientSyncInjectionCreatesExporter) } // namespace zipkin } // namespace exporter OPENTELEMETRY_END_NAMESPACE -#endif /* OPENTELEMETRY_STL_VERSION */