Sha256: ccca0f9394b42408c0d654f8156700b8005d3d815ab7acb647736c67f0b119d2

Contents?: true

Size: 725 Bytes

Versions: 34

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module Appsignal
  class Hooks
    # @api private
    class PumaHook < Appsignal::Hooks::Hook
      register :puma

      def dependencies_present?
        defined?(::Puma) &&
          Gem::Version.new(Puma::Const::VERSION) >= Gem::Version.new("3.0.0")
      end

      def install
        require "appsignal/integrations/puma"
        ::Puma::Server.prepend(Appsignal::Integrations::PumaServer)

        return unless defined?(::Puma::Cluster)

        # For clustered mode with multiple workers
        ::Puma::Cluster.send(:prepend, Module.new do
          def stop_workers
            Appsignal.stop("puma cluster")
            super
          end
        end)
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
appsignal-4.3.3-java lib/appsignal/hooks/puma.rb
appsignal-4.3.3 lib/appsignal/hooks/puma.rb
appsignal-4.3.2-java lib/appsignal/hooks/puma.rb
appsignal-4.3.2 lib/appsignal/hooks/puma.rb
appsignal-4.3.1-java lib/appsignal/hooks/puma.rb
appsignal-4.3.1 lib/appsignal/hooks/puma.rb
appsignal-4.3.0-java lib/appsignal/hooks/puma.rb
appsignal-4.3.0 lib/appsignal/hooks/puma.rb
appsignal-4.2.3-java lib/appsignal/hooks/puma.rb
appsignal-4.2.3 lib/appsignal/hooks/puma.rb
appsignal-4.2.2-java lib/appsignal/hooks/puma.rb
appsignal-4.2.2 lib/appsignal/hooks/puma.rb
appsignal-4.2.1-java lib/appsignal/hooks/puma.rb
appsignal-4.2.1 lib/appsignal/hooks/puma.rb
appsignal-4.2.0-java lib/appsignal/hooks/puma.rb
appsignal-4.2.0 lib/appsignal/hooks/puma.rb
appsignal-4.1.3-java lib/appsignal/hooks/puma.rb
appsignal-4.1.3 lib/appsignal/hooks/puma.rb
appsignal-4.1.2-java lib/appsignal/hooks/puma.rb
appsignal-4.1.2 lib/appsignal/hooks/puma.rb