Merge branch 'pratik/otel-phase1b-telemetry-infra' into pratik/otel-phase1c-rpc-integration

This commit is contained in:
Pratik Mankawde
2026-07-24 12:25:35 +01:00
2 changed files with 132 additions and 126 deletions

View File

@@ -217,11 +217,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;
}
@@ -256,7 +256,7 @@ class SpanGuard
struct Impl;
std::unique_ptr<Impl> impl_;
explicit SpanGuard(std::unique_ptr<Impl> impl);
explicit SpanGuard(std::unique_ptr<Impl> 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.
@@ -287,7 +287,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.
@@ -305,7 +305,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 ----------------------------------
@@ -327,7 +327,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.
@@ -336,7 +336,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.
@@ -346,7 +346,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.
@@ -355,7 +355,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;
// --- Context capture -----------------------------------------------
@@ -369,7 +369,7 @@ public:
* threadLocalContext() for that.
*/
[[nodiscard]] SpanContext
spanContext() const;
spanContext() const noexcept;
/**
* Snapshot the calling thread's CURRENTLY-ACTIVE OTel context (the
@@ -382,7 +382,7 @@ public:
* @return A SpanContext holding the thread's current context.
*/
[[nodiscard]] static SpanContext
threadLocalContext();
threadLocalContext() noexcept;
// --- Attribute setters (explicit overloads, no OTel types) ---------
@@ -390,31 +390,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 -----------------------------------------------
@@ -422,21 +422,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
@@ -445,7 +445,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.
@@ -453,7 +453,7 @@ public:
* batch export queue. After discard(), the guard is inert.
*/
void
discard();
discard() noexcept;
// --- Activation (non-owning) ---------------------------------------
@@ -464,13 +464,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;
};
/**
@@ -562,7 +562,7 @@ class ScopedSpanGuard
struct ScopedImpl;
std::unique_ptr<ScopedImpl> impl_;
explicit ScopedSpanGuard(SpanGuard&& guard);
explicit ScopedSpanGuard(SpanGuard&& guard) noexcept;
public:
/**
@@ -573,7 +573,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();
@@ -595,7 +595,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 ----------------------------------
@@ -606,7 +606,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
@@ -616,7 +616,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
@@ -625,7 +625,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
@@ -635,7 +635,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 -------------------------------------------------
@@ -646,7 +646,7 @@ public:
* store is active.
* @return The unscoped SpanGuard that now owns the span.
*/
operator SpanGuard() &&;
operator SpanGuard() && noexcept;
// --- Context capture -----------------------------------------------
@@ -660,7 +660,7 @@ public:
* SpanGuard::threadLocalContext() for that.
*/
[[nodiscard]] SpanContext
spanContext() const;
spanContext() const noexcept;
// --- Forwarding methods (delegate to the owned SpanGuard) ----------
@@ -668,51 +668,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.
@@ -720,7 +720,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
@@ -729,13 +729,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;
};
/**
@@ -789,7 +789,7 @@ class ScopedActivation
struct Impl;
std::unique_ptr<Impl> impl_;
friend class SpanGuard;
explicit ScopedActivation(std::unique_ptr<Impl> impl);
explicit ScopedActivation(std::unique_ptr<Impl> impl) noexcept;
public:
/**
@@ -869,104 +869,104 @@ 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 {};
}
[[nodiscard]] SpanContext
spanContext() const
spanContext() const noexcept
{
return {};
}
// 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;
}
@@ -980,7 +980,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;
@@ -993,89 +993,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;
}

View File

@@ -74,7 +74,7 @@ SpanContext::SpanContext(std::shared_ptr<Impl> impl) : impl_(std::move(impl))
}
bool
SpanContext::isValid() const
SpanContext::isValid() const noexcept
{
return impl_ != nullptr;
}
@@ -120,12 +120,12 @@ SpanGuard::SpanGuard(SpanGuard&&) noexcept = default;
SpanGuard&
SpanGuard::operator=(SpanGuard&&) noexcept = default;
SpanGuard::SpanGuard(std::unique_ptr<Impl> impl) : impl_(std::move(impl))
SpanGuard::SpanGuard(std::unique_ptr<Impl> impl) noexcept : impl_(std::move(impl))
{
}
SpanGuard::
operator bool() const
operator bool() const noexcept
{
return impl_ != nullptr;
}
@@ -189,7 +189,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))
@@ -201,7 +201,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))
@@ -218,7 +218,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 {};
@@ -230,7 +230,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 {};
@@ -241,7 +241,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 {};
@@ -265,7 +265,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 {};
@@ -298,7 +298,7 @@ SpanGuard::linkedSpan(std::string_view name, SpanContext const& linkCtx)
// ===== Context capture =====================================================
SpanContext
SpanGuard::spanContext() const
SpanGuard::spanContext() const noexcept
{
if (!impl_ || !impl_->span)
return {};
@@ -313,7 +313,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
@@ -325,7 +325,7 @@ SpanGuard::threadLocalContext()
// ===== 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_)
{
@@ -336,27 +336,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);
@@ -365,28 +365,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;
@@ -401,7 +401,7 @@ SpanGuard::recordException(std::exception const& e)
}
void
SpanGuard::discard()
SpanGuard::discard() noexcept
{
if (impl_)
{
@@ -482,7 +482,7 @@ struct ScopedSpanGuard::ScopedImpl
// ===== ScopedSpanGuard core lifecycle ======================================
ScopedSpanGuard::ScopedSpanGuard(SpanGuard&& guard)
ScopedSpanGuard::ScopedSpanGuard(SpanGuard&& guard) noexcept
: impl_(std::make_unique<ScopedImpl>(std::move(guard)))
{
}
@@ -501,37 +501,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));
}
@@ -539,7 +545,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.
@@ -555,7 +561,7 @@ operator SpanGuard() &&
// ===== ScopedSpanGuard context capture =====================================
SpanContext
ScopedSpanGuard::spanContext() const
ScopedSpanGuard::spanContext() const noexcept
{
return impl_->guard.spanContext();
}
@@ -563,61 +569,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
@@ -633,7 +639,7 @@ ScopedSpanGuard::discard()
}
ScopedSpanGuard::
operator bool() const
operator bool() const noexcept
{
return impl_ && static_cast<bool>(impl_->guard);
}
@@ -672,7 +678,7 @@ struct ScopedActivation::Impl
ScopedActivation::ScopedActivation() = default;
ScopedActivation::ScopedActivation(std::unique_ptr<Impl> impl) : impl_(std::move(impl))
ScopedActivation::ScopedActivation(std::unique_ptr<Impl> impl) noexcept : impl_(std::move(impl))
{
}
@@ -689,7 +695,7 @@ ScopedActivation::~ScopedActivation()
}
ScopedActivation
SpanGuard::activate() const
SpanGuard::activate() const noexcept
{
if (!impl_ || !impl_->span)
return {};