Sha256: aa01471d4b2237c57b345501e074cce4c0d9490b70fc578bc20aa188e75b0851

Contents?: true

Size: 1.04 KB

Versions: 17

Compression:

Stored size: 1.04 KB

Contents

$: << File.expand_path('../lib', File.dirname(__FILE__))
require 'sneakers'
require 'sneakers/runner'
require 'sneakers/metrics/newrelic_metrics'
require 'open-uri'
require 'nokogiri'
require 'newrelic_rpm'

# With this configuration will send two types of data to newrelic server:
# 1. Transaction data which you would see under  'Applications'
# 2. Metrics where you will be able to see by configuring a dashboardi, available for enterprise accounts
#
# You should have newrelic.yml in the 'config' folder with the proper account settings

Sneakers::Metrics::NewrelicMetrics.eagent ::NewRelic
Sneakers.configure metrics: Sneakers::Metrics::NewrelicMetrics.new

class MetricsWorker
  include Sneakers::Worker
  include ::NewRelic::Agent::Instrumentation::ControllerInstrumentation

  from_queue 'downloads'

  def work(msg)
    doc = Nokogiri::HTML(open(msg))
    logger.info "FOUND <#{doc.css('title').text}>"
    ack!
  end
  
  add_transaction_tracer :work, name: 'MetricsWorker', params: 'args[0]'

end


r = Sneakers::Runner.new([ MetricsWorker ])
r.run




Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
sneakers-2.3.5 examples/newrelic_metrics_worker.rb
sneakers-2.3.4 examples/newrelic_metrics_worker.rb
sneakers-2.3.2 examples/newrelic_metrics_worker.rb
sneakers-2.3.1 examples/newrelic_metrics_worker.rb
sneakers-2.3.0 examples/newrelic_metrics_worker.rb
sneakers-2.2.1 examples/newrelic_metrics_worker.rb
sneakers-2.2.0 examples/newrelic_metrics_worker.rb
sneakers-2.1.0 examples/newrelic_metrics_worker.rb
sneakers-1.1.2 examples/newrelic_metrics_worker.rb
sneakers-1.1.1 examples/newrelic_metrics_worker.rb
sneakers-1.1.0 examples/newrelic_metrics_worker.rb
sneakers_custom_bunny-1.0.4 examples/newrelic_metrics_worker.rb
sneakers-1.0.4 examples/newrelic_metrics_worker.rb
sneakers-1.0.3 examples/newrelic_metrics_worker.rb
sneakers-1.0.2 examples/newrelic_metrics_worker.rb
sneakers-1.0.1 examples/newrelic_metrics_worker.rb
sneakers-1.0.0 examples/newrelic_metrics_worker.rb