Skip to content

Commit 8a97277

Browse files
authored
[API] Deprecate opentelemetry::plugin (#4021)
1 parent d63ed0a commit 8a97277

12 files changed

Lines changed: 162 additions & 43 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -686,6 +686,8 @@ jobs:
686686
plugin_test:
687687
name: Plugin -> CMake
688688
runs-on: ubuntu-latest
689+
# Deprecated, pending removal
690+
if: false
689691
steps:
690692
- name: Harden the runner (Audit all outbound calls)
691693
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
@@ -1089,6 +1091,8 @@ jobs:
10891091
windows_plugin_test:
10901092
name: Plugin -> CMake Windows
10911093
runs-on: windows-2022
1094+
# Deprecated, pending removal
1095+
if: false
10921096
steps:
10931097
- name: Harden the runner (Audit all outbound calls)
10941098
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ Increment the:
8484
* [CODE HEALTH] Fix clang-tidy narrowing-conversions warnings in sync_instruments
8585
[#4013](https://github.com/open-telemetry/opentelemetry-cpp/pull/4013)
8686

87+
* [API] Deprecate opentelemetry::plugin
88+
[#4021](https://github.com/open-telemetry/opentelemetry-cpp/pull/4021)
89+
8790
Important changes:
8891

8992
* Enable WITH_OTLP_RETRY_PREVIEW by default
@@ -106,6 +109,12 @@ Important changes:
106109

107110
* Bazel now always builds with ENABLE_OTLP_RETRY_PREVIEW.
108111

112+
* [API] Deprecate opentelemetry::plugin
113+
[#4021](https://github.com/open-telemetry/opentelemetry-cpp/pull/4021)
114+
115+
* namespace opentelemetry::plugin is deprecated
116+
* See file DEPRECATED.md for details.
117+
109118
## [1.26.0] 2026-03-19
110119

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

DEPRECATED.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,52 @@ term, after ABI version 2 is declared stable.
222222
By the time only ABI version 2 is available and supported,
223223
any code still using the deprecated `EventLogger` will break.
224224

225+
### Deprecation of plugin
226+
227+
#### Announcement (plugin)
228+
229+
The `plugin` API was deprecated by:
230+
231+
* [API] Deprecate plugin
232+
[#4021](https://github.com/open-telemetry/opentelemetry-cpp/pull/4021)
233+
234+
on Apr 21, 2026.
235+
236+
#### Motivation (plugin)
237+
238+
All the code in namespace `opentelemetry::plugin` is a framework designed
239+
to help loading code from shared libraries.
240+
241+
This framework was never used.
242+
243+
Keeping the code in the repository has a maintenance cost
244+
(include-what-you-use, cpp-check, clang-tidy, CI),
245+
and also increases confusion.
246+
247+
This unused code is to be removed.
248+
249+
#### Scope (plugin)
250+
251+
The following files are to be removed from the API:
252+
253+
* `opentelemetry/plugin/*.h`
254+
* `opentelemetry/plugin/detail/*.h`
255+
256+
The following files are to be removed from examples:
257+
258+
* `examples/plugin/*`
259+
260+
#### Mitigation (plugin)
261+
262+
None.
263+
264+
This code is unused, there is no replacement.
265+
266+
#### Planned removal (plugin)
267+
268+
API header files under the `opentelemetry::plugin` namespace
269+
will be removed after October 1st, 2026.
270+
225271
## [opentelemetry-cpp SDK]
226272

227273
N/A

api/include/opentelemetry/plugin/dynamic_load.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,21 @@
1515
# include "opentelemetry/plugin/detail/dynamic_load_unix.h" // IWYU pragma: export
1616
#endif
1717

18+
// Always print a warning
19+
20+
#if defined(__clang__) || defined(__GNUC__)
21+
# pragma GCC warning "opentelemetry/plugin/ is deprecated, and will be removed. Do not use."
22+
#elif defined(_MSC_VER)
23+
# pragma message( \
24+
"[WARNING]: opentelemetry/plugin/ is deprecated, and will be removed. Do not use.")
25+
#endif
26+
27+
// And fail in deprecated-free builds
28+
29+
#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE
30+
# error "header <opentelemetry/plugin/> is deprecated."
31+
#endif
32+
1833
OPENTELEMETRY_BEGIN_NAMESPACE
1934
namespace plugin
2035
{

api/include/opentelemetry/plugin/factory.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@
1010
#include "opentelemetry/plugin/tracer.h"
1111
#include "opentelemetry/version.h"
1212

13+
// Always print a warning
14+
15+
#if defined(__clang__) || defined(__GNUC__)
16+
# pragma GCC warning "opentelemetry/plugin/ is deprecated, and will be removed. Do not use."
17+
#elif defined(_MSC_VER)
18+
# pragma message( \
19+
"[WARNING]: opentelemetry/plugin/ is deprecated, and will be removed. Do not use.")
20+
#endif
21+
22+
// And fail in deprecated-free builds
23+
24+
#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE
25+
# error "header <opentelemetry/plugin/> is deprecated."
26+
#endif
27+
1328
OPENTELEMETRY_BEGIN_NAMESPACE
1429
namespace plugin
1530
{

api/include/opentelemetry/plugin/hook.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@
3838

3939
#endif
4040

41+
// Always print a warning
42+
43+
#if defined(__clang__) || defined(__GNUC__)
44+
# pragma GCC warning "opentelemetry/plugin/ is deprecated, and will be removed. Do not use."
45+
#elif defined(_MSC_VER)
46+
# pragma message( \
47+
"[WARNING]: opentelemetry/plugin/ is deprecated, and will be removed. Do not use.")
48+
#endif
49+
50+
// And fail in deprecated-free builds
51+
52+
#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE
53+
# error "header <opentelemetry/plugin/> is deprecated."
54+
#endif
55+
4156
OPENTELEMETRY_BEGIN_NAMESPACE
4257
namespace plugin
4358
{

api/include/opentelemetry/plugin/tracer.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,21 @@
1111
#include "opentelemetry/trace/tracer.h"
1212
#include "opentelemetry/version.h"
1313

14+
// Always print a warning
15+
16+
#if defined(__clang__) || defined(__GNUC__)
17+
# pragma GCC warning "opentelemetry/plugin/ is deprecated, and will be removed. Do not use."
18+
#elif defined(_MSC_VER)
19+
# pragma message( \
20+
"[WARNING]: opentelemetry/plugin/ is deprecated, and will be removed. Do not use.")
21+
#endif
22+
23+
// And fail in deprecated-free builds
24+
25+
#ifdef OPENTELEMETRY_NO_DEPRECATED_CODE
26+
# error "header <opentelemetry/plugin/> is deprecated."
27+
#endif
28+
1429
OPENTELEMETRY_BEGIN_NAMESPACE
1530
namespace plugin
1631
{

api/test/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
add_subdirectory(core)
55
add_subdirectory(context)
6-
add_subdirectory(plugin)
6+
# deprecated: add_subdirectory(plugin)
77
add_subdirectory(nostd)
88
add_subdirectory(trace)
99
add_subdirectory(metrics)

api/test/plugin/BUILD

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33

44
load("@rules_cc//cc:cc_test.bzl", "cc_test")
55

6-
cc_test(
7-
name = "dynamic_load_test",
8-
srcs = [
9-
"dynamic_load_test.cc",
10-
],
11-
linkopts = [
12-
"-ldl",
13-
],
14-
tags = [
15-
"api",
16-
"test",
17-
],
18-
deps = [
19-
"//api",
20-
"@com_google_googletest//:gtest_main",
21-
],
22-
)
6+
# cc_test(
7+
# name = "dynamic_load_test",
8+
# srcs = [
9+
# "dynamic_load_test.cc",
10+
# ],
11+
# linkopts = [
12+
# "-ldl",
13+
# ],
14+
# tags = [
15+
# "api",
16+
# "test",
17+
# ],
18+
# deps = [
19+
# "//api",
20+
# "@com_google_googletest//:gtest_main",
21+
# ],
22+
# )

examples/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if(WITH_PROMETHEUS)
2121
add_subdirectory(prometheus)
2222
endif()
2323
add_subdirectory(logs_simple)
24-
add_subdirectory(plugin)
24+
# deprecated: add_subdirectory(plugin)
2525
add_subdirectory(simple)
2626
add_subdirectory(batch)
2727
add_subdirectory(metrics_simple)

0 commit comments

Comments
 (0)