Sha256: 54f05f8fed62019b4721a1e5eba8dfc2709fc5385e82b3c1f082e4f305db8a39

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

module Librato
  module Rails
    module Subscribers

      # ActionJob

      %w{enqueue_at enqueue perform_start perform}.each do |metric|

        ActiveSupport::Notifications.subscribe "#{metric}.active_job" do |*args|

          event = ActiveSupport::Notifications::Event.new(*args)
          tags = {
            adapter: event.payload[:adapter].to_s.demodulize.underscore,
            job: event.payload[:job].class.to_s.demodulize.underscore
          }

          collector.group "rails.job" do |c|
            c.increment metric, tags: tags, inherit_tags: true
            c.timing "#{metric}.time", event.duration, tags: tags, inherit_tags: true
          end # end group

        end # end subscribe

      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
librato-rails-2.0.0 lib/librato/rails/subscribers/job.rb