Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/clang-tidy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ jobs:
matrix:
include:
- cmake_options: all-options-abiv1-preview
warning_limit: 73
warning_limit: 63
- cmake_options: all-options-abiv2-preview
warning_limit: 76
warning_limit: 66
env:
CC: /usr/bin/clang-22
CXX: /usr/bin/clang++-22
Expand Down
41 changes: 31 additions & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,9 @@ Increment the:
conversion. No API or ABI change.
[#4347](https://github.com/open-telemetry/opentelemetry-cpp/issues/4347)

Breaking changes:
* [CODE HEALTH] Fix bugprone-exception-escape in NoopTracer::StartSpan()
[#4673](https://github.com/open-telemetry/opentelemetry-cpp/pull/4673)

* [SDK] Remove `noexcept` from the public SDK `TracerProvider`,
`LoggerProvider`, `MeterProvider`, `Tracer`, `Logger`, and `Meter`
constructors so initialization failures can propagate to callers.
`GetTracer`, `GetLogger`, and `GetMeter` remain `noexcept` and return a
pre-allocated noop object if constructing a new instrumentation object
fails. After the first failure, later uncached `Get*` calls return the same
noop immediately without retrying construction. Existing cached objects
continue to be returned.
[#4361](https://github.com/open-telemetry/opentelemetry-cpp/issues/4361)
* [BUG] Send one request per curl session, rather than replacing the operation
a running request still belongs to
[#4396](https://github.com/open-telemetry/opentelemetry-cpp/issues/4396)
Expand All @@ -95,6 +87,7 @@ Breaking changes:

* [BUG] Do not queue a curl session closed by the Retry-After cap
[#4632](https://github.com/open-telemetry/opentelemetry-cpp/pull/4632)

* [BUG] Fix a data race on the curl operation's last result code
[#4618](https://github.com/open-telemetry/opentelemetry-cpp/pull/4618)

Expand All @@ -114,14 +107,42 @@ Breaking changes:
* [BUG] Keep the curl retry deadline stable within each attempt
[#4452](https://github.com/open-telemetry/opentelemetry-cpp/pull/4452)

Breaking changes:

* [SDK] Handle instrumentation object construction failures safely
[#4469](https://github.com/open-telemetry/opentelemetry-cpp/pull/4469)
* Removed `noexcept` from the public SDK `TracerProvider`,
`LoggerProvider`, `MeterProvider`, `Tracer`, `Logger`, and `Meter`
constructors so initialization failures can propagate to callers.
* `GetTracer`, `GetLogger`, and `GetMeter` remain `noexcept` and return a
pre-allocated noop object if constructing a new instrumentation object
fails.
* After the first failure, later uncached `Get*` calls return the same
noop immediately without retrying construction. Existing cached objects
continue to be returned.

* [REMOVAL] Remove WITH_OTLP_RETRY_PREVIEW - #4668
[#4668](https://github.com/open-telemetry/opentelemetry-cpp/pull/4668)
* CMake flags WITH_OTLP_RETRY_PREVIEW is removed,
the feature is no longer in preview status.

* [API] Remove opentelemetry::plugin
[#4660](https://github.com/open-telemetry/opentelemetry-cpp/pull/4660)
* The unused opentelemetry::plugin framework is removed.

* [REMOVAL] Remove WITH_OTLP_GRPC_SSL_MTLS_PREVIEW
[#4666](https://github.com/open-telemetry/opentelemetry-cpp/pull/4666)
* CMake flags WITH_OTLP_GRPC_SSL_MTLS_PREVIEW is removed,
the feature is no longer in preview status.

* [CODE HEALTH] Fix bugprone-exception-escape in NoopTracer::StartSpan()
[#4673](https://github.com/open-telemetry/opentelemetry-cpp/pull/4673)
* The NoopSpan class in the API has changed.
* For applications only instrumenting code, this has no impact,
as this class is not used for instrumentation.
* For applications implementing a custom trace exporter,
the exporter implementation needs to be adjusted,
when using the NoopSpan.

## [1.29.0] 2026-09-13

Expand Down
25 changes: 9 additions & 16 deletions api/include/opentelemetry/trace/noop.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ namespace trace
class OPENTELEMETRY_EXPORT NoopSpan final : public Span
Comment thread
marcalff marked this conversation as resolved.
{
public:
explicit NoopSpan(const std::shared_ptr<Tracer> &tracer) noexcept
Comment thread
marcalff marked this conversation as resolved.
: tracer_{tracer}, span_context_{new SpanContext(false, false)}
{}
explicit NoopSpan() : span_context_{new SpanContext(false, false)} {}

explicit NoopSpan(const std::shared_ptr<Tracer> &tracer,
nostd::unique_ptr<SpanContext> span_context) noexcept
: tracer_{tracer}, span_context_{std::move(span_context)}
explicit NoopSpan(nostd::unique_ptr<SpanContext> span_context)
: span_context_{std::move(span_context)}
{}

void SetAttribute(nostd::string_view /*key*/,
Expand Down Expand Up @@ -84,7 +81,6 @@ class OPENTELEMETRY_EXPORT NoopSpan final : public Span
SpanContext GetContext() const noexcept override { return *span_context_.get(); }

private:
std::shared_ptr<Tracer> tracer_;
nostd::unique_ptr<SpanContext> span_context_;
};

Expand All @@ -96,7 +92,7 @@ class OPENTELEMETRY_EXPORT NoopTracer final : public Tracer,
{
public:
// Tracer
NoopTracer()
NoopTracer() : noop_span_(new trace::NoopSpan())
{
#if OPENTELEMETRY_ABI_VERSION_NO >= 2
UpdateEnabled(false);
Expand All @@ -108,11 +104,7 @@ class OPENTELEMETRY_EXPORT NoopTracer final : public Tracer,
const SpanContextKeyValueIterable & /*links*/,
const StartSpanOptions & /*options*/) noexcept override
{
// Don't allocate a no-op span for every StartSpan call, but use a static
// singleton for this case.
static nostd::shared_ptr<trace::Span> noop_span(new trace::NoopSpan{this->shared_from_this()});

return noop_span;
return noop_span_;
}

#if OPENTELEMETRY_ABI_VERSION_NO == 1
Expand All @@ -122,6 +114,9 @@ class OPENTELEMETRY_EXPORT NoopTracer final : public Tracer,
void CloseWithMicroseconds(uint64_t /*timeout*/) noexcept override {}

#endif /* OPENTELEMETRY_ABI_VERSION_NO */

private:
std::shared_ptr<trace::Span> noop_span_;
};

/**
Expand All @@ -130,9 +125,7 @@ class OPENTELEMETRY_EXPORT NoopTracer final : public Tracer,
class OPENTELEMETRY_EXPORT NoopTracerProvider final : public trace::TracerProvider
{
public:
NoopTracerProvider() noexcept
: tracer_{nostd::shared_ptr<trace::NoopTracer>(new trace::NoopTracer)}
{}
NoopTracerProvider() : tracer_{nostd::shared_ptr<trace::NoopTracer>(new trace::NoopTracer)} {}

#if OPENTELEMETRY_ABI_VERSION_NO >= 2
nostd::shared_ptr<trace::Tracer> GetTracer(
Expand Down
4 changes: 1 addition & 3 deletions api/test/trace/noop_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ TEST(NoopTest, CreateSpanValidSpanContext)
auto span_id = trace_api::SpanId{buf_span};
auto span_context = nonstd::unique_ptr<trace_api::SpanContext>(
new trace_api::SpanContext{trace_id, span_id, trace_api::TraceFlags{true}, false});
std::shared_ptr<trace_api::Tracer> tracer{new trace_api::NoopTracer{}};
auto s1 =
nonstd::shared_ptr<trace_api::Span>(new trace_api::NoopSpan(tracer, std::move(span_context)));
auto s1 = nonstd::shared_ptr<trace_api::Span>(new trace_api::NoopSpan(std::move(span_context)));
auto stored_span_context = s1->GetContext();
EXPECT_EQ(stored_span_context.span_id(), span_id);
EXPECT_EQ(stored_span_context.trace_id(), trace_id);
Expand Down
6 changes: 3 additions & 3 deletions api/test/trace/scope_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace context = opentelemetry::context;

TEST(ScopeTest, Construct)
{
nostd::shared_ptr<Span> span(new NoopSpan(nullptr));
nostd::shared_ptr<Span> span(new NoopSpan());
Scope scope(span);

context::ContextValue active_span_value = context::RuntimeContext::GetValue(kSpanKey);
Expand All @@ -34,11 +34,11 @@ TEST(ScopeTest, Construct)

TEST(ScopeTest, Destruct)
{
nostd::shared_ptr<Span> span(new NoopSpan(nullptr));
nostd::shared_ptr<Span> span(new NoopSpan());
Scope scope(span);

{
nostd::shared_ptr<Span> span_nested(new NoopSpan(nullptr));
nostd::shared_ptr<Span> span_nested(new NoopSpan());
Scope scope_nested(span_nested);

context::ContextValue active_span_value = context::RuntimeContext::GetValue(kSpanKey);
Expand Down
4 changes: 2 additions & 2 deletions api/test/trace/tracer_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ namespace nostd = opentelemetry::nostd;
TEST(TracerTest, GetCurrentSpan)
{
std::unique_ptr<trace_api::Tracer> tracer(new trace_api::NoopTracer());
nostd::shared_ptr<trace_api::Span> span_first(new trace_api::NoopSpan(nullptr));
nostd::shared_ptr<trace_api::Span> span_second(new trace_api::NoopSpan(nullptr));
nostd::shared_ptr<trace_api::Span> span_first(new trace_api::NoopSpan());
nostd::shared_ptr<trace_api::Span> span_second(new trace_api::NoopSpan());

auto current = tracer->GetCurrentSpan();
ASSERT_FALSE(current->GetContext().IsValid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,7 @@ class Tracer : public opentelemetry::trace::Tracer,
if (sampling_result.decision == sdk::trace::Decision::DROP)
{
auto noopSpan = nostd::shared_ptr<opentelemetry::trace::Span>{
new (std::nothrow)
opentelemetry::trace::NoopSpan(this->shared_from_this(), std::move(spanContext))};
new (std::nothrow) opentelemetry::trace::NoopSpan(std::move(spanContext))};
return noopSpan;
}

Expand Down
Loading