graylog-labs / gelf-rb

Ruby GELF library (Graylog Extended Log Format)
https://rubygems.org/gems/gelf
MIT License
153 stars 104 forks source link

Is GELF::Notifier thread safe? #48

Closed defsprite closed 5 years ago

defsprite commented 8 years ago

I'm using a shared instance of GELF::Notifier in a preforked, threading server (puma), but looking at https://github.com/Graylog2/gelf-rb/blob/master/lib/gelf/notifier.rb#L155 I have noticed that the construction of the payload works via the instance variable @hash

Is this approach thread safe?

Shouldn't we mimic the approach taken in GELF::Transport::UDP and make the hash thread local or refactor to pass the resulting hash from method to method?

milgner commented 8 years ago

Yes, this is something that has been bothering me as well and is on my list of to-dos for this project. But feel free to submit a pull request, I'll gladly incorporate it!

milgner commented 8 years ago

My bad, I just realized that this is the issue for #49. Closing it in favour of the PR ticket :)

defsprite commented 5 years ago

Closing this as #49 has been merged long time ago.