Skip to content

Commit 91e7d59

Browse files
authored
Merge branch 'main' into probability-sampler
2 parents 6f3250b + a56f0e2 commit 91e7d59

53 files changed

Lines changed: 1028 additions & 762 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
with:
2222
submodules: 'recursive'
2323
- name: Mount Bazel Cache
24-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
24+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
2525
env:
2626
cache-name: bazel_cache
2727
with:

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
runs-on: ubuntu-24.04
5959
env:
6060
CXX_STANDARD: '17'
61-
CMAKE_VERSION: '3.16.0'
61+
CMAKE_VERSION: '3.18.0' # CMake version 3.18+ is required by curl 8.21.0+
6262
BUILD_TYPE: 'Release'
6363
steps:
6464
- name: Harden the runner (Audit all outbound calls)
@@ -760,7 +760,7 @@ jobs:
760760
with:
761761
submodules: 'recursive'
762762
- name: Mount Bazel Cache
763-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
763+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
764764
env:
765765
cache-name: bazel_cache
766766
with:
@@ -786,7 +786,7 @@ jobs:
786786
with:
787787
submodules: 'recursive'
788788
- name: Mount Bazel Cache
789-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
789+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
790790
env:
791791
cache-name: bazel_cache
792792
with:
@@ -812,7 +812,7 @@ jobs:
812812
with:
813813
submodules: 'recursive'
814814
- name: Mount Bazel Cache
815-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
815+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
816816
env:
817817
cache-name: bazel_cache
818818
with:
@@ -838,7 +838,7 @@ jobs:
838838
with:
839839
submodules: 'recursive'
840840
- name: Mount Bazel Cache
841-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
841+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
842842
env:
843843
cache-name: bazel_cache
844844
with:
@@ -864,7 +864,7 @@ jobs:
864864
with:
865865
submodules: 'recursive'
866866
- name: Mount Bazel Cache
867-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
867+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
868868
env:
869869
cache-name: bazel_cache
870870
with:
@@ -890,7 +890,7 @@ jobs:
890890
with:
891891
submodules: 'recursive'
892892
- name: Mount Bazel Cache
893-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
893+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
894894
env:
895895
cache-name: bazel_cache
896896
with:
@@ -916,7 +916,7 @@ jobs:
916916
with:
917917
submodules: 'recursive'
918918
- name: Mount Bazel Cache
919-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
919+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
920920
env:
921921
cache-name: bazel_cache
922922
with:
@@ -942,7 +942,7 @@ jobs:
942942
with:
943943
submodules: 'recursive'
944944
- name: Mount Bazel Cache
945-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
945+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
946946
env:
947947
cache-name: bazel_cache
948948
with:
@@ -973,7 +973,7 @@ jobs:
973973
run: |
974974
./ci/setup_cmake_macos.sh
975975
- name: Mount Bazel Cache
976-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
976+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
977977
env:
978978
cache-name: bazel_cache
979979
with:
@@ -995,7 +995,7 @@ jobs:
995995
with:
996996
submodules: 'recursive'
997997
- name: Mount Bazel Cache
998-
uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
998+
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
999999
env:
10001000
cache-name: bazel_cache
10011001
with:

