diff --git a/CHANGELOG.md b/CHANGELOG.md index 5459f1c1cf..6b494ff9da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -40,6 +40,9 @@ Increment the: * Enable WITH_OTLP_RETRY_PREVIEW by default [#3953](https://github.com/open-telemetry/opentelemetry-cpp/pull/3953) +* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default + [#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970) + Important changes: * Enable WITH_OTLP_RETRY_PREVIEW by default @@ -48,6 +51,15 @@ Important changes: * CMake flag WITH_OTLP_RETRY_PREVIEW is now enabled by default. * This flag is deprecated, planned for removal. +* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default + [#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970) + + * CMake flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW is now enabled by default. + * This flag is deprecated, planned for removal. + * Bazel now always builds with ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW. + * grpc properties for ssl KEY and CERT are always available, + adjust the application code to initialize all members in grpc options. + ## [1.26.0] 2026-03-19 * [RELEASE] Bump main branch to 1.26.0-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index 82a2513fb3..614f089501 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ endif() option(WITH_OTLP_RETRY_PREVIEW "Whether to enable retry functionality" ON) option(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW - "Whether to enable mTLS support for gRPC" OFF) + "Whether to enable mTLS support for gRPC" ON) option(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW "Whether to enable gRPC credentials option in OTLP gRPC Exporter" OFF) diff --git a/DEPRECATED.md b/DEPRECATED.md index ad1b759f5c..29971657c7 100644 --- a/DEPRECATED.md +++ b/DEPRECATED.md @@ -88,6 +88,58 @@ to enable or disable the retry feature. This compilation flag will be removed after October 1st, 2026. +### CMake WITH_OTLP_GRPC_SSL_MTLS_PREVIEW + +#### Announcement (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW) + +The CMake compile flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW is deprecated by: + +* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default + [#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970) + +#### Motivation (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW) + +Flags like `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` are used to conditionally compile +new features, when they are introduced in the code base. + +Now that this feature is stable, conditional compilation is no longer +necessary. + +#### Scope (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW) + +Remove compilation flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW in CMake. + +Remove ifdef ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW in C++ . + +#### Mitigation (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW) + +Applications built with `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON` need to: + +* remove the WITH_OTLP_GRPC_SSL_MTLS_PREVIEW flag from CMake scripts + +Applications built with `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF` need to: + +* remove the WITH_OTLP_GRPC_SSL_MTLS_PREVIEW flag from CMake scripts +* initialize ssl client properties in the OTLP GRPC exporter options, + either with real KEY and CERT data, or with empty strings. + +See: + +* struct `OtlpGrpcClientOptions` +* struct `OtlpGrpcLogRecordExporterOptions` +* struct `OtlpGrpcMetricExporterOptions` +* struct `OtlpGrpcExporterOptions` + +For Bazel, no compilation flag exists, the code is always built using +ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW. + +Make sure to properly initialize ssl client properties +to enable or disable the feature. + +#### Planned removal (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW) + +This compilation flag will be removed after October 1st, 2026. + ## [opentelemetry-cpp API] ### Deprecation of EventLogger diff --git a/api/CMakeLists.txt b/api/CMakeLists.txt index 2e4191a866..069957a251 100644 --- a/api/CMakeLists.txt +++ b/api/CMakeLists.txt @@ -91,6 +91,8 @@ endif() if(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW) target_compile_definitions(opentelemetry_api INTERFACE ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW) +else() + message(WARNING "WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF is deprecated") endif() if(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW) diff --git a/exporters/otlp/BUILD b/exporters/otlp/BUILD index 74aa818310..0fb2ee0c19 100644 --- a/exporters/otlp/BUILD +++ b/exporters/otlp/BUILD @@ -76,7 +76,7 @@ cc_library( defines = select({ ":enable_otlp_grpc_credential_preview": ["ENABLE_OTLP_GRPC_CREDENTIAL_PREVIEW"], "//conditions:default": [], - }), + }) + ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"], strip_include_prefix = "include", tags = [ "otlp", @@ -122,6 +122,7 @@ cc_library( "include/opentelemetry/exporters/otlp/protobuf_include_prefix.h", "include/opentelemetry/exporters/otlp/protobuf_include_suffix.h", ], + defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"], strip_include_prefix = "include", tags = [ "otlp", @@ -146,6 +147,7 @@ cc_library( hdrs = [ "include/opentelemetry/exporters/otlp/otlp_grpc_span_builder.h", ], + defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"], strip_include_prefix = "include", tags = [ "otlp", @@ -336,6 +338,7 @@ cc_library( "include/opentelemetry/exporters/otlp/protobuf_include_prefix.h", "include/opentelemetry/exporters/otlp/protobuf_include_suffix.h", ], + defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"], strip_include_prefix = "include", tags = [ "otlp", @@ -360,6 +363,7 @@ cc_library( hdrs = [ "include/opentelemetry/exporters/otlp/otlp_grpc_push_metric_builder.h", ], + defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"], strip_include_prefix = "include", tags = [ "otlp", @@ -602,6 +606,7 @@ cc_library( hdrs = [ "include/opentelemetry/exporters/otlp/otlp_grpc_log_record_builder.h", ], + defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"], strip_include_prefix = "include", tags = [ "otlp", diff --git a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h index f377ef7d09..baec1350e7 100644 --- a/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h +++ b/exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h @@ -42,7 +42,6 @@ struct OtlpGrpcClientOptions /** CA CERT, as a string. */ std::string ssl_credentials_cacert_as_string; -#ifdef ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW /** CLIENT KEY, path to a file. */ std::string ssl_client_key_path; @@ -54,7 +53,6 @@ struct OtlpGrpcClientOptions /** CLIENT CERT, as a string. */ std::string ssl_client_cert_string; -#endif #ifdef ENABLE_OTLP_GRPC_CREDENTIAL_PREVIEW /** Use custom ChannelCredentials, instead of the SSL options above. */