bigcommerce / gruf

gRPC Ruby Framework
https://github.com/bigcommerce/gruf
MIT License
626 stars 73 forks source link

Use `ActiveSupport::Notifications::Instrument` instead of `event_listener_proc` #210

Open heka1024 opened 5 months ago

heka1024 commented 5 months ago

What? Why?

How about use ActiveSupport::Notifications::Instrument to publish thread_pool_exhausted and unimplemented error?

Many Ruby developers are more familiar with the interface of ActiveSupport::Notifications::Instrument, and it'll make it easier to use with multiple listeners. Additionally, this approach allows us to simplify the implementation in these lines: https://github.com/bigcommerce/gruf/blob/c4c4d9ed631796502ce53fd32c2243e13cd303f7/lib/gruf/server.rb#L69-L74

Since we already have activesupport as a dependency, we can use it without adding any external dependencies. https://github.com/bigcommerce/gruf/blob/7ce8f7a3b8d261656575ebb97daf4e048f406e3c/gruf.gemspec#L60