Skip to content

Commit

Permalink
Merge branch 'main' into fix_selinux_2454
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Dec 14, 2023
2 parents a8f7a97 + 03f2a69 commit 2b91cfc
Show file tree
Hide file tree
Showing 35 changed files with 115 additions and 280 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,22 @@ jobs:
- name: run tests
run: ./ci/do_ci.ps1 cmake.maintainer.test

cmake_msvc_maintainer_test_stl_cxx20:
name: CMake msvc (maintainer mode) with C++20
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: setup
run: |
./ci/setup_windows_cmake.ps1
./ci/setup_windows_ci_environment.ps1
- name: run tests
env:
CXX_STANDARD: '20'
run: ./ci/do_ci.ps1 cmake.maintainer.cxx20.stl.test

cmake_with_async_export_test:
name: CMake test (without otlp-exporter and with async export)
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ jobs:
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: cpp
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,23 @@ Increment the:

## [Unreleased]

* [REMOVAL] Remove option WITH_OTLP_HTTP_SSL_PREVIEW
[#2435](https://github.com/open-telemetry/opentelemetry-cpp/pull/2435)
* [BUILD] Fix removing of NOMINMAX on Windows
[#2449](https://github.com/open-telemetry/opentelemetry-cpp/pull/2449)
* [BUILD] Introduce CXX 20 CI pipeline for MSVC/Windows
[#2450](https://github.com/open-telemetry/opentelemetry-cpp/pull/2450)

Important changes:

Breaking changes:

* [REMOVAL] Remove option WITH_OTLP_HTTP_SSL_PREVIEW
[#2435](https://github.com/open-telemetry/opentelemetry-cpp/pull/2435)
* CMake options `WITH_OTLP_HTTP_SSL_PREVIEW`
and `WITH_OTLP_HTTP_SSL_TLS_PREVIEW` are removed.
Building opentelemetry-cpp without SSL support is no longer possible.

## [1.13.0] 2023-12-06

* [BUILD] Remove WITH_REMOVE_METER_PREVIEW, use WITH_ABI_VERSION_2 instead
Expand Down
14 changes: 0 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,6 @@ endif()

option(WITH_ASYNC_EXPORT_PREVIEW "Whether to enable async export" OFF)

# STABLE
option(WITH_OTLP_HTTP_SSL_PREVIEW "Whether to enable otlp http ssl export" ON)

# STABLE
option(WITH_OTLP_HTTP_SSL_TLS_PREVIEW
"Whether to enable otlp http ssl tls min/max/cipher options" ON)

# Exemplar specs status is experimental, so behind feature flag by default
option(WITH_METRICS_EXEMPLAR_PREVIEW
"Whether to enable exemplar within metrics" OFF)
Expand All @@ -295,13 +288,6 @@ if(WITH_EXAMPLES_HTTP AND NOT WITH_EXAMPLES)
message(FATAL_ERROR "WITH_EXAMPLES_HTTP=ON requires WITH_EXAMPLES=ON")
endif()

if(WITH_OTLP_HTTP_SSL_TLS_PREVIEW AND NOT WITH_OTLP_HTTP_SSL_PREVIEW)
message(
FATAL_ERROR
"WITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON requires WITH_OTLP_HTTP_SSL_PREVIEW=ON"
)
endif()

find_package(Threads)

function(install_windows_deps)
Expand Down
15 changes: 0 additions & 15 deletions api/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,6 @@ target_compile_definitions(
opentelemetry_api
INTERFACE OPENTELEMETRY_ABI_VERSION_NO=${OPENTELEMETRY_ABI_VERSION_NO})

# A better place should be in sdk, not api
if(WITH_OTLP_HTTP_SSL_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_HTTP_SSL_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_HTTP_SSL_PREVIEW)

if(WITH_OTLP_HTTP_SSL_TLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_HTTP_SSL_TLS_PREVIEW)
endif()
endif()

if(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
target_compile_definitions(opentelemetry_api
INTERFACE ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW)
Expand Down
2 changes: 1 addition & 1 deletion api/include/opentelemetry/std/span.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ OPENTELEMETRY_END_NAMESPACE
OPENTELEMETRY_BEGIN_NAMESPACE
namespace nostd
{
constexpr std::size_t dynamic_extent = (std::numeric_limits<std::size_t>::max());
constexpr std::size_t dynamic_extent = (std::numeric_limits<std::size_t>::max)();

template <class ElementType, std::size_t Extent = nostd::dynamic_extent>
using span = std::span<ElementType, Extent>;
Expand Down
4 changes: 2 additions & 2 deletions api/test/nostd/string_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ TEST(StringViewTest, SubstrPortion)
TEST(StringViewTest, SubstrOutOfRange)
{
string_view s = "abc123";
#if __EXCEPTIONS || ((defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2020)))
EXPECT_THROW(s.substr(10), std::out_of_range);
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2017))
EXPECT_THROW((void)s.substr(10), std::out_of_range);
#else
EXPECT_DEATH({ s.substr(10); }, "");
#endif
Expand Down
2 changes: 1 addition & 1 deletion api/test/nostd/variant_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ TEST(VariantTest, Get)
EXPECT_EQ(nostd::get<int>(w), 12);
EXPECT_EQ(*nostd::get_if<int>(&v), 12);
EXPECT_EQ(nostd::get_if<float>(&v), nullptr);
#if __EXCEPTIONS
#if __EXCEPTIONS || (defined(OPENTELEMETRY_STL_VERSION) && (OPENTELEMETRY_STL_VERSION >= 2017))
EXPECT_THROW(nostd::get<float>(w), nostd::bad_variant_access);
#else
EXPECT_DEATH({ nostd::get<float>(w); }, "");
Expand Down
24 changes: 24 additions & 0 deletions ci/do_ci.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,30 @@ switch ($action) {
exit $exit
}
}
"cmake.maintainer.cxx20.stl.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
-DWITH_STL=CXX20 `
-DCMAKE_CXX_STANDARD=20 `
-DOTELCPP_MAINTAINER_MODE=ON `
-DWITH_NO_DEPRECATED_CODE=ON `
-DVCPKG_TARGET_TRIPLET=x64-windows `
"-DCMAKE_TOOLCHAIN_FILE=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake"
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
cmake --build . -j $nproc
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
ctest -C Debug
$exit = $LASTEXITCODE
if ($exit -ne 0) {
exit $exit
}
}
"cmake.with_async_export.test" {
cd "$BUILD_DIR"
cmake $SRC_DIR `
Expand Down
8 changes: 0 additions & 8 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ elif [[ "$1" == "cmake.maintainer.sync.test" ]]; then
rm -rf *
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand All @@ -132,8 +130,6 @@ elif [[ "$1" == "cmake.maintainer.async.test" ]]; then
rm -rf *
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand All @@ -155,8 +151,6 @@ elif [[ "$1" == "cmake.maintainer.cpp11.async.test" ]]; then
cmake ${CMAKE_OPTIONS[@]} \
-DCMAKE_CXX_STANDARD=11 \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand All @@ -176,8 +170,6 @@ elif [[ "$1" == "cmake.maintainer.abiv2.test" ]]; then
rm -rf *
cmake ${CMAKE_OPTIONS[@]} \
-DWITH_OTLP_HTTP=ON \
-DWITH_OTLP_HTTP_SSL_PREVIEW=ON \
-DWITH_OTLP_HTTP_SSL_TLS_PREVIEW=ON \
-DWITH_PROMETHEUS=ON \
-DWITH_EXAMPLES=ON \
-DWITH_EXAMPLES_HTTP=ON \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ std::string GetOtlpDefaultTracesSslClientCertificateString();
std::string GetOtlpDefaultMetricsSslClientCertificateString();
std::string GetOtlpDefaultLogsSslClientCertificateString();

#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW
std::string GetOtlpDefaultTracesSslTlsMinVersion();
std::string GetOtlpDefaultMetricsSslTlsMinVersion();
std::string GetOtlpDefaultLogsSslTlsMinVersion();
Expand All @@ -117,7 +116,6 @@ std::string GetOtlpDefaultLogsSslTlsCipher();
std::string GetOtlpDefaultTracesSslTlsCipherSuite();
std::string GetOtlpDefaultMetricsSslTlsCipherSuite();
std::string GetOtlpDefaultLogsSslTlsCipherSuite();
#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */

std::chrono::system_clock::duration GetOtlpDefaultTracesTimeout();
std::chrono::system_clock::duration GetOtlpDefaultMetricsTimeout();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,8 @@ struct OtlpHttpClientOptions
{
std::string url;

#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
/** SSL options. */
ext::http::client::HttpSslOptions ssl_options;
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */

// By default, post json data
HttpRequestContentType content_type = HttpRequestContentType::kJson;
Expand Down Expand Up @@ -83,21 +81,17 @@ struct OtlpHttpClientOptions
std::string user_agent;

inline OtlpHttpClientOptions(nostd::string_view input_url,
#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
bool input_ssl_insecure_skip_verify,
nostd::string_view input_ssl_ca_cert_path,
nostd::string_view input_ssl_ca_cert_string,
nostd::string_view input_ssl_client_key_path,
nostd::string_view input_ssl_client_key_string,
nostd::string_view input_ssl_client_cert_path,
nostd::string_view input_ssl_client_cert_string,
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */
#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW
nostd::string_view input_ssl_min_tls,
nostd::string_view input_ssl_max_tls,
nostd::string_view input_ssl_cipher,
nostd::string_view input_ssl_cipher_suite,
#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */
HttpRequestContentType input_content_type,
JsonBytesMappingKind input_json_bytes_mapping,
bool input_use_json_name,
Expand All @@ -108,24 +102,18 @@ struct OtlpHttpClientOptions
std::size_t input_max_requests_per_connection = 8,
nostd::string_view input_user_agent = GetOtlpDefaultUserAgent())
: url(input_url),
#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
ssl_options(input_url,
input_ssl_insecure_skip_verify,
input_ssl_ca_cert_path,
input_ssl_ca_cert_string,
input_ssl_client_key_path,
input_ssl_client_key_string,
input_ssl_client_cert_path,
input_ssl_client_cert_string
# ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW
,
input_ssl_client_cert_string,
input_ssl_min_tls,
input_ssl_max_tls,
input_ssl_cipher,
input_ssl_cipher_suite
# endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */
),
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */
input_ssl_cipher_suite),
content_type(input_content_type),
json_bytes_mapping(input_json_bytes_mapping),
use_json_name(input_use_json_name),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ struct OPENTELEMETRY_EXPORT OtlpHttpExporterOptions
std::size_t max_requests_per_connection;
#endif

#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
/** True do disable SSL. */
bool ssl_insecure_skip_verify;

Expand All @@ -89,9 +88,7 @@ struct OPENTELEMETRY_EXPORT OtlpHttpExporterOptions

/** CLIENT CERT, as a string. */
std::string ssl_client_cert_string;
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */

#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW
/** Minimum TLS version. */
std::string ssl_min_tls;

Expand All @@ -103,7 +100,6 @@ struct OPENTELEMETRY_EXPORT OtlpHttpExporterOptions

/** TLS cipher suite. */
std::string ssl_cipher_suite;
#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */
};

} // namespace otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ struct OPENTELEMETRY_EXPORT OtlpHttpLogRecordExporterOptions
std::size_t max_requests_per_connection;
#endif

#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
/** True do disable SSL. */
bool ssl_insecure_skip_verify;

Expand All @@ -89,9 +88,7 @@ struct OPENTELEMETRY_EXPORT OtlpHttpLogRecordExporterOptions

/** CLIENT CERT, as a string. */
std::string ssl_client_cert_string;
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */

#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW
/** Minimum TLS version. */
std::string ssl_min_tls;

Expand All @@ -103,7 +100,6 @@ struct OPENTELEMETRY_EXPORT OtlpHttpLogRecordExporterOptions

/** TLS cipher suite. */
std::string ssl_cipher_suite;
#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */
};

} // namespace otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ struct OPENTELEMETRY_EXPORT OtlpHttpMetricExporterOptions
std::size_t max_requests_per_connection;
#endif

