Skip to content

Commit fef7bbb

Browse files
marcalffThomsonTan
andauthored
Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default (#3970)
Co-authored-by: Tom Tan <lilotom@gmail.com>
1 parent f300645 commit fef7bbb

File tree

6 files changed

+73
-4
lines changed

6 files changed

+73
-4
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ Increment the:
4040
* Enable WITH_OTLP_RETRY_PREVIEW by default
4141
[#3953](https://github.com/open-telemetry/opentelemetry-cpp/pull/3953)
4242

43+
* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default
44+
[#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970)
45+
4346
Important changes:
4447

4548
* Enable WITH_OTLP_RETRY_PREVIEW by default
@@ -48,6 +51,15 @@ Important changes:
4851
* CMake flag WITH_OTLP_RETRY_PREVIEW is now enabled by default.
4952
* This flag is deprecated, planned for removal.
5053

54+
* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default
55+
[#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970)
56+
57+
* CMake flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW is now enabled by default.
58+
* This flag is deprecated, planned for removal.
59+
* Bazel now always builds with ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW.
60+
* grpc properties for ssl KEY and CERT are always available,
61+
adjust the application code to initialize all members in grpc options.
62+
5163
## [1.26.0] 2026-03-19
5264

5365
* [RELEASE] Bump main branch to 1.26.0-dev

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ endif()
134134
option(WITH_OTLP_RETRY_PREVIEW "Whether to enable retry functionality" ON)
135135

136136
option(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
137-
"Whether to enable mTLS support for gRPC" OFF)
137+
"Whether to enable mTLS support for gRPC" ON)
138138

139139
option(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW
140140
"Whether to enable gRPC credentials option in OTLP gRPC Exporter" OFF)

DEPRECATED.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,58 @@ to enable or disable the retry feature.
8888

8989
This compilation flag will be removed after October 1st, 2026.
9090

91+
### CMake WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
92+
93+
#### Announcement (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
94+
95+
The CMake compile flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW is deprecated by:
96+
97+
* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default
98+
[#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970)
99+
100+
#### Motivation (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
101+
102+
Flags like `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` are used to conditionally compile
103+
new features, when they are introduced in the code base.
104+
105+
Now that this feature is stable, conditional compilation is no longer
106+
necessary.
107+
108+
#### Scope (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
109+
110+
Remove compilation flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW in CMake.
111+
112+
Remove ifdef ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW in C++ .
113+
114+
#### Mitigation (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
115+
116+
Applications built with `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON` need to:
117+
118+
* remove the WITH_OTLP_GRPC_SSL_MTLS_PREVIEW flag from CMake scripts
119+
120+
Applications built with `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF` need to:
121+
122+
* remove the WITH_OTLP_GRPC_SSL_MTLS_PREVIEW flag from CMake scripts
123+
* initialize ssl client properties in the OTLP GRPC exporter options,
124+
either with real KEY and CERT data, or with empty strings.
125+
126+
See:
127+
128+
* struct `OtlpGrpcClientOptions`
129+
* struct `OtlpGrpcLogRecordExporterOptions`
130+
* struct `OtlpGrpcMetricExporterOptions`
131+
* struct `OtlpGrpcExporterOptions`
132+
133+
For Bazel, no compilation flag exists, the code is always built using
134+
ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW.
135+
136+
Make sure to properly initialize ssl client properties
137+
to enable or disable the feature.
138+
139+
#### Planned removal (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
140+
141+
This compilation flag will be removed after October 1st, 2026.
142+
91143
## [opentelemetry-cpp API]
92144

93145
### Deprecation of EventLogger

api/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ endif()
9191
if(WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
9292
target_compile_definitions(opentelemetry_api
9393
INTERFACE ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW)
94+
else()
95+
message(WARNING "WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF is deprecated")
9496
endif()
9597

9698
if(WITH_OTLP_GRPC_CREDENTIAL_PREVIEW)

exporters/otlp/BUILD

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ cc_library(
7676
defines = select({
7777
":enable_otlp_grpc_credential_preview": ["ENABLE_OTLP_GRPC_CREDENTIAL_PREVIEW"],
7878
"//conditions:default": [],
79-
}),
79+
}) + ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"],
8080
strip_include_prefix = "include",
8181
tags = [
8282
"otlp",
@@ -122,6 +122,7 @@ cc_library(
122122
"include/opentelemetry/exporters/otlp/protobuf_include_prefix.h",
123123
"include/opentelemetry/exporters/otlp/protobuf_include_suffix.h",
124124
],
125+
defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"],
125126
strip_include_prefix = "include",
126127
tags = [
127128
"otlp",
@@ -146,6 +147,7 @@ cc_library(
146147
hdrs = [
147148
"include/opentelemetry/exporters/otlp/otlp_grpc_span_builder.h",
148149
],
150+
defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"],
149151
strip_include_prefix = "include",
150152
tags = [
151153
"otlp",
@@ -336,6 +338,7 @@ cc_library(
336338
"include/opentelemetry/exporters/otlp/protobuf_include_prefix.h",
337339
"include/opentelemetry/exporters/otlp/protobuf_include_suffix.h",
338340
],
341+
defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"],
339342
strip_include_prefix = "include",
340343
tags = [
341344
"otlp",
@@ -360,6 +363,7 @@ cc_library(
360363
hdrs = [
361364
"include/opentelemetry/exporters/otlp/otlp_grpc_push_metric_builder.h",
362365
],
366+
defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"],
363367
strip_include_prefix = "include",
364368
tags = [
365369
"otlp",
@@ -602,6 +606,7 @@ cc_library(
602606
hdrs = [
603607
"include/opentelemetry/exporters/otlp/otlp_grpc_log_record_builder.h",
604608
],
609+
defines = ["ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW"],
605610
strip_include_prefix = "include",
606611
tags = [
607612
"otlp",

exporters/otlp/include/opentelemetry/exporters/otlp/otlp_grpc_client_options.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ struct OtlpGrpcClientOptions
4242
/** CA CERT, as a string. */
4343
std::string ssl_credentials_cacert_as_string;
4444

45-
#ifdef ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW
4645
/** CLIENT KEY, path to a file. */
4746
std::string ssl_client_key_path;
4847

@@ -54,7 +53,6 @@ struct OtlpGrpcClientOptions
5453

5554
/** CLIENT CERT, as a string. */
5655
std::string ssl_client_cert_string;
57-
#endif
5856

5957
#ifdef ENABLE_OTLP_GRPC_CREDENTIAL_PREVIEW
6058
/** Use custom ChannelCredentials, instead of the SSL options above. */

0 commit comments

Comments
 (0)