Sha256: cdeacf33ed881de273dbc9d5ac8df5cf3678401033ee012178776a74a110335d

Contents?: true

Size: 1.45 KB

Versions: 15

Compression:

Stored size: 1.45 KB

Contents

module NewRelic
  module Agent
    class PipeService
      attr_reader :channel_id, :buffer
      attr_accessor :request_timeout, :agent_id, :collector
      
      def initialize(channel_id)
        @channel_id = channel_id
        @collector = NewRelic::Control::Server.new(:name => 'parent',
                                                   :port => 0)
      end
      
      def connect(config)
        nil
      end

      def get_agent_commands
        []
      end

      def metric_data(last_harvest_time, now, unsent_timeslice_data)
        write_to_pipe(:stats => hash_from_metric_data(unsent_timeslice_data))
        {}
      end

      def transaction_sample_data(transactions)
        write_to_pipe(:transaction_traces => transactions) if transactions
      end

      def error_data(errors)
        write_to_pipe(:error_traces => errors) if errors
      end

      def sql_trace_data(sql)
        write_to_pipe(:sql_traces => sql) if sql
      end
      
      def shutdown(time)
        write_to_pipe('EOF')
        NewRelic::Agent::PipeChannelManager.channels[@channel_id].close
      end
      
      private

      def hash_from_metric_data(metric_data)
        metric_hash = {}
        metric_data.each do |metric_entry|
          metric_hash[metric_entry.metric_spec] = metric_entry
        end
        metric_hash
      end

      def write_to_pipe(data)
        NewRelic::Agent::PipeChannelManager.channels[@channel_id].write(data)
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
newrelic_rpm-3.5.6.48.beta lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.6.46.beta lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.6.42.beta lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.5.39.beta lib/new_relic/agent/pipe_service.rb
wd_newrelic_rpm-3.5.5 lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.5.38 lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.5.540.dev lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.4.35.beta lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.4.34 lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.4.33 lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.4.31.beta lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.4.29.beta lib/new_relic/agent/pipe_service.rb
ghazel-newrelic_rpm-3.5.4 lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.3.25 lib/new_relic/agent/pipe_service.rb
newrelic_rpm-3.5.3.24 lib/new_relic/agent/pipe_service.rb