refactor(telemetry): remove unused SpanGuard::span(name) overload

Remove the single-arg span(name) factory that creates unconditional
spans without category gating. All call sites use the 3-arg
span(TraceCategory, prefix, name) variant which checks whether the
category is enabled in config before creating a span. The 1-arg form
was dead code with no callers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Pratik Mankawde
2026-04-28 12:23:49 +01:00
parent 5e8277f36a
commit 7aa4486741
2 changed files with 2 additions and 22 deletions

View File

@@ -14,7 +14,6 @@
+-------------------------------------------+
| - impl_ : unique_ptr<Impl> (pimpl) |
+-------------------------------------------+
| + span(name) : SpanGuard [static] |
| + span(cat, prefix, name) [static] |
| + childSpan(name) : SpanGuard |
| + linkedSpan(name) : SpanGuard |
@@ -194,12 +193,6 @@ public:
// --- Static factory methods ----------------------------------------
/** Create an unconditional span (always created if telemetry is on).
@param name Full span name (e.g. "app.startup").
*/
static SpanGuard
span(std::string_view name);
/** Create a span guarded by a TraceCategory flag.
The span name is built as "prefix.name". Returns a null guard
if the category is disabled in config.
@@ -329,11 +322,6 @@ public:
SpanGuard&
operator=(SpanGuard const&) = delete;
static SpanGuard
span(std::string_view)
{
return {};
}
static SpanGuard
span(TraceCategory, std::string_view, std::string_view)
{

View File

@@ -20,8 +20,9 @@
#ifdef XRPL_ENABLE_TELEMETRY
#include <xrpl/telemetry/DiscardFlag.h>
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/telemetry/DiscardFlag.h>
#include <xrpl/telemetry/Telemetry.h>
#include <opentelemetry/context/runtime_context.h>
@@ -131,15 +132,6 @@ isCategoryEnabled(Telemetry const& tel, TraceCategory cat)
return false; // unreachable, silences compiler warning
}
SpanGuard
SpanGuard::span(std::string_view name)
{
auto* tel = Telemetry::getInstance();
if (!tel || !tel->isEnabled())
return {};
return SpanGuard(std::make_unique<Impl>(tel->startSpan(name)));
}
SpanGuard
SpanGuard::span(TraceCategory cat, std::string_view prefix, std::string_view name)
{