diff --git a/.codecov.yml b/.codecov.yml index 3d9d2734e8..ff1b951cba 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -39,5 +39,7 @@ ignore: # Telemetry modules — conditionally compiled behind XRPL_ENABLE_TELEMETRY, # which is not enabled in coverage builds. - "src/xrpld/telemetry/" + - "src/libxrpl/telemetry/" + - "include/xrpl/telemetry/" - "src/libxrpl/beast/insight/OTelCollector.cpp" - "include/xrpl/beast/insight/OTelCollector.h" diff --git a/include/xrpl/telemetry/SpanGuard.h b/include/xrpl/telemetry/SpanGuard.h index fa96753bd8..4758602b74 100644 --- a/include/xrpl/telemetry/SpanGuard.h +++ b/include/xrpl/telemetry/SpanGuard.h @@ -248,11 +248,11 @@ public: */ #ifdef XRPL_ENABLE_TELEMETRY [[nodiscard]] bool - isValid() const; + isValid() const noexcept; #else // NOLINTBEGIN(readability-convert-member-functions-to-static) [[nodiscard]] bool - isValid() const + isValid() const noexcept { return false; } @@ -287,7 +287,7 @@ class SpanGuard struct Impl; std::unique_ptr impl_; - explicit SpanGuard(std::unique_ptr impl); + explicit SpanGuard(std::unique_ptr impl) noexcept; // ScopedSpanGuard wraps a SpanGuard and needs the raw span to build // its Scope; it reads impl_ directly so no OTel type leaks here. @@ -318,7 +318,7 @@ public: * @param name Span name suffix (e.g. "submit"). */ [[nodiscard]] static SpanGuard - span(TraceCategory cat, std::string_view prefix, std::string_view name); + span(TraceCategory cat, std::string_view prefix, std::string_view name) noexcept; /** * Create a span that always starts a fresh trace root. @@ -336,7 +336,7 @@ public: * @return An active root-span guard, or a null guard if disabled. */ [[nodiscard]] static SpanGuard - freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name); + freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name) noexcept; // --- Child / linked span creation ---------------------------------- @@ -358,7 +358,7 @@ public: * @return A new guard, or null if this guard is inactive. */ [[nodiscard]] SpanGuard - childSpan(std::string_view name) const; + childSpan(std::string_view name) const noexcept; /** * Create a child span parented to an explicit captured context. @@ -367,7 +367,7 @@ public: * @return A new guard, or null if parentCtx is invalid. */ [[nodiscard]] static SpanGuard - childSpan(std::string_view name, SpanContext const& parentCtx); + childSpan(std::string_view name, SpanContext const& parentCtx) noexcept; /** * Create a span linked (follows-from) to this guard's span. @@ -377,7 +377,7 @@ public: * @return A new guard, or null if this guard is inactive. */ [[nodiscard]] SpanGuard - linkedSpan(std::string_view name) const; + linkedSpan(std::string_view name) const noexcept; /** * Create a span linked to an explicit captured context. @@ -386,7 +386,7 @@ public: * @return A new guard, or null if linkCtx is invalid. */ [[nodiscard]] static SpanGuard - linkedSpan(std::string_view name, SpanContext const& linkCtx); + linkedSpan(std::string_view name, SpanContext const& linkCtx) noexcept; // --- Hash-derived span (category-gated) ----------------------------- @@ -448,7 +448,7 @@ public: * threadLocalContext() for that. */ [[nodiscard]] SpanContext - spanContext() const; + spanContext() const noexcept; /** * Snapshot the calling thread's CURRENTLY-ACTIVE OTel context (the @@ -461,7 +461,7 @@ public: * @return A SpanContext holding the thread's current context. */ [[nodiscard]] static SpanContext - threadLocalContext(); + threadLocalContext() noexcept; /** * Extract raw trace context bytes from this span for propagation. @@ -496,31 +496,31 @@ public: * Set a string attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, std::string_view value); + setAttribute(std::string_view key, std::string_view value) noexcept; /** * Set a string attribute (C-string overload). No-op on a null guard. */ void - setAttribute(std::string_view key, char const* value); + setAttribute(std::string_view key, char const* value) noexcept; /** * Set an integer attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, std::int64_t value); + setAttribute(std::string_view key, std::int64_t value) noexcept; /** * Set a floating-point attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, double value); + setAttribute(std::string_view key, double value) noexcept; /** * Set a boolean attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, bool value); + setAttribute(std::string_view key, bool value) noexcept; // --- Status / events ----------------------------------------------- @@ -528,21 +528,21 @@ public: * Mark the span status as OK. No-op on a null guard. */ void - setOk(); + setOk() noexcept; /** * Mark the span status as error. No-op on a null guard. * @param description Optional human-readable error description. */ void - setError(std::string_view description = ""); + setError(std::string_view description = "") noexcept; /** * Add a named event to the span's timeline. No-op on a null guard. * @param name Event name. */ void - addEvent(std::string_view name); + addEvent(std::string_view name) noexcept; /** * Add a named event with key-value attributes to the span's timeline. @@ -551,7 +551,7 @@ public: * @param attrs Attribute pairs (all string_view for simplicity). */ void - addEvent(std::string_view name, std::initializer_list attrs); + addEvent(std::string_view name, std::initializer_list attrs) noexcept; /** * Record an exception as a span event following OTel semantic @@ -560,7 +560,7 @@ public: * @param e The exception to record. */ void - recordException(std::exception const& e); + recordException(std::exception const& e) noexcept; /** * Mark this span for discard and end it immediately. @@ -568,7 +568,7 @@ public: * batch export queue. After discard(), the guard is inert. */ void - discard(); + discard() noexcept; // --- Activation (non-owning) --------------------------------------- @@ -579,13 +579,13 @@ public: * @return an RAII activation; drop it to restore the prior context. */ [[nodiscard]] ScopedActivation - activate() const; + activate() const noexcept; /** * @return true if this guard holds an active span. */ explicit - operator bool() const; + operator bool() const noexcept; }; /** @@ -677,7 +677,7 @@ class ScopedSpanGuard struct ScopedImpl; std::unique_ptr impl_; - explicit ScopedSpanGuard(SpanGuard&& guard); + explicit ScopedSpanGuard(SpanGuard&& guard) noexcept; public: /** @@ -688,7 +688,7 @@ public: * @param prefix Span name prefix (e.g. "rpc.command"). * @param name Span name suffix (e.g. "submit"). */ - ScopedSpanGuard(TraceCategory cat, std::string_view prefix, std::string_view name); + ScopedSpanGuard(TraceCategory cat, std::string_view prefix, std::string_view name) noexcept; ~ScopedSpanGuard(); @@ -710,7 +710,7 @@ public: * @return An active scoped root-span guard, or a null one if disabled. */ [[nodiscard]] static ScopedSpanGuard - freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name); + freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name) noexcept; // --- Child / linked span creation ---------------------------------- @@ -721,7 +721,7 @@ public: * @return A new scoped guard, or a null one if this guard is inactive. */ [[nodiscard]] ScopedSpanGuard - childSpan(std::string_view name) const; + childSpan(std::string_view name) const noexcept; /** * Create a scoped child span parented to an explicit captured @@ -731,7 +731,7 @@ public: * @return A new scoped guard, or a null one if parentCtx is invalid. */ [[nodiscard]] static ScopedSpanGuard - childSpan(std::string_view name, SpanContext const& parentCtx); + childSpan(std::string_view name, SpanContext const& parentCtx) noexcept; /** * Create a scoped span linked (follows-from) to this guard's span @@ -740,7 +740,7 @@ public: * @return A new scoped guard, or a null one if this guard is inactive. */ [[nodiscard]] ScopedSpanGuard - linkedSpan(std::string_view name) const; + linkedSpan(std::string_view name) const noexcept; /** * Create a scoped span linked to an explicit captured context and @@ -750,7 +750,7 @@ public: * @return A new scoped guard, or a null one if linkCtx is invalid. */ [[nodiscard]] static ScopedSpanGuard - linkedSpan(std::string_view name, SpanContext const& linkCtx); + linkedSpan(std::string_view name, SpanContext const& linkCtx) noexcept; // --- Handoff bridge ------------------------------------------------- @@ -761,7 +761,7 @@ public: * store is active. * @return The unscoped SpanGuard that now owns the span. */ - operator SpanGuard() &&; + operator SpanGuard() && noexcept; // --- Context capture ----------------------------------------------- @@ -775,7 +775,7 @@ public: * SpanGuard::threadLocalContext() for that. */ [[nodiscard]] SpanContext - spanContext() const; + spanContext() const noexcept; // --- Forwarding methods (delegate to the owned SpanGuard) ---------- @@ -783,51 +783,51 @@ public: * Set a string attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, std::string_view value); + setAttribute(std::string_view key, std::string_view value) noexcept; /** * Set a string attribute (C-string overload). No-op on a null guard. */ void - setAttribute(std::string_view key, char const* value); + setAttribute(std::string_view key, char const* value) noexcept; /** * Set an integer attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, std::int64_t value); + setAttribute(std::string_view key, std::int64_t value) noexcept; /** * Set a floating-point attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, double value); + setAttribute(std::string_view key, double value) noexcept; /** * Set a boolean attribute. No-op on a null guard. */ void - setAttribute(std::string_view key, bool value); + setAttribute(std::string_view key, bool value) noexcept; /** * Mark the span status as OK. No-op on a null guard. */ void - setOk(); + setOk() noexcept; /** * Mark the span status as error. No-op on a null guard. * @param description Optional human-readable error description. */ void - setError(std::string_view description = ""); + setError(std::string_view description = "") noexcept; /** * Add a named event to the span's timeline. No-op on a null guard. * @param name Event name. */ void - addEvent(std::string_view name); + addEvent(std::string_view name) noexcept; /** * Record an exception as a span event and mark status as error. @@ -835,7 +835,7 @@ public: * @param e The exception to record. */ void - recordException(std::exception const& e); + recordException(std::exception const& e) noexcept; /** * Mark this span for discard and end it immediately. discard() pops the @@ -844,13 +844,13 @@ public: * no-op. */ void - discard(); + discard() noexcept; /** * @return true if this guard holds an active span. */ explicit - operator bool() const; + operator bool() const noexcept; }; /** @@ -904,7 +904,7 @@ class ScopedActivation struct Impl; std::unique_ptr impl_; friend class SpanGuard; - explicit ScopedActivation(std::unique_ptr impl); + explicit ScopedActivation(std::unique_ptr impl) noexcept; public: /** @@ -984,35 +984,35 @@ public: operator=(SpanGuard const&) = delete; [[nodiscard]] static SpanGuard - span(TraceCategory, std::string_view, std::string_view) + span(TraceCategory, std::string_view, std::string_view) noexcept { return {}; } [[nodiscard]] static SpanGuard - freshRoot(TraceCategory, std::string_view, std::string_view) + freshRoot(TraceCategory, std::string_view, std::string_view) noexcept { return {}; } // NOLINTBEGIN(readability-convert-member-functions-to-static) [[nodiscard]] SpanGuard - childSpan(std::string_view) const + childSpan(std::string_view) const noexcept { return {}; } [[nodiscard]] static SpanGuard - childSpan(std::string_view, SpanContext const&) + childSpan(std::string_view, SpanContext const&) noexcept { return {}; } [[nodiscard]] SpanGuard - linkedSpan(std::string_view) const + linkedSpan(std::string_view) const noexcept { return {}; } [[nodiscard]] static SpanGuard - linkedSpan(std::string_view, SpanContext const&) + linkedSpan(std::string_view, SpanContext const&) noexcept { return {}; } @@ -1041,7 +1041,7 @@ public: } [[nodiscard]] SpanContext - spanContext() const + spanContext() const noexcept { return {}; } @@ -1058,67 +1058,67 @@ public: // NOLINTEND(readability-convert-member-functions-to-static) [[nodiscard]] static SpanContext - threadLocalContext() + threadLocalContext() noexcept { return {}; } void - setAttribute(std::string_view, std::string_view) + setAttribute(std::string_view, std::string_view) noexcept { } void - setAttribute(std::string_view, char const*) + setAttribute(std::string_view, char const*) noexcept { } void - setAttribute(std::string_view, std::int64_t) + setAttribute(std::string_view, std::int64_t) noexcept { } void - setAttribute(std::string_view, double) + setAttribute(std::string_view, double) noexcept { } void - setAttribute(std::string_view, bool) + setAttribute(std::string_view, bool) noexcept { } void - setOk() + setOk() noexcept { } void - setError(std::string_view = "") + setError(std::string_view = "") noexcept { } void - addEvent(std::string_view) + addEvent(std::string_view) noexcept { } void - addEvent(std::string_view, std::initializer_list) + addEvent(std::string_view, std::initializer_list) noexcept { } void - recordException(std::exception const&) + recordException(std::exception const&) noexcept { } void - discard() + discard() noexcept { } // NOLINTBEGIN(readability-convert-member-functions-to-static) [[nodiscard]] ScopedActivation - activate() const + activate() const noexcept { return {}; } // NOLINTEND(readability-convert-member-functions-to-static) explicit - operator bool() const + operator bool() const noexcept { return false; } @@ -1132,7 +1132,7 @@ class ScopedSpanGuard ScopedSpanGuard() = default; public: - ScopedSpanGuard(TraceCategory, std::string_view, std::string_view) + ScopedSpanGuard(TraceCategory, std::string_view, std::string_view) noexcept { } ~ScopedSpanGuard() = default; @@ -1145,89 +1145,89 @@ public: operator=(ScopedSpanGuard const&) = delete; [[nodiscard]] static ScopedSpanGuard - freshRoot(TraceCategory, std::string_view, std::string_view) + freshRoot(TraceCategory, std::string_view, std::string_view) noexcept { return {}; } // NOLINTBEGIN(readability-convert-member-functions-to-static) [[nodiscard]] ScopedSpanGuard - childSpan(std::string_view) const + childSpan(std::string_view) const noexcept { return {}; } [[nodiscard]] static ScopedSpanGuard - childSpan(std::string_view, SpanContext const&) + childSpan(std::string_view, SpanContext const&) noexcept { return {}; } [[nodiscard]] ScopedSpanGuard - linkedSpan(std::string_view) const + linkedSpan(std::string_view) const noexcept { return {}; } [[nodiscard]] static ScopedSpanGuard - linkedSpan(std::string_view, SpanContext const&) + linkedSpan(std::string_view, SpanContext const&) noexcept { return {}; } [[nodiscard]] SpanContext - spanContext() const + spanContext() const noexcept { return {}; } // NOLINTEND(readability-convert-member-functions-to-static) - operator SpanGuard() && + operator SpanGuard() && noexcept { return {}; } void - setAttribute(std::string_view, std::string_view) + setAttribute(std::string_view, std::string_view) noexcept { } void - setAttribute(std::string_view, char const*) + setAttribute(std::string_view, char const*) noexcept { } void - setAttribute(std::string_view, std::int64_t) + setAttribute(std::string_view, std::int64_t) noexcept { } void - setAttribute(std::string_view, double) + setAttribute(std::string_view, double) noexcept { } void - setAttribute(std::string_view, bool) + setAttribute(std::string_view, bool) noexcept { } void - setOk() + setOk() noexcept { } void - setError(std::string_view = "") + setError(std::string_view = "") noexcept { } void - addEvent(std::string_view) + addEvent(std::string_view) noexcept { } void - recordException(std::exception const&) + recordException(std::exception const&) noexcept { } void - discard() + discard() noexcept { } explicit - operator bool() const + operator bool() const noexcept { return false; } diff --git a/src/libxrpl/telemetry/SpanGuard.cpp b/src/libxrpl/telemetry/SpanGuard.cpp index 2a74475880..08b8e7b3f2 100644 --- a/src/libxrpl/telemetry/SpanGuard.cpp +++ b/src/libxrpl/telemetry/SpanGuard.cpp @@ -86,7 +86,7 @@ SpanContext::SpanContext(std::shared_ptr impl) : impl_(std::move(impl)) } bool -SpanContext::isValid() const +SpanContext::isValid() const noexcept { return impl_ != nullptr; } @@ -132,12 +132,12 @@ SpanGuard::SpanGuard(SpanGuard&&) noexcept = default; SpanGuard& SpanGuard::operator=(SpanGuard&&) noexcept = default; -SpanGuard::SpanGuard(std::unique_ptr impl) : impl_(std::move(impl)) +SpanGuard::SpanGuard(std::unique_ptr impl) noexcept : impl_(std::move(impl)) { } SpanGuard:: -operator bool() const +operator bool() const noexcept { return impl_ != nullptr; } @@ -201,7 +201,7 @@ categoryToSpanKind(TraceCategory cat) } // namespace SpanGuard -SpanGuard::span(TraceCategory cat, std::string_view prefix, std::string_view name) +SpanGuard::span(TraceCategory cat, std::string_view prefix, std::string_view name) noexcept { auto* tel = Telemetry::getInstance(); if ((tel == nullptr) || !tel->isEnabled() || !isCategoryEnabled(*tel, cat)) @@ -213,7 +213,7 @@ SpanGuard::span(TraceCategory cat, std::string_view prefix, std::string_view nam } SpanGuard -SpanGuard::freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name) +SpanGuard::freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name) noexcept { auto* tel = Telemetry::getInstance(); if ((tel == nullptr) || !tel->isEnabled() || !isCategoryEnabled(*tel, cat)) @@ -230,7 +230,7 @@ SpanGuard::freshRoot(TraceCategory cat, std::string_view prefix, std::string_vie // ===== Child / linked span creation ======================================== SpanGuard -SpanGuard::childSpan(std::string_view name) const +SpanGuard::childSpan(std::string_view name) const noexcept { if (!impl_) return {}; @@ -242,7 +242,7 @@ SpanGuard::childSpan(std::string_view name) const } SpanGuard -SpanGuard::childSpan(std::string_view name, SpanContext const& parentCtx) +SpanGuard::childSpan(std::string_view name, SpanContext const& parentCtx) noexcept { if (!parentCtx.isValid()) return {}; @@ -253,7 +253,7 @@ SpanGuard::childSpan(std::string_view name, SpanContext const& parentCtx) } SpanGuard -SpanGuard::linkedSpan(std::string_view name) const +SpanGuard::linkedSpan(std::string_view name) const noexcept { if (!impl_) return {}; @@ -277,7 +277,7 @@ SpanGuard::linkedSpan(std::string_view name) const } SpanGuard -SpanGuard::linkedSpan(std::string_view name, SpanContext const& linkCtx) +SpanGuard::linkedSpan(std::string_view name, SpanContext const& linkCtx) noexcept { if (!linkCtx.isValid()) return {}; @@ -401,7 +401,7 @@ SpanGuard::hashSpan( // ===== Context capture ===================================================== SpanContext -SpanGuard::spanContext() const +SpanGuard::spanContext() const noexcept { if (!impl_ || !impl_->span) return {}; @@ -416,7 +416,7 @@ SpanGuard::spanContext() const } SpanContext -SpanGuard::threadLocalContext() +SpanGuard::threadLocalContext() noexcept { // Snapshot whatever span is currently active on THIS thread's context // stack (the ambient context), independent of any guard. This is the @@ -455,7 +455,7 @@ SpanGuard::injectCurrentContextToProtobuf(protocol::TraceContext& proto) // ===== Attribute setters =================================================== void -SpanGuard::setAttribute(std::string_view key, std::string_view value) +SpanGuard::setAttribute(std::string_view key, std::string_view value) noexcept { if (impl_) { @@ -466,27 +466,27 @@ SpanGuard::setAttribute(std::string_view key, std::string_view value) } void -SpanGuard::setAttribute(std::string_view key, char const* value) +SpanGuard::setAttribute(std::string_view key, char const* value) noexcept { setAttribute(key, std::string_view(value)); } void -SpanGuard::setAttribute(std::string_view key, std::int64_t value) +SpanGuard::setAttribute(std::string_view key, std::int64_t value) noexcept { if (impl_) impl_->span->SetAttribute(opentelemetry::nostd::string_view(key.data(), key.size()), value); } void -SpanGuard::setAttribute(std::string_view key, double value) +SpanGuard::setAttribute(std::string_view key, double value) noexcept { if (impl_) impl_->span->SetAttribute(opentelemetry::nostd::string_view(key.data(), key.size()), value); } void -SpanGuard::setAttribute(std::string_view key, bool value) +SpanGuard::setAttribute(std::string_view key, bool value) noexcept { if (impl_) impl_->span->SetAttribute(opentelemetry::nostd::string_view(key.data(), key.size()), value); @@ -495,28 +495,28 @@ SpanGuard::setAttribute(std::string_view key, bool value) // ===== Status / events ===================================================== void -SpanGuard::setOk() +SpanGuard::setOk() noexcept { if (impl_) impl_->span->SetStatus(otel_trace::StatusCode::kOk); } void -SpanGuard::setError(std::string_view description) +SpanGuard::setError(std::string_view description) noexcept { if (impl_) impl_->span->SetStatus(otel_trace::StatusCode::kError, std::string(description)); } void -SpanGuard::addEvent(std::string_view name) +SpanGuard::addEvent(std::string_view name) noexcept { if (impl_) impl_->span->AddEvent(std::string(name)); } void -SpanGuard::addEvent(std::string_view name, std::initializer_list attrs) +SpanGuard::addEvent(std::string_view name, std::initializer_list attrs) noexcept { if (!impl_) return; @@ -541,7 +541,7 @@ SpanGuard::addEvent(std::string_view name, std::initializer_list } void -SpanGuard::recordException(std::exception const& e) +SpanGuard::recordException(std::exception const& e) noexcept { if (!impl_) return; @@ -556,7 +556,7 @@ SpanGuard::recordException(std::exception const& e) } void -SpanGuard::discard() +SpanGuard::discard() noexcept { if (impl_) { @@ -637,7 +637,7 @@ struct ScopedSpanGuard::ScopedImpl // ===== ScopedSpanGuard core lifecycle ====================================== -ScopedSpanGuard::ScopedSpanGuard(SpanGuard&& guard) +ScopedSpanGuard::ScopedSpanGuard(SpanGuard&& guard) noexcept : impl_(std::make_unique(std::move(guard))) { } @@ -656,37 +656,43 @@ ScopedSpanGuard::~ScopedSpanGuard() // ===== ScopedSpanGuard factory methods ===================================== -ScopedSpanGuard::ScopedSpanGuard(TraceCategory cat, std::string_view prefix, std::string_view name) +ScopedSpanGuard::ScopedSpanGuard( + TraceCategory cat, + std::string_view prefix, + std::string_view name) noexcept : ScopedSpanGuard(SpanGuard::span(cat, prefix, name)) { } ScopedSpanGuard -ScopedSpanGuard::freshRoot(TraceCategory cat, std::string_view prefix, std::string_view name) +ScopedSpanGuard::freshRoot( + TraceCategory cat, + std::string_view prefix, + std::string_view name) noexcept { return ScopedSpanGuard(SpanGuard::freshRoot(cat, prefix, name)); } ScopedSpanGuard -ScopedSpanGuard::childSpan(std::string_view name) const +ScopedSpanGuard::childSpan(std::string_view name) const noexcept { return ScopedSpanGuard(impl_->guard.childSpan(name)); } ScopedSpanGuard -ScopedSpanGuard::childSpan(std::string_view name, SpanContext const& parentCtx) +ScopedSpanGuard::childSpan(std::string_view name, SpanContext const& parentCtx) noexcept { return ScopedSpanGuard(SpanGuard::childSpan(name, parentCtx)); } ScopedSpanGuard -ScopedSpanGuard::linkedSpan(std::string_view name) const +ScopedSpanGuard::linkedSpan(std::string_view name) const noexcept { return ScopedSpanGuard(impl_->guard.linkedSpan(name)); } ScopedSpanGuard -ScopedSpanGuard::linkedSpan(std::string_view name, SpanContext const& linkCtx) +ScopedSpanGuard::linkedSpan(std::string_view name, SpanContext const& linkCtx) noexcept { return ScopedSpanGuard(SpanGuard::linkedSpan(name, linkCtx)); } @@ -694,7 +700,7 @@ ScopedSpanGuard::linkedSpan(std::string_view name, SpanContext const& linkCtx) // ===== ScopedSpanGuard handoff bridge ====================================== ScopedSpanGuard:: -operator SpanGuard() && +operator SpanGuard() && noexcept { // The scope must be popped while its constructing context store is // active; handing off under a different store would pop the wrong stack. @@ -710,7 +716,7 @@ operator SpanGuard() && // ===== ScopedSpanGuard context capture ===================================== SpanContext -ScopedSpanGuard::spanContext() const +ScopedSpanGuard::spanContext() const noexcept { return impl_->guard.spanContext(); } @@ -718,61 +724,61 @@ ScopedSpanGuard::spanContext() const // ===== ScopedSpanGuard forwarding methods ================================== void -ScopedSpanGuard::setAttribute(std::string_view key, std::string_view value) +ScopedSpanGuard::setAttribute(std::string_view key, std::string_view value) noexcept { impl_->guard.setAttribute(key, value); } void -ScopedSpanGuard::setAttribute(std::string_view key, char const* value) +ScopedSpanGuard::setAttribute(std::string_view key, char const* value) noexcept { impl_->guard.setAttribute(key, value); } void -ScopedSpanGuard::setAttribute(std::string_view key, std::int64_t value) +ScopedSpanGuard::setAttribute(std::string_view key, std::int64_t value) noexcept { impl_->guard.setAttribute(key, value); } void -ScopedSpanGuard::setAttribute(std::string_view key, double value) +ScopedSpanGuard::setAttribute(std::string_view key, double value) noexcept { impl_->guard.setAttribute(key, value); } void -ScopedSpanGuard::setAttribute(std::string_view key, bool value) +ScopedSpanGuard::setAttribute(std::string_view key, bool value) noexcept { impl_->guard.setAttribute(key, value); } void -ScopedSpanGuard::setOk() +ScopedSpanGuard::setOk() noexcept { impl_->guard.setOk(); } void -ScopedSpanGuard::setError(std::string_view description) +ScopedSpanGuard::setError(std::string_view description) noexcept { impl_->guard.setError(description); } void -ScopedSpanGuard::addEvent(std::string_view name) +ScopedSpanGuard::addEvent(std::string_view name) noexcept { impl_->guard.addEvent(name); } void -ScopedSpanGuard::recordException(std::exception const& e) +ScopedSpanGuard::recordException(std::exception const& e) noexcept { impl_->guard.recordException(e); } void -ScopedSpanGuard::discard() +ScopedSpanGuard::discard() noexcept { // A live Scope must be popped while its constructing context store is // active; discarding under a different store corrupts that store's @@ -788,7 +794,7 @@ ScopedSpanGuard::discard() } ScopedSpanGuard:: -operator bool() const +operator bool() const noexcept { return impl_ && static_cast(impl_->guard); } @@ -827,7 +833,7 @@ struct ScopedActivation::Impl ScopedActivation::ScopedActivation() = default; -ScopedActivation::ScopedActivation(std::unique_ptr impl) : impl_(std::move(impl)) +ScopedActivation::ScopedActivation(std::unique_ptr impl) noexcept : impl_(std::move(impl)) { } @@ -844,7 +850,7 @@ ScopedActivation::~ScopedActivation() } ScopedActivation -SpanGuard::activate() const +SpanGuard::activate() const noexcept { if (!impl_ || !impl_->span) return {};