Skip to content

broker: what does `snowflake_proxy_total` mean?

I've been analyzing https://snowflake-broker.torproject.net/prometheus for #40384 and trying to make sense of snowflake_proxy_total. Its comment says "The number of unique snowflake IPs".

But, does it show the number of proxy IPs seen in the last 24 hours? It cannot be the case, because this counter does not get reset in zeroMetrics, much like rounded_client_poll_total, and never gets decreased. And if you look at old_snowflake_broker_prometheus_2024-12-01.txt, you can see clearly that this is not the case if you look at, for example, snowflake_proxy_total{cc="US",nat="restricted",type="iptproxy"}, which is at 952983, which already is much greater than the total number if proxy IPs we see daily (https://snowflake-broker.torproject.net/metrics). The sum of all snowflake_proxy_total is much greater: 15,094,495.

So, does it show the total number of IPs that we ever received a proxy poll from? This also does not make sense. Because we increase the counter here, which only happens if the address is not already recorded (see this piece of code), but the IPs database gets reset here, and it happens every 24 hours.

This means that the growth rate and the value of snowflake_proxy_total depends a lot on how often we zeroMetrics(). If we were to zeroMetrics() every couple of seconds, the metric would effectively turn into the "total proxy polls" counter and not a unique IP counter. On the contrary, if we were to never zeroMetrics(), we'd get the total number of IPs that we ever received a proxy poll from in the run time of the broker.

To summarize, I think this metric does not show the correct and intended value of whatever it's supposed to measure.