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
I'm using this library in an environment where everything in running in Docker containers with non-DNS based service discovery.
To use this library, I have a custom implementation of IEndPointSource that hooks up to the service discovery framework and will always return an up to date Endpoint with the right IP address of Statsd server. So SocketTransport instance will always know how to talk to Statsd.
However there are cases where the Statsd server isn't running or is unavailable for an extended period of time. Now since metrics aren't critical to running an app, it should be ok to skip sending metrics until Statsd is back up and operational. However the problem is with UDP sockets on Linux, if the endpoint isn't running it will return a connection refused error (this behaviour is Linux only based on this issue https://github.com/dotnet/corefx/issues/31206)
I was thinking if it's possible to allow IEndPointSource to return null from GetEndpoint to indicate the endpoint isn't running or not available. Then the Send method in SocketTransport can handle this condition by returning immediately instead of attempting to use a Socket to send metrics.
The current behaviour doesn't cause any exceptions to the app since by default errors will be ignored, however the socket refused error usually adds a bit of delay for each failed send call and with the approach above this can be avoided.
The text was updated successfully, but these errors were encountered:
yousifh
changed the title
[Feature Request] Skip sending metrics if endpoint not available
[Feature Request] Skip sending metrics if endpoint is not available
Apr 6, 2019
I'm using this library in an environment where everything in running in Docker containers with non-DNS based service discovery.
To use this library, I have a custom implementation of
IEndPointSource
that hooks up to the service discovery framework and will always return an up to dateEndpoint
with the right IP address of Statsd server. SoSocketTransport
instance will always know how to talk to Statsd.However there are cases where the Statsd server isn't running or is unavailable for an extended period of time. Now since metrics aren't critical to running an app, it should be ok to skip sending metrics until Statsd is back up and operational. However the problem is with UDP sockets on Linux, if the endpoint isn't running it will return a connection refused error (this behaviour is Linux only based on this issue https://github.com/dotnet/corefx/issues/31206)
I was thinking if it's possible to allow
IEndPointSource
to return null fromGetEndpoint
to indicate the endpoint isn't running or not available. Then theSend
method inSocketTransport
can handle this condition by returning immediately instead of attempting to use a Socket to send metrics.So this code block
Would change to
The current behaviour doesn't cause any exceptions to the app since by default errors will be ignored, however the socket refused error usually adds a bit of delay for each failed send call and with the approach above this can be avoided.
The text was updated successfully, but these errors were encountered: