Facility for rate-limited warnings
What shall we do when, as an onion service running in rproxy mode, we try to connect to a local service and get ECONNREFUSED
? We don't want to kill off the whole proxy, but we would like to inform the administrator that this has happened. But we don't want to log a warning every time that this warning happens: it could potentially happen every time a user tries to connect, which could be many thousands of times for a busy service. (There are other options besides logging a warning, but they are orthogonal, so let's not talk about them here.)
This is a specific case of a more general issue: Sometimes we want to produce a warning message for a condition that can happen many, many times, but we don't want to spam the logs.
In C tor, we have a facility to produce rate-limited logs. We use this for messages where we want to say "this is happening", "this is happening a lot" and/or "this is still happening". I propose that we add a similar facility in Arti.
I'm planning to do this unless somebody says it's a bad idea. (@Diziet @gabi-250?)