mirror of
https://github.com/XRPLF/rippled.git
synced 2026-09-28 15:58:07 +00:00
PeerImp::onMessage(TMValidation) runs once per inbound validation message, and it reaches these attribute calls before the HashRouter duplicate check, so every peer's copy of every validation paid for them. Span setAttribute is a real inline function whose arguments are evaluated even when telemetry is compiled out, and to_string(val->getLedgerHash()) heap-allocates a 64-character hex string on each call. Wrap the ledger_hash and full_validation attributes in if (valSpan), so neither the string build nor the flags lookup behind isFull() runs when telemetry is compiled out, when it is switched off in the config, or when the Peer trace category is disabled. A span that exists but was sampled out still pays; there is no isRecording() to test. peer_id and validation_trusted stay unguarded: their arguments are an integer cast and a bool the surrounding logic already computes.