You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To collect metrics I first tried to use otel-connect, but it did not fit the functionality, and I started to make my own interceptor, and faced the problem of getting active connections to the server. How can I find out how many active connections there are now and how can I monitor if a connection has been disconnected?
The text was updated successfully, but these errors were encountered:
@blackmarllbor0, nothing in Connect (or even in net/http, if using lower-level middleware) exposes socket details. So if you need to capture that sort of state for metrics or logging, you'd need to provide a custom listener when creating the server, and instrument that listener to handle accepting of new connections. The listener would also need to wrap the accepted net.Conn with a custom implementation that is instrumented to detect when the connection is closed and handle that.
There's a 3rd party library that does exactly this: https://github.com/mwitkow/go-conntrack
Note that we do not have experience with that particular library and don't necessarily endorse it, but it looks like the "right shape" for what you're trying to do.
To collect metrics I first tried to use otel-connect, but it did not fit the functionality, and I started to make my own interceptor, and faced the problem of getting active connections to the server. How can I find out how many active connections there are now and how can I monitor if a connection has been disconnected?
The text was updated successfully, but these errors were encountered: