From f3e040bbd8007990ff055c1e8b04cd059bc1d35e Mon Sep 17 00:00:00 2001 From: WofWca Date: Sat, 15 Mar 2025 00:15:36 +0400 Subject: [PATCH] improvement: less scary failed conn logs & metrics ...and adjust the `totalFailedConnections` metric name and description. This commit should make the periodic stats log messages and the relevant metric look less scary to users: P2P connection failures are relatively frequent and are usually not indicative of the proxy operator having done something wrong. So let's tone the wording down. See the discussion: https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/merge_requests/516#note_3173677. --- common/event/interface.go | 4 ++-- proxy/lib/metrics.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/common/event/interface.go b/common/event/interface.go index 66fdbf8..dfb3f97 100644 --- a/common/event/interface.go +++ b/common/event/interface.go @@ -108,8 +108,8 @@ type EventOnProxyStats struct { } func (e EventOnProxyStats) String() string { - statString := fmt.Sprintf("In the last %v, there were %v completed successful connections. %v connections failed to establish. Traffic Relayed ↓ %v %v (%.2f %v%s), ↑ %v %v (%.2f %v%s).", - e.SummaryInterval.String(), e.ConnectionCount, e.FailedConnectionCount, + statString := fmt.Sprintf("In the last %v, there were %v completed successful connections. Traffic Relayed ↓ %v %v (%.2f %v%s), ↑ %v %v (%.2f %v%s).", + e.SummaryInterval.String(), e.ConnectionCount, e.InboundBytes, e.InboundUnit, float64(e.InboundBytes)/e.SummaryInterval.Seconds(), e.InboundUnit, "/s", e.OutboundBytes, e.OutboundUnit, float64(e.OutboundBytes)/e.SummaryInterval.Seconds(), e.OutboundUnit, "/s") return statString diff --git a/proxy/lib/metrics.go b/proxy/lib/metrics.go index 78aefc8..24dd776 100644 --- a/proxy/lib/metrics.go +++ b/proxy/lib/metrics.go @@ -30,8 +30,8 @@ func NewMetrics() *Metrics { ), totalFailedConnections: prometheus.NewCounter(prometheus.CounterOpts{ Namespace: metricNamespace, - Name: "failed_connections_total", - Help: "The total number of client connection attempts that failed after successful rendezvous", + Name: "connection_timeouts_total", + Help: "The total number of client connection attempts that failed after successful rendezvous. Note that failures can occur for reasons outside of the proxy's control, such as the client's NAT and censorship situation.", }), totalInBoundTraffic: prometheus.NewCounter(prometheus.CounterOpts{ Namespace: metricNamespace,