mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-13 11:11:30 -04:00
Increment prometheus proxy_total count once per IP
This fixes a regression from !574 that did not check whether the IP was unique before incrementing the counter. Closes https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/issues/40470
This commit is contained in:
parent
d7ebb2f99c
commit
58b1d48e54
1 changed files with 5 additions and 6 deletions
|
@ -104,6 +104,11 @@ func (m *Metrics) UpdateProxyStats(addr string, proxyType string, natType string
|
|||
if _, loaded := m.ips.LoadOrStore(addr, true); !loaded {
|
||||
m.IncrementCounter("proxy-total")
|
||||
incrementMapCounter(m.proxies, country)
|
||||
m.promMetrics.ProxyTotal.With(prometheus.Labels{
|
||||
"nat": natType,
|
||||
"type": proxyType,
|
||||
"cc": country,
|
||||
}).Inc()
|
||||
}
|
||||
|
||||
// update unique IP proxy NAT metrics
|
||||
|
@ -132,12 +137,6 @@ func (m *Metrics) UpdateProxyStats(addr string, proxyType string, natType string
|
|||
m.IncrementCounter("proxy-webext")
|
||||
}
|
||||
}
|
||||
|
||||
m.promMetrics.ProxyTotal.With(prometheus.Labels{
|
||||
"nat": natType,
|
||||
"type": proxyType,
|
||||
"cc": country,
|
||||
}).Inc()
|
||||
}
|
||||
|
||||
func (m *Metrics) UpdateClientStats(addr string, rendezvousMethod messages.RendezvousMethod, natType, status string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue