Skip to content

Commit d83a20f

Browse files
Merge upstream/main into probability-sampler
Resolve CHANGELOG.md conflicts by keeping upstream entries and the ProbabilitySampler changelog line. Co-authored-by: Cursor <cursoragent@cursor.com>
2 parents 1815c46 + 6c97595 commit d83a20f

62 files changed

Lines changed: 1674 additions & 134 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/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,28 @@ jobs:
5353
run: |
5454
./ci/do_ci.sh cmake.test
5555
56+
cmake_api_only_test:
57+
name: CMake API only test
58+
runs-on: ubuntu-24.04
59+
env:
60+
CXX_STANDARD: '17'
61+
steps:
62+
- name: Harden the runner (Audit all outbound calls)
63+
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
64+
with:
65+
egress-policy: audit
66+
67+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
68+
with:
69+
submodules: 'recursive'
70+
- name: setup
71+
run: |
72+
sudo -E ./ci/setup_ci_environment.sh
73+
sudo -E apt-get install -y zlib1g-dev
74+
- name: run cmake API only test
75+
run: |
76+
./ci/do_ci.sh cmake.api_only.test
77+
5678
cmake_fetch_content_test:
5779
name: CMake FetchContent usage with opentelemetry-cpp
5880
runs-on: ubuntu-24.04

.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: 328
20+
warning_limit: 309
2121
- cmake_options: all-options-abiv2-preview
22-
warning_limit: 338
22+
warning_limit: 319
2323
env:
2424
CC: /usr/bin/clang-22
2525
CXX: /usr/bin/clang++-22

.github/workflows/dependencies_image.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ jobs:
2222
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
2323
-
2424
name: Set up QEMU
25-
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
25+
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
2626
-
2727
name: Set up Docker Buildx
2828
id: buildx
2929
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
3030
-
3131
name: Build Image
32-
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
32+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
3333
with:
3434
builder: ${{ steps.buildx.outputs.name }}
3535
context: ci/

CHANGELOG.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Increment the:
1515

1616
## [Unreleased]
1717

