Skip to content

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

@heka1024

Description

@heka1024

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'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions