diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index ad34e623b2..61b3d4ea3d 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -50,6 +50,7 @@ libxrpl.tx > xrpl.json libxrpl.tx > xrpl.ledger libxrpl.tx > xrpl.protocol libxrpl.tx > xrpl.server +libxrpl.tx > xrpl.telemetry libxrpl.tx > xrpl.tx test.app > test.jtx test.app > test.unit_test diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index fab45c2901..bbbb2d49ee 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -189,9 +189,6 @@ target_link_libraries( xrpl.libxrpl.conditions ) -add_module(xrpl tx) -target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger) - # Telemetry module — OpenTelemetry distributed tracing support. # Sources: include/xrpl/telemetry/ (headers), src/libxrpl/telemetry/ (impl). # When telemetry=ON, links the Conan-provided umbrella target @@ -209,6 +206,12 @@ if(telemetry) ) endif() +add_module(xrpl tx) +target_link_libraries( + xrpl.libxrpl.tx + PUBLIC xrpl.libxrpl.ledger xrpl.libxrpl.telemetry +) + add_library(xrpl.libxrpl) set_target_properties(xrpl.libxrpl PROPERTIES OUTPUT_NAME xrpl) diff --git a/src/libxrpl/tx/Transactor.cpp b/src/libxrpl/tx/Transactor.cpp index 28fa059902..5df0504004 100644 --- a/src/libxrpl/tx/Transactor.cpp +++ b/src/libxrpl/tx/Transactor.cpp @@ -34,9 +34,12 @@ #include #include #include +#include #include #include #include +#include +#include #include #include #include @@ -1193,6 +1196,13 @@ Transactor::checkInvariants(TER result, XRPAmount fee) ApplyResult Transactor::operator()() { + auto span = telemetry::SpanGuard::span( + telemetry::TraceCategory::Transactions, + telemetry::seg::tx, + telemetry::makeStr("transactor")); + if (auto const* fmt = TxFormats::getInstance().findByType(ctx_.tx.getTxnType())) + span.setAttribute("tx_type", fmt->getName().c_str()); + JLOG(j_.trace()) << "apply: " << ctx_.tx.getTransactionID(); // These global updates really should have been for every Transaction @@ -1419,6 +1429,9 @@ Transactor::operator()() JLOG(j_.trace()) << (applied ? "applied " : "not applied ") << transToken(result); + span.setAttribute("ter_result", transToken(result).c_str()); + span.setAttribute("applied", applied); + return {result, applied, metadata}; }