18+
* [CMAKE] Fix and test WITH_API_ONLY option
19+
[#4201](https://github.com/open-telemetry/opentelemetry-cpp/pull/4201)
20+
1821
* [API] Fix `TraceState::IsValidKey()` to comply with the W3C Trace Context
1922
Level 2, where keys containing `@` and keys with more than 241 characters
2023
before `@` or more than 14 characters after `@` are now accepted.
@@ -25,7 +28,7 @@ Increment the:
2528
[#4194](https://github.com/open-telemetry/opentelemetry-cpp/pull/4194)
2629

2730
* [SDK] Add `TracerProvider::UpdateTracerConfigurator()` and example
28-
[#4065](https://github.com/open-telemetry/opentelemetry-cpp/issues/4065)
31+
[#4065](https://github.com/open-telemetry/opentelemetry-cpp/pull/4065)
2932

3033
* [RELEASE] Bump main branch to 1.28.0-dev
3134
[#4081](https://github.com/open-telemetry/opentelemetry-cpp/pull/4081)
@@ -102,17 +105,24 @@ Increment the:
102105
* [CI] iwyu and clang-tidy: use install_thirdparty.sh for third-party
103106
[#4136](https://github.com/open-telemetry/opentelemetry-cpp/pull/4136)
104107

108+
* [SDK] LogRecord attribute limits enforcement
109+
[#4157](https://github.com/open-telemetry/opentelemetry-cpp/pull/4157)
110+
105111
* [CONFIGURATION] File configuration: declarative resource detection types
106112
[#4148](https://github.com/open-telemetry/opentelemetry-cpp/pull/4148)
107113

108114
* [SDK] Per-instrument creation time as delta first-interval start_ts
109115
[#4144](https://github.com/open-telemetry/opentelemetry-cpp/pull/4144)
110116

111117
* [SDK] Add ComposableSampler and CompositeSampler with the consistent
112-
probability sampling variants (AlwaysOn, AlwaysOff, TraceIdRatioBased,
118+
probability sampling variants (AlwaysOn, AlwaysOff, ComposableProbability,
113119
ParentThreshold, RuleBased)
114120
[#4028](https://github.com/open-telemetry/opentelemetry-cpp/issues/4028)
115121

122+
* [SDK] Rename ComposableTraceIdRatioBasedSampler to ComposableProbabilitySampler
123+
to align with the OpenTelemetry specification
124+
[#4161](https://github.com/open-telemetry/opentelemetry-cpp/issues/4161)
125+
116126
* [SDK] Implement the ProbabilitySampler
117127
[#4135](https://github.com/open-telemetry/opentelemetry-cpp/pull/4135)
118128

@@ -128,6 +138,15 @@ Increment the:
128138
* [CONFIGURATION] Apply default sampler when none is specified
129139
[#4170](https://github.com/open-telemetry/opentelemetry-cpp/pull/4170)
130140

141+
* [CODE HEALTH] Move trace and baggage propagation test classes into anonymous namespace
142+
[#4199](https://github.com/open-telemetry/opentelemetry-cpp/pull/4199)
143+
144+
* [CODE HEALTH] Move context propagation test classes into anonymous namespace
145+
[#4200](https://github.com/open-telemetry/opentelemetry-cpp/pull/4200)
146+
147+
* [CODE HEALTH] Fix clang-tidy bugprone-unused-local-non-trivial-variable warnings
148+
[#4202](https://github.com/open-telemetry/opentelemetry-cpp/pull/4202)
149+
131150
## [1.27.0] 2026-05-13
132151

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

CMakeLists.txt

Lines changed: 40 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ if(WITH_GSL)
269269
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/ms-gsl.cmake")
270270
endif()
271271

272-
find_package(Threads)
272+
if(NOT WITH_API_ONLY)
273+
find_package(Threads)
274+
endif()
273275

274276
function(set_target_version target_name)
275277
if(OTELCPP_VERSIONED_LIBS)
@@ -306,21 +308,44 @@ cmake_dependent_option(
306308
"WITH_OTLP_HTTP OR WITH_ELASTICSEARCH OR WITH_ZIPKIN OR BUILD_W3CTRACECONTEXT_TEST OR WITH_EXAMPLES_HTTP"
307309
OFF)
308310

311+
#
312+
# Locally override options if WITH_API_ONLY is set to prevent third party
313+
# dependencies from being imported
314+
#
315+
316+
if(WITH_API_ONLY)
317+
set(WITH_EXAMPLES OFF)
318+
set(WITH_EXAMPLES_HTTP OFF)
319+
set(WITH_OTLP_GRPC OFF)
320+
set(WITH_OTLP_HTTP OFF)
321+
set(WITH_OTLP_FILE OFF)
322+
set(WITH_ZIPKIN OFF)
323+
set(WITH_PROMETHEUS OFF)
324+
set(WITH_ELASTICSEARCH OFF)
325+
set(WITH_OPENTRACING OFF)
326+
set(WITH_ETW OFF)
327+
set(WITH_CONFIGURATION OFF)
328+
set(WITH_HTTP_CLIENT_CURL OFF)
329+
set(WITH_OTLP_HTTP_COMPRESSION OFF)
330+
set(WITH_BENCHMARK OFF)
331+
set(WITH_FUNC_TESTS OFF)
332+
set(BUILD_TESTING OFF)
333+
set(BUILD_W3CTRACECONTEXT_TEST OFF)
334+
endif()
335+
309336
#
310337
# Do we need ZLIB ?
311338
#
312339

313-
if((NOT WITH_API_ONLY)
314-
AND WITH_HTTP_CLIENT_CURL
315-
AND WITH_OTLP_HTTP_COMPRESSION)
340+
if(WITH_HTTP_CLIENT_CURL AND WITH_OTLP_HTTP_COMPRESSION)
316341
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/zlib.cmake")
317342
endif()
318343

319344
#
320345
# Do we need CURL ?
321346
#
322347

323-
if((NOT WITH_API_ONLY) AND WITH_HTTP_CLIENT_CURL)
348+
if(WITH_HTTP_CLIENT_CURL)
324349
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/curl.cmake")
325350
endif()
326351

@@ -366,15 +391,15 @@ else()
366391
set(USE_NLOHMANN_JSON OFF)
367392
endif()
368393

369-
if((NOT WITH_API_ONLY) AND USE_NLOHMANN_JSON)
394+
if(USE_NLOHMANN_JSON)
370395
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/nlohmann-json.cmake")
371396
endif()
372397

373398
#
374399
# Do we need RapidYaml ?
375400
#
376401

377-
if((NOT WITH_API_ONLY) AND WITH_CONFIGURATION)
402+
if(WITH_CONFIGURATION)
378403
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/ryml.cmake")
379404
endif()
380405

@@ -640,11 +665,11 @@ endif()
640665

641666
add_subdirectory(api)
642667

643-
if(WITH_OPENTRACING)
644-
add_subdirectory(opentracing-shim)
645-
endif()
646-
647668
if(NOT WITH_API_ONLY)
669+
if(WITH_OPENTRACING)
670+
add_subdirectory(opentracing-shim)
671+
endif()
672+
648673
set(BUILD_TESTING ${BUILD_TESTING})
649674

650675
add_subdirectory(sdk)
@@ -663,11 +688,12 @@ if(NOT WITH_API_ONLY)
663688
if(WITH_FUNC_TESTS)
664689
add_subdirectory(functional)
665690
endif()
691+
692+
include(
693+
"${opentelemetry-cpp_SOURCE_DIR}/cmake/opentelemetry-build-external-component.cmake"
694+
)
666695
endif()
667696

668-
include(
669-
"${opentelemetry-cpp_SOURCE_DIR}/cmake/opentelemetry-build-external-component.cmake"
670-
)
671697
include("${opentelemetry-cpp_SOURCE_DIR}/cmake/patch-imported-config.cmake")
672698

673699
if(OPENTELEMETRY_INSTALL)

api/test/baggage/baggage_benchmark.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ void BM_BaggageToHeaderTenEntries(benchmark::State &state)
102102
auto baggage = Baggage::FromHeader(header_with_custom_entries(kNumEntries));
103103
while (state.KeepRunning())
104104
{
105-
auto new_baggage = baggage->ToHeader();
105+
benchmark::DoNotOptimize(baggage->ToHeader());
106106
}
107107
}
108108
BENCHMARK(BM_BaggageToHeaderTenEntries);
@@ -112,7 +112,7 @@ void BM_BaggageToHeader180Entries(benchmark::State &state)
112112
auto baggage = Baggage::FromHeader(header_with_custom_entries(Baggage::kMaxKeyValuePairs));
113113
while (state.KeepRunning())
114114
{
115-
auto new_baggage = baggage->ToHeader();
115+
benchmark::DoNotOptimize(baggage->ToHeader());
116116
}
117117
}
118118
BENCHMARK(BM_BaggageToHeader180Entries);

api/test/baggage/propagation/baggage_propagator_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
using namespace opentelemetry;
2121
using namespace opentelemetry::baggage::propagation;
2222

23+
namespace
24+
{
25+
2326
class BaggageCarrierTest : public context::propagation::TextMapCarrier
2427
{
2528
public:
@@ -120,3 +123,5 @@ TEST(BaggagePropagatorTest, InjectEmptyHeader)
120123
EXPECT_EQ(carrier.headers_.find(baggage::kBaggageHeader), carrier.headers_.end());
121124
}
122125
}
126+
127+
} // namespace

api/test/context/propagation/composite_propagator_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ static std::string Hex(const T &id_item)
3838
return std::string(buf, sizeof(buf));
3939
}
4040

41+
namespace
42+
{
43+
4144
class TextMapCarrierTest : public context::propagation::TextMapCarrier
4245
{
4346
public:
@@ -147,3 +150,5 @@ TEST_F(CompositePropagatorTest, Inject)
147150
EXPECT_EQ(fields[1], trace::propagation::kTraceState);
148151
EXPECT_EQ(fields[2], trace::propagation::kB3CombinedHeader);
149152
}
153+
154+
} // namespace

api/test/context/propagation/environment_carrier_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ static std::string Hex(const T &id_item)
5656
return std::string(buf, sizeof(buf));
5757
}
5858

59+
namespace
60+
{
61+
5962
class EnvironmentCarrierTest : public ::testing::Test
6063
{
6164
protected:
@@ -306,3 +309,5 @@ TEST_F(EnvironmentCarrierTest, RoundTrip)
306309
EXPECT_EQ(extracted_span->GetContext().IsSampled(), span_context.IsSampled());
307310
EXPECT_TRUE(extracted_span->GetContext().IsRemote());
308311
}
312+
313+
} // namespace

api/test/trace/propagation/b3_propagation_test.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
using namespace opentelemetry;
2929

30+
namespace
31+
{
32+
3033
class TextMapCarrierTest : public context::propagation::TextMapCarrier
3134
{
3235
public:
@@ -219,3 +222,5 @@ TEST(B3PropagationTest, GetCurrentSpanMultiHeader)
219222
EXPECT_EQ(carrier.headers_["X-B3-SpanId"], "0102030405060708");
220223
EXPECT_EQ(carrier.headers_["X-B3-Sampled"], "1");
221224
}
225+
226+
} // namespace

0 commit comments

Comments
 (0)