.github/workflows/clang-tidy.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ jobs:
1717
matrix:
1818
include:
1919
- cmake_options: all-options-abiv1-preview
20-
warning_limit: 331
20+
warning_limit: 328
2121
- cmake_options: all-options-abiv2-preview
22-
warning_limit: 341
22+
warning_limit: 338
2323
env:
2424
CC: /usr/bin/clang-22
2525
CXX: /usr/bin/clang++-22

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ Increment the:
6161
LoggerConfig declarative configuration
6262
[#4131](https://github.com/open-telemetry/opentelemetry-cpp/pull/4131)
6363

64+
* [CODE HEALTH] Fix clang-tidy bugprone-exception-escape in ostream exporters
65+
[#4137](https://github.com/open-telemetry/opentelemetry-cpp/pull/4137)
66+
6467
* [API] (ABI v2) `Logger::EmitLogRecord(...)` templates now apply the
6568
`Enabled` filter chain when a `Severity` is in args. v1 behavior is
6669
unchanged.
@@ -113,6 +116,9 @@ Increment the:
113116
* [EXPORTER] Handle OTLP partial success response
114117
[#4104](https://github.com/open-telemetry/opentelemetry-cpp/pull/4104)
115118

119+
* [CONFIGURATION] Apply default sampler when none is specified
120+
[#4170](https://github.com/open-telemetry/opentelemetry-cpp/pull/4170)
121+
116122
## [1.27.0] 2026-05-13
117123

118124
* [RELEASE] Bump main branch to 1.27.0-dev

INSTALL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ You can link OpenTelemetry C++ SDK with libraries provided in
2323
repository. To install Git, consult the [Set up
2424
Git](https://help.github.com/articles/set-up-git/) guide on GitHub.
2525
- [CMake](https://cmake.org/) for building opentelemetry-cpp API, SDK with their
26-
unittests. The minimum CMake version is 3.16.
26+
unittests. The minimum CMake version is 3.16 (3.18+ is recommended to support
27+
FetchContent with the latest dependencies).
2728
To install CMake,
2829
consult the [Installing CMake](https://cmake.org/install/) guide.
2930
- [GoogleTest](https://github.com/google/googletest) framework to build and run

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ For more information about the maintainer role, see the [community repository](h
116116

117117
### Approvers
118118

119-
* [WenTao Ou](https://github.com/owent), Tencent
119+
* [WenTao Ou](https://github.com/owent)
120120

121121
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
122122

docs/abi-policy.md

Lines changed: 151 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
11
# Application Binary Interface (ABI) Policy
22

3-
To support scenarios where OpenTelemetry implementations are deployed as binary
4-
plugins, certain restrictions are imposed on portions of the OpenTelemetry API.
3+
To support scenarios where opentelemetry-cpp is included in multiple libraries
4+
that are combined into a single application (for example as binary plugins, or
5+
as independently instrumented libraries), certain restrictions are imposed on
6+
portions of the OpenTelemetry API to ensure ABI stability and predictable
7+
behavior. See [library distribution](./library-distribution.md) for how
8+
components control their exported symbols in that scenario.
59

610
Many parts of the C++ standard library don't have well-defined ABIs. To ensure
7-
that a plugin compiled against one version of the C++ standard library can work
8-
with an application or library compiled against a different version of the C++
9-
standard library, we limit a portion of the OpenTelemetry API to use ABI stable
10-
types.
11+
that a component compiled against one version of the C++ standard library can
12+
work with an application or library compiled against a different version of the
13+
C++ standard library, we limit a portion of the OpenTelemetry API to use ABI
14+
stable `nostd::` types by default. The `OPENTELEMETRY_STL_VERSION` preprocessor macro
15+
(defined by the CMake `WITH_STL` build option) can be set to replace
16+
these ABI stable types with their `std::` equivalents (see [building with the
17+
standard C++ library](./building-with-stdlib.md) for when this is appropriate).
1118

1219
In the areas of the API where we need ABI stability, we use C++ as an extended
1320
C. We assume that standard language features like inheritance follow a
@@ -16,16 +23,43 @@ ABI](https://itanium-cxx-abi.github.io/cxx-abi/abi.html#vtable)) and can be used
1623
across compilers, but don't rely on the ABI stability of the C++ standard
1724
library classes.
1825

19-
ABI stability is not provided by the interfaces the SDK provides as
20-
implementation hooks to vendor implementors, like exporters, processors,
21-
aggregators and propagators.
26+
ABI stability is provided for the OTel API and is not required for
27+
OTel SDK-provided interfaces (e.g., resource detectors, exporters, processors, samplers).
2228

23-
These are some of the rules for where ABI stability is required.
29+
Within a stable ABI version, non-breaking additive changes may be accepted, for example:
2430

25-
Note: This assumes export maps are used to properly control symbol resolution.
31+
- add new non-virtual member functions to an existing API class
32+
- add new overloads of an existing non-virtual function
33+
- add new types
34+
- append new values to an enum
2635

27-
1. Abstract classes in the OpenTelemetry API must use ABI stable types in their
28-
virtual function signatures. Example
36+
The following changes are considered breaking and must target an
37+
experimental ABI version:
38+
39+
- use of non-ABI-stable types in virtual function signatures or
40+
singletons of an API class
41+
- change the order, add, remove, or modify the signature of virtual
42+
functions on an API class
43+
- change the memory layout of a type that crosses the ABI boundary
44+
- change the definition or observable behavior of an inline function,
45+
template, or `inline`/`constexpr` variable in an API header
46+
47+
The following sections describe common cases where ABI stability is broken
48+
and provide examples of how to apply breaking changes.
49+
50+
For the ABI-stable OTel API, breaking changes must target the
51+
experimental ABI version, guarded by the `OPENTELEMETRY_ABI_VERSION_NO`
52+
preprocessor macro (shown by the `#if
53+
OPENTELEMETRY_ABI_VERSION_NO >= 2` guards in the examples). See the [ABI version
54+
policy](./abi-version-policy.md) for which ABI versions are stable versus
55+
experimental.
56+
57+
## Virtual function signatures
58+
59+
Abstract classes in the OpenTelemetry API must use ABI stable types in their
60+
virtual function signatures.
61+
62+
Example:
2963

3064
```cpp
3165
class Tracer {
@@ -58,3 +92,107 @@ private:
5892
Singletons defined by the OpenTelemetry API must use ABI stable types since they
5993
could potentially be shared across multiple instrumented dynamic shared objects
6094
(DSOs) compiled against different versions of the C++ standard library.
95+
96+
## Virtual function tables
97+
98+
The set, order, and signatures of virtual functions
99+
on an existing API class must not change within a stable ABI version. Doing so
100+
alters the vtable layout and breaks
101+
binary compatibility for callers built against the previous layout. New or
102+
changed virtual functions must instead be introduced in an experimental ABI
103+
version.
104+
105+
Example:
106+
107+
```cpp
108+
class Logger {
109+
public:
110+
virtual ~Logger() = default;
111+
112+
#if OPENTELEMETRY_ABI_VERSION_NO >= 2
113+
// OK: adding a new virtual method under the experimental ABI guard, so the stable ABI (v1) vtable layout is unchanged.
114+
virtual void NewVirtualMethod() noexcept {}
115+
#endif
116+
};
117+
```
118+
119+
## Memory layout
120+
121+
Within a stable ABI version, the memory layout of any type that crosses the ABI
122+
boundary must not change.
123+
124+
This applies to the abstract API classes, the ABI stable value types (such as
125+
`nostd::string_view` and `nostd::span`), and singletons. Any change that alters
126+
layout, such as the order, type, or alignment of non-static data members, or the
127+
set and order of base classes, must be delivered in an experimental ABI version.
128+
The same applies to enumerations: do not change the underlying type or renumber
129+
existing enumerators.
130+
131+
Example:
132+
133+
```cpp
134+
class Logger
135+
{
136+
public:
137+
// OK: adding a non-virtual method does not change the memory layout.
138+
bool NewMethod() const noexcept;
139+
140+
private:
141+
142+
#if OPENTELEMETRY_ABI_VERSION_NO >= 2
143+
// OK: new data member added only under the experimental ABI guard.
144+
bool new_member_{};
145+
#endif
146+
};
147+
```
148+
149+
## Definitions in API headers
150+
151+
Entities defined in ABI-stable API headers (inline functions, templates, and
152+
`inline`/`constexpr` variables) must not change their definition or observable
153+
behavior within a stable ABI version.
154+
155+
A single application may link multiple independently built libraries that were
156+
compiled against different opentelemetry-cpp API header versions, or with
157+
different API-level compiler definitions. Each carries its own definition of
158+
these inline entities. The C++ [One Definition
159+
Rule](https://en.cppreference.com/w/cpp/language/definition#One_Definition_Rule)
160+
requires every definition to be identical. If they differ, the linker silently
161+
keeps one unspecified definition. A library can then run a definition it was not
162+
built against, producing unexpected behavior.
163+
164+
Any change to API headers that impacts observable behavior must instead be
165+
delivered in an experimental ABI version. Critical correctness or security fixes
166+
may be exceptions. All such changes must be noted in
167+
`CHANGELOG.md`.
168+
169+
Example:
170+
171+
`Logger::EmitLogRecord(args...)` applies the severity filter on log
172+
records (and may drop the record). This is an observable behavior change and
173+
only allowed under the experimental ABI (v2).
174+
175+
```cpp
176+
class Logger
177+
{
178+
public:
179+
template <class... ArgumentType>
180+
void EmitLogRecord(ArgumentType &&...args)
181+
{
182+
#if OPENTELEMETRY_ABI_VERSION_NO >= 2
183+
// Behavior change added to the experimental ABI
184+
const Severity arg_severity = detail::FindSeverityInArgs(args...);
185+
if (arg_severity != Severity::kInvalid && !Enabled(arg_severity))
186+
{
187+
return;
188+
}
189+
nostd::unique_ptr<LogRecord> log_record = CreateLogRecord(/* context_or_span */);
190+
#else
191+
// Stable ABI behavior
192+
nostd::unique_ptr<LogRecord> log_record = CreateLogRecord();
193+
#endif
194+
195+
...
196+
}
197+
};
198+
```

docs/abi-version-policy.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,29 +285,36 @@ This status is meant as a preview, until the ABI is declared STABLE.
285285

286286
In the STABLE status,
287287
changes to the ABI are forbidden, to guarantee stability.
288+
See the [ABI policy](./abi-policy.md) for the types of non-breaking
289+
changes that may be allowed within a
290+
stable ABI version and those that must target an experimental ABI
291+
version.
288292

289293
In the DEPRECATED status, the ABI is still functional and supported,
290294
but instrumented applications are encouraged to migrate to a newer ABI.
291295

292296
In the REMOVED status,
293297
the given ABI is no longer available.
294298

299+
The build files are the source of truth for which ABI version is currently
300+
experimental versus stable. In CMake, the experimental version is the
301+
`WITH_ABI_VERSION_*` option labeled `EXPERIMENTAL` in `CMakeLists.txt`, and it
302+
is off by default; any version without that label is stable.
303+
295304
The following sections describe the migration path from one ABI (v1) to the
296305
next (v2).
297306

298307
### STABLE V1
299308

300309
In this state, only one ABI version is available, and it is closed to
301-
changes.
310+
breaking changes.
302311

303312
Instrumented applications are built against ABI v1 by default.
304313

305314
opentelemetry-cpp produces a library for ABI v1 by default.
306315

307316
Fixes introducing breaking changes can __not__ be delivered.
308317

309-
This is the current status as of opentelemetry-cpp version 1.11.0
310-
311318
### STABLE V1, EXPERIMENTAL V2
312319

313320
In this state, two ABI versions are available.

0 commit comments

Comments
 (0)