mirror of
https://github.com/XRPLF/rippled.git
synced 2026-07-23 15:10:34 +00:00
fix(telemetry): restore injectCurrentContextToProtobuf decl; re-parent open/establish spans under round; correct childSpan names
Post-review fixes for the SpanGuard scope-leak change: - SpanGuard.h: restore the injectCurrentContextToProtobuf real-class declaration, its #else no-op stub, and the protocol::TraceContext forward-declaration dropped during the 3->4 union merge (compile break). - Re-parent consensus.phase.open and consensus.establish under the round span via a new RCLConsensus::Adaptor::roundSpanContext() accessor: the round span is now detached, so ambient parenting no longer works; the phase spans link explicitly to the captured round context. csf::Peer gains a matching no-op accessor so the generic engine still compiles. - Switch five childSpan(op::X, ctx) sites to the full consensus::span::X constants: childSpan(name, ctx) takes the name verbatim, so the suffix- only op:: constants emitted short, non-dotted span names. - TestTelemetry mock: add getConsensusTraceStrategy() override (base pure virtual introduced on this branch) so the mock is not abstract. - validate(): rewrite the trace_context comment to drop attack-surface framing and the PR-discussion reference. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -170,6 +170,10 @@
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
namespace protocol {
|
||||
class TraceContext;
|
||||
} // namespace protocol
|
||||
|
||||
namespace xrpl::telemetry {
|
||||
|
||||
/**
|
||||
@@ -436,6 +440,20 @@ public:
|
||||
[[nodiscard]] TraceBytes
|
||||
getTraceBytes() const;
|
||||
|
||||
/**
|
||||
* Inject the calling thread's currently-active OTel context into a
|
||||
* protobuf TraceContext message for cross-node propagation.
|
||||
*
|
||||
* Encapsulates `RuntimeContext::GetCurrent()` + `injectToProtobuf`
|
||||
* so callers in app-layer code (e.g. RCLConsensus broadcasting
|
||||
* TMProposeSet / TMValidation) don't depend on any OTel headers.
|
||||
* No-op if telemetry is disabled or no span is active.
|
||||
*
|
||||
* @param proto The protobuf TraceContext to populate.
|
||||
*/
|
||||
static void
|
||||
injectCurrentContextToProtobuf(protocol::TraceContext& proto);
|
||||
|
||||
// --- Attribute setters (explicit overloads, no OTel types) ---------
|
||||
|
||||
/**
|
||||
@@ -613,6 +631,11 @@ public:
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
static void
|
||||
injectCurrentContextToProtobuf(protocol::TraceContext&)
|
||||
{
|
||||
}
|
||||
// NOLINTEND(readability-convert-member-functions-to-static)
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user