Sha256: 5bc36bc00a3917502000b8b9e21b065597d555bc3869cead57ac7af6fb4081cf

Contents?: true

Size: 908 Bytes

Versions: 12

Compression:

Stored size: 908 Bytes

Contents

require 'timers'
require 'instana/collectors/gc'
require 'instana/collectors/memory'
require 'instana/collectors/thread'

module Instana
  module Collector
    class << self
      attr_accessor :interval
      attr_accessor :snapshot

      ##
      # collect_and_report
      #
      # Run through each collector, let them collect up
      # data and then report what we have via the agent
      #
      def collect_and_report
        payload = {}

        ::Instana.collectors.each do |c|
          metrics = c.collect
          if metrics
            payload[c.payload_key] = metrics
          else
            payload.delete(c.payload_key)
          end
        end

        # Report all the collected goodies
        ::Instana.agent.report_entity_data(payload)
      end

    end
  end
end

if ENV.key?('INSTANA_GEM_DEV')
  ::Instana::Collector.interval = 3
else
  ::Instana::Collector.interval = 1
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
instana-0.12.1 lib/instana/collectors.rb
instana-0.12.0 lib/instana/collectors.rb
instana-0.11.0 lib/instana/collectors.rb
instana-0.10.1 lib/instana/collectors.rb
instana-0.9.2 lib/instana/collectors.rb
instana-0.9.1 lib/instana/collectors.rb
instana-0.9.0 lib/instana/collectors.rb
instana-0.9.0.pre.slywolf3 lib/instana/collectors.rb
instana-0.8.6 lib/instana/collectors.rb
instana-0.8.4 lib/instana/collectors.rb
instana-0.8.3 lib/instana/collectors.rb
instana-0.8.2 lib/instana/collectors.rb