Merge branch 'pratik/otel-phase5-docs-deployment' into pratik/otel-phase6-statsd

This commit is contained in:
Pratik Mankawde
2026-04-29 19:59:02 +01:00
13 changed files with 43 additions and 43 deletions

View File

@@ -252,7 +252,7 @@ public:
shouldTraceLedger() const = 0;
/** @return The configured consensus trace correlation strategy. */
virtual std::string const&
[[nodiscard]] virtual std::string const&
getConsensusTraceStrategy() const = 0;
#ifdef XRPL_ENABLE_TELEMETRY

View File

@@ -18,6 +18,7 @@
#endif
#include <memory>
#include <string>
#include <utility>
namespace xrpl::telemetry {
@@ -87,7 +88,7 @@ public:
return false;
}
std::string const&
[[nodiscard]] std::string const&
getConsensusTraceStrategy() const override
{
return setup_.consensusTraceStrategy;

View File

@@ -6,6 +6,7 @@
#include <cstdint>
#include <exception>
#include <stdexcept>
#include <string>
#include <utility>
using namespace xrpl;

View File

@@ -63,8 +63,10 @@
#include <xrpl/shamap/SHAMapItem.h>
#include <xrpl/shamap/SHAMapMissingNode.h>
#include <xrpl/shamap/SHAMapTreeNode.h>
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/telemetry/SpanNames.h>
#include <xrpl/telemetry/Telemetry.h>
#include <xrpl/telemetry/TraceContextPropagator.h>
#include <xrpl/telemetry/TraceContextPropagator.h> // IWYU pragma: keep
#include <boost/smart_ptr/intrusive_ptr.hpp>
@@ -357,7 +359,7 @@ RCLConsensus::Adaptor::onClose(
telemetry::cons_span::op::ledgerClose);
span.setAttribute(
telemetry::cons_span::attr::ledgerSeq,
static_cast<int64_t>(ledger.ledger_->header().seq + 1));
static_cast<int64_t>(ledger.ledger_->header().seq) + 1);
span.setAttribute(telemetry::cons_span::attr::mode, toDisplayString(mode).c_str());
bool const wrongLCL = mode == ConsensusMode::wrongLedger;
@@ -556,7 +558,7 @@ RCLConsensus::Adaptor::doAccept(
? acceptSpan->childSpan(telemetry::cons_span::acceptApply)
: telemetry::SpanGuard::childSpan(telemetry::cons_span::acceptApply, roundSpanContext_);
doAcceptSpan.setAttribute(
telemetry::cons_span::attr::ledgerSeq, static_cast<int64_t>(prevLedger.seq() + 1));
telemetry::cons_span::attr::ledgerSeq, static_cast<int64_t>(prevLedger.seq()) + 1);
doAcceptSpan.setAttribute(
telemetry::cons_span::attr::closeTime,
static_cast<int64_t>(consensusCloseTime.time_since_epoch().count()));
@@ -582,9 +584,17 @@ RCLConsensus::Adaptor::doAccept(
static_cast<int64_t>(rawCloseTimes.peers.size()));
{
auto const prevRes = prevLedger.closeTimeResolution();
std::string dir = (closeResolution > prevRes) ? "increased"
: (closeResolution < prevRes) ? "decreased"
: "unchanged";
auto const dir = [&]() -> std::string {
if (closeResolution > prevRes)
{
return "increased";
}
if (closeResolution < prevRes)
{
return "decreased";
}
return "unchanged";
}();
doAcceptSpan.setAttribute(telemetry::cons_span::attr::resolutionDirection, std::move(dir));
}
@@ -1218,10 +1228,10 @@ RCLConsensus::Adaptor::startRoundTracing(RCLCxLedger const& prevLgr)
return;
roundSpan_->setAttribute(cons_span::attr::ledgerId, to_string(prevLgr.id()).c_str());
roundSpan_->setAttribute(cons_span::attr::ledgerSeq, static_cast<int64_t>(prevLgr.seq() + 1));
roundSpan_->setAttribute(cons_span::attr::ledgerSeq, static_cast<int64_t>(prevLgr.seq()) + 1);
roundSpan_->setAttribute(cons_span::attr::mode, toDisplayString(mode_.load()).c_str());
roundSpan_->setAttribute(cons_span::attr::traceStrategy, strategy.c_str());
roundSpan_->setAttribute(cons_span::attr::roundId, static_cast<int64_t>(prevLgr.seq() + 1));
roundSpan_->setAttribute(cons_span::attr::roundId, static_cast<int64_t>(prevLgr.seq()) + 1);
roundSpanContext_ = roundSpan_->captureContext();
}

