graylog-labs / gelf-rb

Ruby GELF library (Graylog Extended Log Format)

Home Page:https://rubygems.org/gems/gelf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is GELF::Notifier thread safe?

defsprite opened this issue · comments

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?

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!

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

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