def collect_and_report
      return unless ::Instana.config[:metrics][:enabled]

      payload = {}
      with_snapshot = false

      # Run through the registered collectors and
      # get all the metrics
      #
      @collectors.each do |c|
        metrics = c.collect
        if metrics
          payload[c.payload_key] = metrics
        else
          payload.delete(c.payload_key)
        end
      end

      # Every 5 minutes, send snapshot data as well
      if (Time.now - @last_snapshot) > 600
        with_snapshot = true
        payload.merge!(@snapshot)

        # Add in process related that could have changed since
        # snapshot was taken.
        p = { :pid => ::Instana.agent.report_pid }
        p[:name] = ::Instana::Util.get_app_name
        p[:exec_args] = ::Instana.agent.process[:arguments]
        payload.merge!(p)
      else
        payload = enforce_deltas(payload, @last_values)
      end

      if ENV['INSTANA_GEM_TEST']
        true
      else
        # Report all the collected goodies
        if ::Instana.agent.report_metrics(payload) && with_snapshot
          @last_snapshot = Time.now
        end
      end
    end
def collect_and_report
      return unless ::Instana.config[:metrics][:enabled]

      payload = {}
      with_snapshot = false

      # Run through the registered collectors and
      # get all the metrics
      #
      @collectors.each do |c|
        metrics = c.collect
        if metrics
          payload[c.payload_key] = metrics
        else
          payload.delete(c.payload_key)
        end
      end

      # Every 5 minutes, send snapshot data as well
      if (Time.now - @last_snapshot) > 600
        with_snapshot = true
        payload.merge!(@snapshot)

        # Add in process related that could have changed since
        # snapshot was taken.
        p = { :pid => ::Instana.agent.report_pid }
        p[:name] = ::Instana::Util.get_app_name
        p[:exec_args] = ::Instana.agent.process[:arguments]
        payload.merge!(p)
      else
        payload = enforce_deltas(payload, @last_values)
      end

      if ENV['INSTANA_GEM_TEST']
        true
      else
        # Report all the collected goodies
        if ::Instana.agent.report_metrics(payload) && with_snapshot
          @last_snapshot = Time.now
        end
      end
    end
collect_and_report

 Run through each collector, let them collect up
 data and then report what we have via the agent

 @return Boolean true on success