Sha256: 2efafba420ea6cc35e3561a154159f4545f9638e11ea7076a85c5ec423ff66a9

Contents?: true

Size: 888 Bytes

Versions: 23

Compression:

Stored size: 888 Bytes

Contents

module Appsignal
  # @api private
  class Minutely
    class << self
      # List of probes. Probes can be lamdba's or objects that
      # respond to call.
      def probes
        @@probes ||= []
      end

      def start
        Thread.new do
          begin
            loop do
              Appsignal.logger.debug("Gathering minutely metrics with #{probes.count} probe(s)")
              probes.each(&:call)
              sleep(wait_time)
            end
          rescue => ex
            Appsignal.logger.error("Error in minutely thread: #{ex}")
          end
        end
      end

      def wait_time
        60 - Time.now.sec
      end

      def add_gc_probe
        probes << GCProbe.new
      end
    end

    class GCProbe
      def call
        GC.stat.each do |key, value|
          Appsignal.set_process_gauge("gc.#{key}", value)
        end
      end
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
appsignal-2.5.3-java lib/appsignal/minutely.rb
appsignal-2.5.3 lib/appsignal/minutely.rb
appsignal-2.5.3.alpha.2 lib/appsignal/minutely.rb
appsignal-2.5.3.alpha.2-java lib/appsignal/minutely.rb
appsignal-2.5.3.alpha.1 lib/appsignal/minutely.rb
appsignal-2.5.3.alpha.1-java lib/appsignal/minutely.rb
appsignal-2.5.2-java lib/appsignal/minutely.rb
appsignal-2.5.2 lib/appsignal/minutely.rb
appsignal-2.5.1-java lib/appsignal/minutely.rb
appsignal-2.5.1 lib/appsignal/minutely.rb
appsignal-2.5.1.beta.1-java lib/appsignal/minutely.rb
appsignal-2.5.1.beta.1 lib/appsignal/minutely.rb
appsignal-2.5.0-java lib/appsignal/minutely.rb
appsignal-2.5.0 lib/appsignal/minutely.rb
appsignal-2.5.0.beta.1-java lib/appsignal/minutely.rb
appsignal-2.5.0.beta.1 lib/appsignal/minutely.rb
appsignal-2.5.0.alpha.1-java lib/appsignal/minutely.rb
appsignal-2.5.0.alpha.1 lib/appsignal/minutely.rb
appsignal-2.4.3 lib/appsignal/minutely.rb
appsignal-2.4.2 lib/appsignal/minutely.rb