diff --git a/include/xrpl/telemetry/SpanGuard.h b/include/xrpl/telemetry/SpanGuard.h index 2bb5eb0e0a..b37aa81c6d 100644 --- a/include/xrpl/telemetry/SpanGuard.h +++ b/include/xrpl/telemetry/SpanGuard.h @@ -236,11 +236,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; } @@ -275,7 +275,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. @@ -306,7 +306,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. @@ -324,7 +324,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 ---------------------------------- @@ -346,7 +346,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. @@ -355,7 +355,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. @@ -365,7 +365,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. @@ -374,7 +374,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) ----------------------------- @@ -431,7 +431,7 @@ public: * threadLocalContext() for that. */ [[nodiscard]] SpanContext - spanContext() const; + spanContext() const noexcept; /** * Snapshot the calling thread's CURRENTLY-ACTIVE OTel context (the @@ -444,7 +444,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. @@ -465,31 +465,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 ----------------------------------------------- @@ -497,21 +497,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; /** * Record an exception as a span event following OTel semantic @@ -520,7 +520,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. @@ -528,7 +528,7 @@ public: * batch export queue. After discard(), the guard is inert. */ void - discard(); + discard() noexcept; // --- Activation (non-owning) --------------------------------------- @@ -539,13 +539,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; }; /** @@ -637,7 +637,7 @@ class ScopedSpanGuard struct ScopedImpl; std::unique_ptr impl_; - explicit ScopedSpanGuard(SpanGuard&& guard); + explicit ScopedSpanGuard(SpanGuard&& guard) noexcept; public: /** @@ -648,7 +648,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(); @@ -670,7 +670,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 ---------------------------------- @@ -681,7 +681,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 @@ -691,7 +691,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 @@ -700,7 +700,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 @@ -710,7 +710,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 ------------------------------------------------- @@ -721,7 +721,7 @@ public: * store is active. * @return The unscoped SpanGuard that now owns the span. */ - operator SpanGuard() &&; + operator SpanGuard() && noexcept; // --- Context capture ----------------------------------------------- @@ -735,7 +735,7 @@ public: * SpanGuard::threadLocalContext() for that. */ [[nodiscard]] SpanContext - spanContext() const; + spanContext() const noexcept; // --- Forwarding methods (delegate to the owned SpanGuard) ---------- @@ -743,51 +743,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. @@ -795,7 +795,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 @@ -804,13 +804,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; }; /** @@ -864,7 +864,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: /** @@ -944,35 +944,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 {}; } @@ -996,7 +996,7 @@ public: } [[nodiscard]] SpanContext - spanContext() const + spanContext() const noexcept { return {}; } @@ -1008,63 +1008,63 @@ 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 - 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; } @@ -1078,7 +1078,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; @@ -1091,89 +1091,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 59c5a7ef5d..c744fb7530 100644 --- a/src/libxrpl/telemetry/SpanGuard.cpp +++ b/src/libxrpl/telemetry/SpanGuard.cpp @@ -83,7 +83,7 @@ SpanContext::SpanContext(std::shared_ptr impl) : impl_(std::move(impl)) } bool -SpanContext::isValid() const +SpanContext::isValid() const noexcept { return impl_ != nullptr; } @@ -129,12 +129,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; } @@ -198,7 +198,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)) @@ -210,7 +210,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)) @@ -227,7 +227,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 {}; @@ -239,7 +239,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 {}; @@ -250,7 +250,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 {}; @@ -274,7 +274,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 {}; @@ -375,7 +375,7 @@ SpanGuard::hashSpan( // ===== Context capture ===================================================== SpanContext -SpanGuard::spanContext() const +SpanGuard::spanContext() const noexcept { if (!impl_ || !impl_->span) return {}; @@ -390,7 +390,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 @@ -422,7 +422,7 @@ SpanGuard::getTraceBytes() const // ===== 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_) { @@ -433,27 +433,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); @@ -462,28 +462,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::recordException(std::exception const& e) +SpanGuard::recordException(std::exception const& e) noexcept { if (!impl_) return; @@ -498,7 +498,7 @@ SpanGuard::recordException(std::exception const& e) } void -SpanGuard::discard() +SpanGuard::discard() noexcept { if (impl_) { @@ -579,7 +579,7 @@ struct ScopedSpanGuard::ScopedImpl // ===== ScopedSpanGuard core lifecycle ====================================== -ScopedSpanGuard::ScopedSpanGuard(SpanGuard&& guard) +ScopedSpanGuard::ScopedSpanGuard(SpanGuard&& guard) noexcept : impl_(std::make_unique(std::move(guard))) { } @@ -598,37 +598,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)); } @@ -636,7 +642,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. @@ -652,7 +658,7 @@ operator SpanGuard() && // ===== ScopedSpanGuard context capture ===================================== SpanContext -ScopedSpanGuard::spanContext() const +ScopedSpanGuard::spanContext() const noexcept { return impl_->guard.spanContext(); } @@ -660,61 +666,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 @@ -730,7 +736,7 @@ ScopedSpanGuard::discard() } ScopedSpanGuard:: -operator bool() const +operator bool() const noexcept { return impl_ && static_cast(impl_->guard); } @@ -769,7 +775,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)) { } @@ -786,7 +792,7 @@ ScopedActivation::~ScopedActivation() } ScopedActivation -SpanGuard::activate() const +SpanGuard::activate() const noexcept { if (!impl_ || !impl_->span) return {};