From 04f351f3b74199e02206568594369c312c69d78f Mon Sep 17 00:00:00 2001 From: Pratik Mankawde <3397372+pratikmankawde@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:55:19 +0100 Subject: [PATCH] fix(telemetry): more phase-7 review fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - ValidationTracker: remove dead hard-trim Pass 1. The preceding eviction loop already erases every reconciled entry older than the late-repair cutoff using the same condition, so Pass 1 could never match. The "drop any reconciled entry" fallback is retained. - integration-test.sh: probe the StatsD port with a UDP-aware check (ss -ulnp) instead of curl. StatsD is UDP-only on 8125, so the TCP curl probe always reported "refused" — a false negative. Guarded by a command -v ss check that logs a skip when ss is unavailable. Co-Authored-By: Claude Opus 4.8 (1M context) --- docker/telemetry/integration-test.sh | 12 +++++++---- .../telemetry/detail/ValidationTracker.cpp | 20 +++---------------- 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/docker/telemetry/integration-test.sh b/docker/telemetry/integration-test.sh index 2c9b1f49af..3e9ac410f2 100755 --- a/docker/telemetry/integration-test.sh +++ b/docker/telemetry/integration-test.sh @@ -580,11 +580,15 @@ check_otel_metric "rippled_total_Bytes_In" # Verify StatsD receiver is NOT required (no statsd receiver in pipeline) log "" log "--- Verify StatsD receiver is not required ---" -statsd_port_check=$(curl -sf "http://localhost:8125" 2>&1 || echo "refused") -if echo "$statsd_port_check" | grep -qi "refused\|error\|connection"; then - ok "StatsD port 8125 is not listening (not required)" +# StatsD listens on UDP 8125, so probe with a UDP-aware tool, not curl (TCP). +if command -v ss >/dev/null 2>&1; then + if ss -ulnp 2>/dev/null | grep -q ":8125"; then + fail "StatsD port 8125 appears to be listening (should not be needed)" + else + ok "StatsD port 8125 is not listening (not required)" + fi else - fail "StatsD port 8125 appears to be listening (should not be needed)" + log "ss not found -- skipping StatsD UDP port check" fi # --------------------------------------------------------------------------- diff --git a/src/xrpld/telemetry/detail/ValidationTracker.cpp b/src/xrpld/telemetry/detail/ValidationTracker.cpp index 38e065d8b5..17ec00fde3 100644 --- a/src/xrpld/telemetry/detail/ValidationTracker.cpp +++ b/src/xrpld/telemetry/detail/ValidationTracker.cpp @@ -126,25 +126,11 @@ ValidationTracker::evictOldPending(TimePoint now) } } - // Hard trim if still over limit -- remove reconciled entries that are - // past the late-repair window first, then any reconciled entry as a - // last resort. + // Hard trim if still over limit. The loop above already removed every + // reconciled entry older than the late-repair window, so here we drop + // any remaining reconciled entry as a last resort. if (pending_.size() > kMaxPendingEvents) { - // Pass 1: only entries past late-repair window. - for (auto it = pending_.begin(); - it != pending_.end() && pending_.size() > kMaxPendingEvents;) - { - if (it->second.reconciled && it->second.recordTime < cutoff) - { - it = pending_.erase(it); - } - else - { - ++it; - } - } - // Pass 2: any reconciled entry if still over limit. for (auto it = pending_.begin(); it != pending_.end() && pending_.size() > kMaxPendingEvents;) {