diff --git a/.github/scripts/levelization/results/ordering.txt b/.github/scripts/levelization/results/ordering.txt index 6799f10a4b..fd0ce7c924 100644 --- a/.github/scripts/levelization/results/ordering.txt +++ b/.github/scripts/levelization/results/ordering.txt @@ -328,6 +328,7 @@ xrpld.shamap > xrpl.nodestore xrpld.shamap > xrpl.protocol xrpld.shamap > xrpl.shamap xrpld.telemetry > xrpl.basics +xrpld.telemetry > xrpl.consensus xrpld.telemetry > xrpl.core xrpld.telemetry > xrpld.core xrpld.telemetry > xrpl.json diff --git a/cmake/XrplCore.cmake b/cmake/XrplCore.cmake index 6fc053adaa..5e023241d9 100644 --- a/cmake/XrplCore.cmake +++ b/cmake/XrplCore.cmake @@ -217,25 +217,16 @@ target_link_libraries( xrpl.libxrpl.conditions ) -add_module(xrpl tx) -target_link_libraries(xrpl.libxrpl.tx PUBLIC xrpl.libxrpl.ledger) - -add_module(xrpl consensus) -target_link_libraries( - xrpl.libxrpl.consensus - PUBLIC - xrpl.libxrpl.basics - xrpl.libxrpl.json - xrpl.libxrpl.protocol - 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 # opentelemetry-cpp::opentelemetry-cpp (individual component targets like # ::api, ::sdk are not available in the Conan package). # +# Declared before its consumers (consensus, tx) because add_module isolates +# each module's headers: a module can only include xrpl/telemetry/ headers if +# it links this target, and the target must already exist at that point. +# # Links xrpl.libxrpl.protocol PRIVATELY for sha512Half (digest.h) add_module(xrpl telemetry) target_link_libraries( @@ -255,6 +246,19 @@ if(telemetry) ) endif() +# Links xrpl.libxrpl.telemetry for the consensus tracing spans declared in +# include/xrpl/consensus/ConsensusSpanNames.h. +add_module(xrpl consensus) +target_link_libraries( + xrpl.libxrpl.consensus + PUBLIC + xrpl.libxrpl.basics + xrpl.libxrpl.json + xrpl.libxrpl.protocol + xrpl.libxrpl.ledger + xrpl.libxrpl.telemetry +) + add_module(xrpl tx) target_link_libraries( xrpl.libxrpl.tx diff --git a/include/xrpl/consensus/Consensus.h b/include/xrpl/consensus/Consensus.h index 6b06de688b..ed2069b17f 100644 --- a/include/xrpl/consensus/Consensus.h +++ b/include/xrpl/consensus/Consensus.h @@ -1,10 +1,5 @@ #pragma once -#include -#include -#include -#include - #include #include #include @@ -13,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/src/libxrpl/tx/applySteps.cpp b/src/libxrpl/tx/applySteps.cpp index f2f99e9536..0a7197c20c 100644 --- a/src/libxrpl/tx/applySteps.cpp +++ b/src/libxrpl/tx/applySteps.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include #include @@ -102,18 +103,24 @@ makeStageSpan( { span.setAttribute(telemetry::tx_apply_span::attr::stage, stage); if (char const* typeName = txTypeName(tx.getTxnType())) + { span.setAttribute(telemetry::tx_apply_span::attr::txType, typeName); + } // The ledger being worked on — set only by the view-bearing stages // (preclaim/transactor). Preflight is stateless and passes nullopt, so // it carries no ledger attribute (documented exception). if (curLedgerSeq) + { span.setAttribute( telemetry::tx_apply_span::attr::currentLedgerSeq, static_cast(*curLedgerSeq)); - if (curLedgerParentHash) + } + if (curLedgerParentHash != nullptr) + { span.setAttribute( telemetry::tx_apply_span::attr::currentLedgerHash, to_string(*curLedgerParentHash).c_str()); + } } return span; } diff --git a/src/xrpld/app/consensus/RCLConsensus.cpp b/src/xrpld/app/consensus/RCLConsensus.cpp index 1330abe089..4b3fd7aea3 100644 --- a/src/xrpld/app/consensus/RCLConsensus.cpp +++ b/src/xrpld/app/consensus/RCLConsensus.cpp @@ -16,9 +16,6 @@ #include #include #include -#include -#include -#include #include #include #include diff --git a/src/xrpld/overlay/detail/PeerImp.cpp b/src/xrpld/overlay/detail/PeerImp.cpp index e461046619..1de16b991e 100644 --- a/src/xrpld/overlay/detail/PeerImp.cpp +++ b/src/xrpld/overlay/detail/PeerImp.cpp @@ -12,7 +12,6 @@ #include #include #include -#include #include #include #include diff --git a/src/xrpld/telemetry/ConsensusReceiveTracing.h b/src/xrpld/telemetry/ConsensusReceiveTracing.h index 5b7582e13b..03974c5473 100644 --- a/src/xrpld/telemetry/ConsensusReceiveTracing.h +++ b/src/xrpld/telemetry/ConsensusReceiveTracing.h @@ -37,8 +37,7 @@ * validationReceive) so they stay in sync with the rest of Phase 4. */ -#include - +#include #include #include #include