Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
heka1024 opened this issue May 23, 2024 · 0 comments

Comments

@heka1024
Copy link
Contributor

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:

gruf/lib/gruf/server.rb

Lines 69 to 74 in c4c4d9e

server = if @event_listener_proc
server_options[:event_listener_proc] = @event_listener_proc
Gruf::InstrumentableGrpcServer.new(**server_options)
else
GRPC::RpcServer.new(**server_options)
end

Since we already have activesupport as a dependency, we can use it without adding any external dependencies.

spec.add_runtime_dependency 'activesupport', '> 4'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant