mullvad / udp-over-tcp

Proxy UDP traffic over a TCP stream
Apache License 2.0
377 stars 61 forks source link

Add (optional) statsd metrics reporting #51

Closed faern closed 10 months ago

faern commented 11 months ago

To better monitor the health of the tcp2udp (WireGuard over TCP server side component) service, we should add simple error metrics to it. After discussion with @Rizzly we agreed on adding a counter that shows number of connected clients, and an error event when we fail to accept incoming TCP connections.

I added it in such a way that both the library and the binary can be compiled without statsd support. This makes the entire dependency optional. Just like we have done with clap and env_logger. This forced me to expose a dummy-layer of the metrics so the code still builds when it's not enabled, and so the metrics callsites did not become too complex (I did not want the metrics reporting to interfere a lot with the actual forwarding logic code)


This change is Reviewable