Skip to content

Commit 8e36265

Browse files
committed
Optimize document
1 parent 2af0be0 commit 8e36265

3 files changed

Lines changed: 135 additions & 59 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -272,33 +272,24 @@ Breaking changes:
272272
* [CMAKE] Rename cmake options with prefix `OTELCPP_`
273273
[#4268](https://github.com/open-telemetry/opentelemetry-cpp/pull/4268)
274274
* All CMake build options were renamed with the `OTELCPP_` prefix to avoid
275-
name collisions with user and third-party project variables:
276-
* `WITH_*` options are renamed to `OTELCPP_WITH_*`, for example
277-
`WITH_OTLP_HTTP` becomes `OTELCPP_WITH_OTLP_HTTP`
278-
* `BUILD_TESTING` becomes `OTELCPP_BUILD_TESTING`. Unlike the other renamed
279-
options, `BUILD_TESTING` is not treated as a deprecated alias:
280-
* When opentelemetry-cpp is the top-level project, `BUILD_TESTING` sets
281-
the default value of `OTELCPP_BUILD_TESTING`.
282-
* When opentelemetry-cpp is a subproject, the parent project's
283-
`BUILD_TESTING` no longer controls opentelemetry-cpp tests, which
284-
default to `OFF`.
285-
* Set `OTELCPP_BUILD_TESTING` explicitly to enable or disable
286-
opentelemetry-cpp tests in either top-level or subproject builds.
287-
* `BUILD_W3CTRACECONTEXT_TEST` becomes
288-
`OTELCPP_BUILD_W3CTRACECONTEXT_TEST`
289-
* `BUILD_PACKAGE` becomes `OTELCPP_BUILD_PACKAGE`
290-
* `TARBALL` becomes `OTELCPP_TARBALL`
291-
* `OPENTELEMETRY_BUILD_DLL` becomes `OTELCPP_BUILD_DLL`
292-
* `OPENTELEMETRY_INSTALL` becomes `OTELCPP_INSTALL`
293-
* `OPENTELEMETRY_SKIP_DYNAMIC_LOADING_TESTS` becomes
294-
`OTELCPP_SKIP_DYNAMIC_LOADING_TESTS`
295-
* `OPENTELEMETRY_EXTERNAL_COMPONENT_PATH` becomes
296-
`OTELCPP_EXTERNAL_COMPONENT_PATH`
275+
name collisions with user and third-party project variables. For example,
276+
`WITH_OTLP_HTTP`, `WITH_CONFIGURATION`, and `WITH_OTLP_RETRY_PREVIEW` are
277+
now `OTELCPP_WITH_OTLP_HTTP`, `OTELCPP_WITH_CONFIGURATION`, and
278+
`OTELCPP_WITH_OTLP_RETRY_PREVIEW`.
279+
* `BUILD_TESTING` becomes `OTELCPP_BUILD_TESTING`, but is not treated as a
280+
deprecated alias:
281+
* When opentelemetry-cpp is the top-level project, `BUILD_TESTING` sets the
282+
default value of `OTELCPP_BUILD_TESTING`.
283+
* When opentelemetry-cpp is a subproject, the parent project's
284+
`BUILD_TESTING` no longer controls opentelemetry-cpp tests, which default
285+
to `OFF`.
286+
* Set `OTELCPP_BUILD_TESTING` explicitly to enable or disable
287+
opentelemetry-cpp tests in either top-level or subproject builds.
288+
* `OTELCPP_WITH_BENCHMARK` now defaults to the value of
289+
`OTELCPP_BUILD_TESTING` instead of always defaulting to `ON`.
297290
* The other legacy option names are still accepted but deprecated: a
298291
deprecation warning is emitted at configure time, and the `OTELCPP_` name
299292
takes precedence when both names are set.
300-
* Please update build scripts and CI configurations to use the new option
301-
names.
302293

303294
* [METRICS SDK] Rename Base2 Exponential Histogram Aggregation config field
304295
[#4253](https://github.com/open-telemetry/opentelemetry-cpp/pull/4253)

‎CMakeLists.txt‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,12 @@ otelcpp_option_flag(
144144
OTELCPP_WITH_GSL
145145
"Whether to use Guidelines Support Library for C++ latest features" OFF)
146146

147-
set(OTELCPP_INSTALL_DEFAULT ON)
147+
set(_OTELCPP_INSTALL_DEFAULT ON)
148148
if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
149-
set(OTELCPP_INSTALL_DEFAULT OFF)
149+
set(_OTELCPP_INSTALL_DEFAULT OFF)
150150
endif()
151151
otelcpp_option_flag(OTELCPP_INSTALL "Whether to install opentelemetry targets"
152-
${OTELCPP_INSTALL_DEFAULT})
152+
${_OTELCPP_INSTALL_DEFAULT})
153153

154154
if(NOT OTELCPP_WITH_STL STREQUAL "OFF")
155155
# These definitions are needed for test projects that do not link against

‎DEPRECATED.md‎

Lines changed: 117 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -42,38 +42,119 @@ N/A
4242

4343
## [Build scripts]
4444

45-
### CMake WITH_OTLP_RETRY_PREVIEW
46-
47-
#### Announcement (WITH_OTLP_RETRY_PREVIEW)
48-
49-
The CMake compile flag WITH_OTLP_RETRY_PREVIEW is deprecated by:
45+
### Legacy CMake option names
46+
47+
#### Announcement (legacy CMake option names)
48+
49+
* Version: `TO-BE-RELEASED-VERSION`
50+
* Date: `TO-BE-RELEASED-DATE`
51+
* PR: [#4268](https://github.com/open-telemetry/opentelemetry-cpp/pull/4268)
52+
53+
#### Motivation (legacy CMake option names)
54+
55+
Generic CMake option names can collide with variables owned by applications,
56+
parent projects, and third-party dependencies. The `OTELCPP_` prefix identifies
57+
options owned by opentelemetry-cpp.
58+
59+
#### Scope (legacy CMake option names)
60+
61+
The following legacy CMake option names are deprecated:
62+
63+
| Legacy name | Replacement |
64+
| --- | --- |
65+
| `BUILD_PACKAGE` | `OTELCPP_BUILD_PACKAGE` |
66+
| `BUILD_W3CTRACECONTEXT_TEST` | `OTELCPP_BUILD_W3CTRACECONTEXT_TEST` |
67+
| `OPENTELEMETRY_BUILD_DLL` | `OTELCPP_BUILD_DLL` |
68+
| `OPENTELEMETRY_EXTERNAL_COMPONENT_PATH` | `OTELCPP_EXTERNAL_COMPONENT_PATH` |
69+
| `OPENTELEMETRY_INSTALL` | `OTELCPP_INSTALL` |
70+
| `OPENTELEMETRY_SKIP_DYNAMIC_LOADING_TESTS` | `OTELCPP_SKIP_DYNAMIC_LOADING_TESTS` |
71+
| `TARBALL` | `OTELCPP_TARBALL` |
72+
| `WITH_ABI_VERSION_1` | `OTELCPP_WITH_ABI_VERSION_1` |
73+
| `WITH_ABI_VERSION_2` | `OTELCPP_WITH_ABI_VERSION_2` |
74+
| `WITH_API_ONLY` | `OTELCPP_WITH_API_ONLY` |
75+
| `WITH_ASYNC_EXPORT_PREVIEW` | `OTELCPP_WITH_ASYNC_EXPORT_PREVIEW` |
76+
| `WITH_BENCHMARK` | `OTELCPP_WITH_BENCHMARK` |
77+
| `WITH_CONFIGURATION` | `OTELCPP_WITH_CONFIGURATION` |
78+
| `WITH_CURL_LOGGING` | `OTELCPP_WITH_CURL_LOGGING` |
79+
| `WITH_ELASTICSEARCH` | `OTELCPP_WITH_ELASTICSEARCH` |
80+
| `WITH_ETW` | `OTELCPP_WITH_ETW` |
81+
| `WITH_EXAMPLES` | `OTELCPP_WITH_EXAMPLES` |
82+
| `WITH_EXAMPLES_HTTP` | `OTELCPP_WITH_EXAMPLES_HTTP` |
83+
| `WITH_FUNC_TESTS` | `OTELCPP_WITH_FUNC_TESTS` |
84+
| `WITH_GSL` | `OTELCPP_WITH_GSL` |
85+
| `WITH_HTTP_CLIENT_CURL` | `OTELCPP_WITH_HTTP_CLIENT_CURL` |
86+
| `WITH_METRICS_BOUND_INSTRUMENTS_PREVIEW` | `OTELCPP_WITH_METRICS_BOUND_INSTRUMENTS_PREVIEW` |
87+
| `WITH_METRICS_EXEMPLAR_PREVIEW` | `OTELCPP_WITH_METRICS_EXEMPLAR_PREVIEW` |
88+
| `WITH_NO_DEPRECATED_CODE` | `OTELCPP_WITH_NO_DEPRECATED_CODE` |
89+
| `WITH_NO_GETENV` | `OTELCPP_WITH_NO_GETENV` |
90+
| `WITH_OPENTRACING` | `OTELCPP_WITH_OPENTRACING` |
91+
| `WITH_OTLP_FILE` | `OTELCPP_WITH_OTLP_FILE` |
92+
| `WITH_OTLP_GRPC` | `OTELCPP_WITH_OTLP_GRPC` |
93+
| `WITH_OTLP_GRPC_CREDENTIAL_PREVIEW` | `OTELCPP_WITH_OTLP_GRPC_CREDENTIAL_PREVIEW` |
94+
| `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` | `OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` |
95+
| `WITH_OTLP_HTTP` | `OTELCPP_WITH_OTLP_HTTP` |
96+
| `WITH_OTLP_HTTP_COMPRESSION` | `OTELCPP_WITH_OTLP_HTTP_COMPRESSION` |
97+
| `WITH_OTLP_RETRY_PREVIEW` | `OTELCPP_WITH_OTLP_RETRY_PREVIEW` |
98+
| `WITH_OTLP_UTF8_VALIDITY` | `OTELCPP_WITH_OTLP_UTF8_VALIDITY` |
99+
| `WITH_PROMETHEUS` | `OTELCPP_WITH_PROMETHEUS` |
100+
| `WITH_RESOURCE_DETECTORS_PREVIEW` | `OTELCPP_WITH_RESOURCE_DETECTORS_PREVIEW` |
101+
| `WITH_STL` | `OTELCPP_WITH_STL` |
102+
| `WITH_THREAD_INSTRUMENTATION_PREVIEW` | `OTELCPP_WITH_THREAD_INSTRUMENTATION_PREVIEW` |
103+
| `WITH_ZIPKIN` | `OTELCPP_WITH_ZIPKIN` |
104+
105+
`BUILD_TESTING` is not listed because it is a standard CMake variable, not a
106+
deprecated alias. When opentelemetry-cpp is the top-level project,
107+
`BUILD_TESTING` provides the default for `OTELCPP_BUILD_TESTING`. Set
108+
`OTELCPP_BUILD_TESTING` explicitly to control opentelemetry-cpp tests.
109+
110+
#### Mitigation (legacy CMake option names)
111+
112+
Update CMake command lines, presets, build scripts, and CI configurations to
113+
use the replacement names. The legacy names are still accepted during the
114+
deprecation period and produce a deprecation warning at configure time. When
115+
both names are set, the `OTELCPP_` name takes precedence.
116+
117+
#### Planned removal (legacy CMake option names)
118+
119+
The legacy CMake option names will be removed in a future release. The
120+
replacement names are not affected by this removal.
121+
122+
### CMake OTELCPP_WITH_OTLP_RETRY_PREVIEW
123+
124+
#### Announcement (OTELCPP_WITH_OTLP_RETRY_PREVIEW)
125+
126+
The CMake compile flag `OTELCPP_WITH_OTLP_RETRY_PREVIEW`, formerly named
127+
`WITH_OTLP_RETRY_PREVIEW`, is deprecated by:
50128

51129
* Enable WITH_OTLP_RETRY_PREVIEW by default
52130
[#3953](https://github.com/open-telemetry/opentelemetry-cpp/pull/3953)
53131

54-
#### Motivation (WITH_OTLP_RETRY_PREVIEW)
132+
#### Motivation (OTELCPP_WITH_OTLP_RETRY_PREVIEW)
55133

56-
Flags like `WITH_OTLP_RETRY_PREVIEW` are used to conditionally compile
57-
new features, when they are introduced in the code base.
134+
Flags like `OTELCPP_WITH_OTLP_RETRY_PREVIEW` are used to conditionally compile
135+
new features when they are introduced in the code base.
58136

59137
Now that this feature is stable, conditional compilation is no longer
60138
necessary.
61139

62-
#### Scope (WITH_OTLP_RETRY_PREVIEW)
140+
#### Scope (OTELCPP_WITH_OTLP_RETRY_PREVIEW)
63141

64-
Remove compilation flag WITH_OTLP_RETRY_PREVIEW in CMake.
142+
Remove the `OTELCPP_WITH_OTLP_RETRY_PREVIEW` compilation flag and its legacy
143+
name `WITH_OTLP_RETRY_PREVIEW` from CMake.
65144

66-
Remove ifdef ENABLE_OTLP_RETRY_PREVIEW in C++ .
145+
Remove the `ENABLE_OTLP_RETRY_PREVIEW` preprocessor condition from C++.
67146

68-
#### Mitigation (WITH_OTLP_RETRY_PREVIEW)
147+
#### Mitigation (OTELCPP_WITH_OTLP_RETRY_PREVIEW)
69148

70-
Applications built with `WITH_OTLP_RETRY_PREVIEW=ON` need to:
149+
Applications built with `OTELCPP_WITH_OTLP_RETRY_PREVIEW=ON` or
150+
`WITH_OTLP_RETRY_PREVIEW=ON` need to:
71151

72-
* remove the WITH_OTLP_RETRY_PREVIEW flag from CMake scripts
152+
* remove the preview flag from CMake scripts
73153

74-
Applications built with `WITH_OTLP_RETRY_PREVIEW=OFF` need to:
154+
Applications built with `OTELCPP_WITH_OTLP_RETRY_PREVIEW=OFF` or
155+
`WITH_OTLP_RETRY_PREVIEW=OFF` need to:
75156

76-
* remove the WITH_OTLP_RETRY_PREVIEW flag from CMake scripts
157+
* remove the preview flag from CMake scripts
77158
* use `retry_policy_max_attempts` = 0 in the OTLP exporter options.
78159

79160
For Bazel, no compilation option exists,
@@ -82,42 +163,46 @@ the bazel build enables unconditionally ENABLE_OTLP_RETRY_PREVIEW.
82163
Make sure to properly initialize `retry_policy_max_attempts`
83164
to enable or disable the retry feature.
84165

85-
#### Planned removal (WITH_OTLP_RETRY_PREVIEW)
166+
#### Planned removal (OTELCPP_WITH_OTLP_RETRY_PREVIEW)
86167

87168
This compilation flag will be removed after October 1st, 2026.
88169

89-
### CMake WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
170+
### CMake OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
90171

91-
#### Announcement (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
172+
#### Announcement (OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
92173

93-
The CMake compile flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW is deprecated by:
174+
The CMake compile flag `OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW`, formerly
175+
named `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW`, is deprecated by:
94176

95177
* Enable WITH_OTLP_GRPC_SSL_MTLS_PREVIEW by default
96178
[#3970](https://github.com/open-telemetry/opentelemetry-cpp/pull/3970)
97179

98-
#### Motivation (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
180+
#### Motivation (OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
99181

100-
Flags like `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` are used to conditionally compile
101-
new features, when they are introduced in the code base.
182+
Flags like `OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` are used to conditionally
183+
compile new features when they are introduced in the code base.
102184

103185
Now that this feature is stable, conditional compilation is no longer
104186
necessary.
105187

106-
#### Scope (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
188+
#### Scope (OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
107189

108-
Remove compilation flag WITH_OTLP_GRPC_SSL_MTLS_PREVIEW in CMake.
190+
Remove the `OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` compilation flag and its
191+
legacy name `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW` from CMake.
109192

110-
Remove ifdef ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW in C++ .
193+
Remove the `ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW` preprocessor condition from C++.
111194

112-
#### Mitigation (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
195+
#### Mitigation (OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
113196

114-
Applications built with `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON` need to:
197+
Applications built with `OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON` or
198+
`WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=ON` need to:
115199

116-
* remove the WITH_OTLP_GRPC_SSL_MTLS_PREVIEW flag from CMake scripts
200+
* remove the preview flag from CMake scripts
117201

118-
Applications built with `WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF` need to:
202+
Applications built with `OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF` or
203+
`WITH_OTLP_GRPC_SSL_MTLS_PREVIEW=OFF` need to:
119204

120-
* remove the WITH_OTLP_GRPC_SSL_MTLS_PREVIEW flag from CMake scripts
205+
* remove the preview flag from CMake scripts
121206
* initialize ssl client properties in the OTLP GRPC exporter options,
122207
either with real KEY and CERT data, or with empty strings.
123208

@@ -134,7 +219,7 @@ ENABLE_OTLP_GRPC_SSL_MTLS_PREVIEW.
134219
Make sure to properly initialize ssl client properties
135220
to enable or disable the feature.
136221

137-
#### Planned removal (WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
222+
#### Planned removal (OTELCPP_WITH_OTLP_GRPC_SSL_MTLS_PREVIEW)
138223

139224
This compilation flag will be removed after October 1st, 2026.
140225

0 commit comments

Comments
 (0)