Merge branch 'pratik/otel-phase6-statsd' into pratik/otel-phase7-native-metrics

This commit is contained in:
Pratik Mankawde
2026-04-30 17:14:34 +01:00
5 changed files with 19 additions and 25 deletions

View File

@@ -14,13 +14,15 @@
#include <xrpl/ledger/Ledger.h>
#include <xrpl/ledger/OpenView.h>
#include <xrpl/nodestore/NodeObject.h>
#include <xrpl/protocol/Feature.h>
#include <xrpl/protocol/LedgerHeader.h>
#include <xrpl/protocol/Protocol.h>
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/telemetry/SpanNames.h>
#include <xrpl/tx/apply.h>
#include <chrono>
#include <cstddef>
#include <cstdint>
#include <exception>
#include <memory>
#include <set>

View File

@@ -57,6 +57,7 @@
#include <xrpl/shamap/SHAMapMissingNode.h>
#include <xrpl/shamap/SHAMapTreeNode.h>
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/telemetry/SpanNames.h>
#include <boost/icl/concept/interval_set.hpp>

View File

@@ -15,9 +15,7 @@
#include <xrpl/telemetry/SpanNames.h>
namespace xrpl {
namespace telemetry {
namespace ledger_span {
namespace xrpl::telemetry::ledger_span {
// ===== Span operation suffixes ===============================================
@@ -49,6 +47,4 @@ inline constexpr auto txFailed = join(xrplLedger, makeStr("tx_failed"));
inline constexpr auto validations = join(xrplLedger, makeStr("validations"));
} // namespace attr
} // namespace ledger_span
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry::ledger_span

View File

@@ -68,6 +68,7 @@
#include <xrpl/server/NetworkOPs.h>
#include <xrpl/shamap/SHAMapNodeID.h>
#include <xrpl/telemetry/SpanGuard.h>
#include <xrpl/telemetry/SpanNames.h>
#include <xrpl/tx/apply.h>
#include <boost/algorithm/string/predicate.hpp>
@@ -1966,17 +1967,16 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMProposeSet> const& m)
app_.getTimeKeeper().closeTime(),
calcNodeID(app_.getValidatorManifests().getMasterKey(publicKey))});
// Create a receive span that links to the sender's trace context
// (if propagated). shared_ptr keeps it alive across the job boundary.
auto span = std::make_shared<telemetry::SpanGuard>(telemetry::proposalReceiveSpan(set));
span->setAttribute(telemetry::cons_span::attr::trusted, isTrusted);
span->setAttribute(telemetry::cons_span::attr::round, static_cast<int64_t>(set.proposeseq()));
auto consSpan = std::make_shared<telemetry::SpanGuard>(telemetry::proposalReceiveSpan(set));
consSpan->setAttribute(telemetry::cons_span::attr::trusted, isTrusted);
consSpan->setAttribute(
telemetry::cons_span::attr::round, static_cast<int64_t>(set.proposeseq()));
std::weak_ptr<PeerImp> const weak = shared_from_this();
app_.getJobQueue().addJob(
isTrusted ? jtPROPOSAL_t : jtPROPOSAL_ut,
"checkPropose",
[weak, isTrusted, m, proposal, sp = std::move(span)]() {
[weak, isTrusted, m, proposal, sp = std::move(consSpan)]() {
if (auto peer = weak.lock())
peer->checkPropose(isTrusted, m, proposal);
});
@@ -2560,13 +2560,12 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
return;
}
// Create a receive span that links to the sender's trace context
// (if propagated). shared_ptr keeps it alive across the job boundary.
auto span = std::make_shared<telemetry::SpanGuard>(telemetry::validationReceiveSpan(*m));
span->setAttribute(telemetry::cons_span::attr::trusted, isTrusted);
auto consSpan =
std::make_shared<telemetry::SpanGuard>(telemetry::validationReceiveSpan(*m));
consSpan->setAttribute(telemetry::cons_span::attr::trusted, isTrusted);
if (val->isFieldPresent(sfLedgerSequence))
{
span->setAttribute(
consSpan->setAttribute(
telemetry::cons_span::attr::ledgerSeq,
static_cast<int64_t>(val->getFieldU32(sfLedgerSequence)));
}
@@ -2583,7 +2582,7 @@ PeerImp::onMessage(std::shared_ptr<protocol::TMValidation> const& m)
app_.getJobQueue().addJob(
isTrusted ? jtVALIDATION_t : jtVALIDATION_ut,
name,
[weak, val, m, key, sp = std::move(span)]() {
[weak, val, m, key, sp = std::move(consSpan)]() {
if (auto peer = weak.lock())
peer->checkValidation(val, key, m);
});

View File

@@ -13,9 +13,7 @@
#include <xrpl/telemetry/SpanNames.h>
namespace xrpl {
namespace telemetry {
namespace peer_span {
namespace xrpl::telemetry::peer_span {
// ===== Span operation suffixes ===============================================
@@ -45,6 +43,4 @@ inline constexpr auto validationTrusted =
join(join(xrplPeer, makeStr("validation")), makeStr("trusted"));
} // namespace attr
} // namespace peer_span
} // namespace telemetry
} // namespace xrpl
} // namespace xrpl::telemetry::peer_span