#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
/** True do disable SSL. */
bool ssl_insecure_skip_verify;

Expand All @@ -92,9 +91,7 @@ struct OPENTELEMETRY_EXPORT OtlpHttpMetricExporterOptions

/** CLIENT CERT, as a string. */
std::string ssl_client_cert_string;
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */

#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW
/** Minimum TLS version. */
std::string ssl_min_tls;

Expand All @@ -106,7 +103,6 @@ struct OPENTELEMETRY_EXPORT OtlpHttpMetricExporterOptions

/** TLS cipher suite. */
std::string ssl_cipher_suite;
#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */
};

} // namespace otlp
Expand Down
4 changes: 0 additions & 4 deletions exporters/otlp/src/otlp_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -660,8 +660,6 @@ std::string GetOtlpDefaultLogsSslClientCertificateString()
return std::string{};
}

#ifdef ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW

/*
EXPERIMENTAL:
Environment variable names do not exist in the spec,
Expand Down Expand Up @@ -872,8 +870,6 @@ std::string GetOtlpDefaultLogsSslTlsCipherSuite()
return std::string{};
}

#endif /* ENABLE_OTLP_HTTP_SSL_TLS_PREVIEW */

std::chrono::system_clock::duration GetOtlpDefaultTracesTimeout()
{
constexpr char kSignalEnv[] = "OTEL_EXPORTER_OTLP_TRACES_TIMEOUT";
Expand Down
2 changes: 0 additions & 2 deletions exporters/otlp/src/otlp_http_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -951,9 +951,7 @@ OtlpHttpClient::createSession(
request->AddHeader(header.first, header.second);
}
request->SetUri(http_uri_);
#ifdef ENABLE_OTLP_HTTP_SSL_PREVIEW
request->SetSslOptions(options_.ssl_options);
#endif /* ENABLE_OTLP_HTTP_SSL_PREVIEW */
request->SetTimeoutMs(std::chrono::duration_cast<std::chrono::milliseconds>(options_.timeout));
request->SetMethod(http_client::Method::Post);
request->SetBody(body_vec);
Expand Down

0 comments on commit 2b91cfc

Please sign in to comment.