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::Subscriber #168

Open
hennevogel opened this issue Mar 24, 2021 · 1 comment
Open

Use ActiveSupport::Subscriber #168

hennevogel opened this issue Mar 24, 2021 · 1 comment

Comments

@hennevogel
Copy link
Collaborator

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.

@hennevogel
Copy link
Collaborator Author

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

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

No branches or pull requests

1 participant