influxdb-rails
influxdb-rails copied to clipboard
Use ActiveSupport::Subscriber
We could get rid of a lot of code in InfluxDB::Rails::Railtie
if we inherit from ActiveSupport::Subscriber
in our own Subscriber
classes and subscribe to the events in that way.
And together with concurrent-ruby
we could truly move out of the way of the request cycle with our stuff...
module ActionController
class StatsSubscriber < ActiveSupport::Subscriber
include Concurrent::Async
attach_to :action_controller
def process_action(event)
async.send_instrumentation(event)
end
def send_instrumentation(event)
# do our stuff...
end
end
end