View File

@@ -17,9 +17,7 @@
#include <xrpl/telemetry/SpanNames.h>
namespace xrpl {
namespace telemetry {
namespace tx_span {
namespace xrpl::telemetry::tx_span {
// ===== Span prefixes =======================================================
@@ -72,6 +70,4 @@ inline constexpr auto async = makeStr("async");
inline constexpr auto knownBad = makeStr("known_bad");
} // namespace val
} // namespace tx_span
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry::tx_span

View File

@@ -6,6 +6,7 @@
#include <xrpl/basics/BasicConfig.h>
#include <xrpl/basics/Log.h>
#include <xrpl/basics/base_uint.h>
#include <xrpl/basics/contract.h>
#include <xrpl/basics/mulDiv.h>
#include <xrpl/beast/utility/Zero.h>
@@ -30,7 +31,6 @@
#include <xrpl/protocol/Units.h>
#include <xrpl/protocol/XRPAmount.h>
#include <xrpl/protocol/jss.h>
#include <xrpl/protocol/st.h>
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/tx/apply.h>
#include <xrpl/tx/applySteps.h>

View File

@@ -48,9 +48,7 @@
#include <xrpl/telemetry/SpanNames.h>
namespace xrpl {
namespace telemetry {
namespace txq_span {
namespace xrpl::telemetry::txq_span {
// ===== Span prefixes =======================================================
@@ -110,6 +108,4 @@ inline constexpr auto failed = makeStr("failed");
inline constexpr auto retried = makeStr("retried");
} // namespace val
} // namespace txq_span
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry::txq_span

View File

@@ -1801,11 +1801,17 @@ Consensus<Adaptor>::haveConsensus(std::unique_ptr<std::stringstream> const& clog
char const* stateStr = "no";
if (result_->state == ConsensusState::Yes)
{
stateStr = "yes";
}
else if (result_->state == ConsensusState::MovedOn)
{
stateStr = "moved_on";
}
else if (result_->state == ConsensusState::Expired)
{
stateStr = "expired";
}
span.setAttribute(cons_span::attr::result, stateStr);
CLOG(clog) << "Consensus has been reached. ";

View File

@@ -78,9 +78,7 @@
#include <xrpl/telemetry/SpanNames.h>
namespace xrpl {
namespace telemetry {
namespace cons_span {
namespace xrpl::telemetry::cons_span {
// ===== Span name segments ====================================================
@@ -240,6 +238,4 @@ inline constexpr auto decreased = makeStr("decreased");
inline constexpr auto unchanged = makeStr("unchanged");
} // namespace val
} // namespace cons_span
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry::cons_span

View File

@@ -177,14 +177,14 @@ public:
getJson() const;
//! Number of peers voting yes.
int
[[nodiscard]] int
getYays() const
{
return yays_;
}
//! Number of peers voting no.
int
[[nodiscard]] int
getNays() const
{
return nays_;

View File

@@ -39,8 +39,7 @@
#include <xrpl/proto/xrpl.pb.h>
#include <xrpl/telemetry/SpanGuard.h>
namespace xrpl {
namespace telemetry {
namespace xrpl::telemetry {
// Inline span name constants for consensus receive spans.
// Phase 4 will provide these via ConsensusSpanNames.h; these are
@@ -123,5 +122,4 @@ validationReceiveSpan([[maybe_unused]] protocol::TMValidation const& msg)
return SpanGuard::span(TraceCategory::Consensus, "consensus", "validation.receive");
}
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry

View File

@@ -32,8 +32,7 @@
#include <xrpl/proto/xrpl.pb.h>
#include <xrpl/telemetry/SpanGuard.h>
namespace xrpl {
namespace telemetry {
namespace xrpl::telemetry {
/** Inject trace context from an active SpanGuard into a protobuf
* TraceContext message for cross-node propagation.
@@ -58,5 +57,4 @@ injectSpanContext(SpanGuard const& span, protocol::TraceContext& proto)
proto.set_trace_flags(bytes.traceFlags);
}
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry

View File

@@ -16,8 +16,7 @@
#include <xrpl/proto/xrpl.pb.h>
#include <xrpl/telemetry/SpanGuard.h>
namespace xrpl {
namespace telemetry {
namespace xrpl::telemetry {
/** Create a "tx.receive" span for a transaction received from a peer.
* trace_id is derived from txID[0:16]. If the incoming message carries
@@ -59,5 +58,4 @@ txProcessSpan(uint256 const& txID)
TraceCategory::Transactions, tx_span::process, txID.data(), txID.bytes);
}
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry