kisielk / gostatsd

An implementation of Etsy's statsd in Go
MIT License
91 stars 10 forks source link

Make GraphiteClient retry connection #3

Open danw-volley opened 10 years ago

danw-volley commented 10 years ago

gostatsd is fragile in sense that if Graphite is restarted, the gostatsd also has to be restarted because it will never try to re-establish the connection. This also makes it hard to create robust init scrpts because if Graphite isn't listening when gostatsd is started, then gostatsd will exit. Just because Graphite is started and running doesn't mean it is listening, because it does some init stuff before opening a socket.

kisielk commented 10 years ago

Definitely. Do you have any interest in working on this?

danw-volley commented 10 years ago

At this point I think statsite is a better fit for our needs, but I did look at the code. It appears quite easy to fix, rather than connecting in NewGraphiteClient, just store the address and connect on each call to SendMetrics. The extra overhead of a new connection in SendMetrics is fairly trivial compared to the increase in robustness.

kisielk commented 10 years ago

Yeah, I know how it could be fixed, I was just wondering if you were interested in working on fixing it. The project is not on the top of my priority list right now. statsite is definitely a way more mature implementation.