seanwalbran-rpm_contrib 2.1.6.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. data/CHANGELOG +133 -0
  2. data/Gemfile +13 -0
  3. data/LICENSE +20 -0
  4. data/README.md +293 -0
  5. data/Rakefile +79 -0
  6. data/lib/new_relic/control/camping.rb +14 -0
  7. data/lib/rpm_contrib/agent_compatibility.rb +11 -0
  8. data/lib/rpm_contrib/detection/camping.rb +24 -0
  9. data/lib/rpm_contrib/detection.rb +5 -0
  10. data/lib/rpm_contrib/instrumentation/active_messaging.rb +22 -0
  11. data/lib/rpm_contrib/instrumentation/aws.rb +68 -0
  12. data/lib/rpm_contrib/instrumentation/camping.rb +50 -0
  13. data/lib/rpm_contrib/instrumentation/cassandra.rb +30 -0
  14. data/lib/rpm_contrib/instrumentation/crack.rb +41 -0
  15. data/lib/rpm_contrib/instrumentation/curb.rb +52 -0
  16. data/lib/rpm_contrib/instrumentation/elastic_search.rb +26 -0
  17. data/lib/rpm_contrib/instrumentation/kyototycoon.rb +28 -0
  18. data/lib/rpm_contrib/instrumentation/mongo.rb +50 -0
  19. data/lib/rpm_contrib/instrumentation/paperclip.rb +29 -0
  20. data/lib/rpm_contrib/instrumentation/picky.rb +41 -0
  21. data/lib/rpm_contrib/instrumentation/redis.rb +42 -0
  22. data/lib/rpm_contrib/instrumentation/resque.rb +83 -0
  23. data/lib/rpm_contrib/instrumentation/riak_client.rb +48 -0
  24. data/lib/rpm_contrib/instrumentation/ripple.rb +37 -0
  25. data/lib/rpm_contrib/instrumentation/sinatra.rb +30 -0
  26. data/lib/rpm_contrib/instrumentation/thinking_sphinx.rb +22 -0
  27. data/lib/rpm_contrib/instrumentation/typhoeus.rb +33 -0
  28. data/lib/rpm_contrib/instrumentation/ultrasphinx.rb +22 -0
  29. data/lib/rpm_contrib/instrumentation/workling.rb +27 -0
  30. data/lib/rpm_contrib/instrumentation/yajl.rb +41 -0
  31. data/lib/rpm_contrib/instrumentation.rb +16 -0
  32. data/lib/rpm_contrib/language_support.rb +31 -0
  33. data/lib/rpm_contrib/samplers.rb +17 -0
  34. data/lib/rpm_contrib.rb +36 -0
  35. data/test/helper.rb +9 -0
  36. data/test/schema.rb +19 -0
  37. data/test/test_curb.rb +69 -0
  38. data/test/test_picky.rb +55 -0
  39. data/test/test_redis.rb +34 -0
  40. data/test/test_resque.rb +74 -0
  41. data/test/test_workling.rb +34 -0
  42. metadata +148 -0
@@ -0,0 +1,50 @@
1
+ module RPMContrib
2
+ module Instrumentation
3
+ # == Instrumentation for Camping
4
+ # To instrument all controllers do the following:
5
+ # 1. Add require 'rpm_contrib' after loading camping.
6
+ # 2. Add an include at the end of your main Camping app module
7
+ # 3. Run the following command to get the NewRelic license key to use: heroku config -all
8
+ # 4. Create a newrelic.yml under the /config folder with the following content:
9
+ #
10
+ # common: &default_settings
11
+ # license_key: 'PASTE THE VALUE OF NEW_RELIC_LICENSE_KEY HERE'
12
+ # app_name: PASTE THE NAME OF YOUR CAMPING APP HERE
13
+ # monitor_mode: true
14
+ #
15
+ # production:
16
+ # <<: *default_settings
17
+ #
18
+ # Camping code example:
19
+ # -------------------------------------------------------------------------------------
20
+ #
21
+ # require "rpm_contrib"
22
+ #
23
+ # Camping.goes :NewRelicCampingTest
24
+ #
25
+ # module NewRelicCampingTest
26
+ # # your code
27
+ #
28
+ # include RPMContrib::Instrumentation::Camping
29
+ #
30
+ # end
31
+ #
32
+ #
33
+ module Camping
34
+
35
+ def self.included(mod)
36
+ require 'new_relic/agent/instrumentation/controller_instrumentation'
37
+ # Since the Camping::Base module is essentially copied
38
+ # into the main module (the mod passed in) of a Camping app
39
+ # using the Camping.goes :NewRelicCampingTest syntax
40
+ # we need to evaluate "weld" the NewRelic plugin in the context of the new Base
41
+
42
+ (Kernel.const_get(mod.name)::Base).module_eval do
43
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
44
+ add_transaction_tracer :service
45
+ end
46
+ end
47
+
48
+ end #RPMContrib::Instrumentation::Camping
49
+ end
50
+ end
@@ -0,0 +1,30 @@
1
+ DependencyDetection.defer do
2
+ @name = :cassandra
3
+
4
+ depends_on do
5
+ defined?(::Cassandra) && !NewRelic::Control.instance['disable_cassandra_instrumentation']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Cassandra instrumentation'
10
+ end
11
+
12
+ executes do
13
+ ::Cassandra.class_eval do
14
+ add_method_tracer :insert, 'Database/Cassandra/insert'
15
+ add_method_tracer :remove, 'Database/Cassandra/remove'
16
+ add_method_tracer :clear_column_family!, 'Database/Cassandra/clear_column_family!'
17
+ add_method_tracer :clear_keyspace!, 'Database/Cassandra/clear_keyspace!'
18
+ add_method_tracer :count_columns, 'Database/Cassandra/count_columns'
19
+ add_method_tracer :multi_count_columns, 'Database/Cassandra/multi_count_columns'
20
+ add_method_tracer :get_columns, 'Database/Cassandra/get_columns'
21
+ add_method_tracer :multi_get_columns, 'Database/Cassandra/multi_get_columns'
22
+ add_method_tracer :get, 'Database/Cassandra/get'
23
+ add_method_tracer :multi_get, 'Database/Cassandra/multi_get'
24
+ add_method_tracer :exists?, 'Database/Cassandra/exists?'
25
+ add_method_tracer :get_range, 'Database/Cassandra/get_range'
26
+ add_method_tracer :count_range, 'Database/Cassandra/count_range'
27
+ add_method_tracer :batch, 'Database/Cassandra/batch'
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,41 @@
1
+ DependencyDetection.defer do
2
+ @name = :crack_json
3
+
4
+ depends_on do
5
+ defined?(::Crack::JSON) && !NewRelic::Control.instance['disable_crack']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Crack::JSON instrumentation'
10
+ end
11
+
12
+ executes do
13
+ ::Crack::JSON.class_eval do
14
+ class << self
15
+ include NewRelic::Agent::MethodTracer
16
+ add_method_tracer :parse, 'Parser/#{self.name}/parse'
17
+ end
18
+ end
19
+ end
20
+ end
21
+
22
+ DependencyDetection.defer do
23
+ @name = :crack_xml
24
+
25
+ depends_on do
26
+ defined?(::Crack::XML) && !NewRelic::Control.instance['disable_crack']
27
+ end
28
+
29
+ executes do
30
+ NewRelic::Agent.logger.debug 'Installing Crack::XML instrumentation'
31
+ end
32
+
33
+ executes do
34
+ ::Crack::XML.class_eval do
35
+ class << self
36
+ include NewRelic::Agent::MethodTracer
37
+ add_method_tracer :parse, 'Parser/#{self.name}/parse'
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,52 @@
1
+ DependencyDetection.defer do
2
+ @name = :curb
3
+
4
+ depends_on do
5
+ defined?(::Curl) and not NewRelic::Control.instance['disable_curb']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Curb instrumentation'
10
+ end
11
+
12
+ executes do
13
+ ::Curl::Easy.class_eval do
14
+ def host
15
+ URI.parse(self.url).host
16
+ end
17
+
18
+ # TODO: http, http_delete, http_get, http_post, http_head, http_put
19
+ def perform_with_newrelic_trace(*args, &block)
20
+ metrics = ["External/#{host}/Curl::Easy","External/#{host}/all"]
21
+ if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
22
+ metrics << "External/allWeb"
23
+ else
24
+ metrics << "External/allOther"
25
+ end
26
+ self.class.trace_execution_scoped metrics do
27
+ perform_without_newrelic_trace(*args, &block)
28
+ end
29
+ end
30
+ alias perform_without_newrelic_trace perform
31
+ alias perform perform_with_newrelic_trace
32
+ end
33
+
34
+ ::Curl::Multi.class_eval do
35
+ # TODO: http
36
+ def perform_with_newrelic_trace(*args, &block)
37
+ metrics = ["External/Curl::Multi"]
38
+ if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
39
+ metrics << "External/allWeb"
40
+ else
41
+ metrics << "External/allOther"
42
+ end
43
+ self.class.trace_execution_scoped metrics do
44
+ perform_without_newrelic_trace(*args, &block)
45
+ end
46
+ end
47
+ alias perform_without_newrelic_trace perform
48
+ alias perform perform_with_newrelic_trace
49
+ end
50
+ end
51
+ end
52
+
@@ -0,0 +1,26 @@
1
+ # == Elastic Search Instrumentation
2
+ #
3
+ DependencyDetection.defer do
4
+ @name = :elastic_search
5
+
6
+ depends_on do
7
+ defined?(::ElasticSearch::Client) && !NewRelic::Control.instance['disable_elastic_search_instrumentation']
8
+ end
9
+
10
+ executes do
11
+ NewRelic::Agent.logger.debug 'Installing Elastic Search instrumentation'
12
+ end
13
+
14
+ executes do
15
+ ::ElasticSearch::Client.class_eval do
16
+ add_method_tracer :index, 'ActiveRecord/ElasticSearch/index'
17
+ add_method_tracer :get, 'ActiveRecord/ElasticSearch/get'
18
+ add_method_tracer :delete, 'ActiveRecord/ElasticSearch/delete'
19
+ add_method_tracer :search, 'ActiveRecord/ElasticSearch/search'
20
+ add_method_tracer :scroll, 'ActiveRecord/ElasticSearch/scroll'
21
+ add_method_tracer :count, 'ActiveRecord/ElasticSearch/count'
22
+ add_method_tracer :bulk, 'ActiveRecord/ElasticSearch/bulk'
23
+ end
24
+ end
25
+ end
26
+
@@ -0,0 +1,28 @@
1
+ # KyotoTycoon instrumentation
2
+
3
+ DependencyDetection.defer do
4
+ @name = :kyototycoon
5
+
6
+ depends_on do
7
+ defined?(::KyotoTycoon) && !NewRelic::Control.instance['disable_kyototycoon']
8
+ end
9
+
10
+ executes do
11
+ NewRelic::Agent.logger.debug 'Installing KyotoTycoon instrumentation'
12
+ end
13
+
14
+ executes do
15
+ ::KyotoTycoon.class_eval do
16
+ require 'new_relic/agent/method_tracer'
17
+ include NewRelic::Agent::MethodTracer
18
+
19
+ [:get, :remove, :set, :add, :replace,
20
+ :append, :cas, :increment, :decrement, :increment_double,
21
+ :set_bulk, :get_bulk, :remove_bulk, :clear, :vacuum,
22
+ :sync, :report, :status, :match_prefix, :match_regex,
23
+ :keys].each do |method|
24
+ add_method_tracer method
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,50 @@
1
+ # Mongo Instrumentation contributed by Alexey Palazhchenko
2
+ DependencyDetection.defer do
3
+ @name = :mongodb
4
+
5
+ depends_on do
6
+ defined?(::Mongo) and not NewRelic::Control.instance['disable_mongodb']
7
+ end
8
+
9
+ executes do
10
+ NewRelic::Agent.logger.debug 'Installing MongoDB instrumentation'
11
+ end
12
+
13
+ executes do
14
+ ::Mongo::Connection.class_eval do
15
+ include NewRelic::Agent::MethodTracer
16
+
17
+ def instrument_with_newrelic_trace(name, payload = {}, &blk)
18
+ collection = payload[:collection]
19
+ if collection == '$cmd'
20
+ f = payload[:selector].first
21
+ name, collection = f if f
22
+ end
23
+
24
+ trace_execution_scoped("Database/#{collection}/#{name}") do
25
+ t0 = Time.now
26
+ res = instrument_without_newrelic_trace(name, payload, &blk)
27
+ NewRelic::Agent.instance.transaction_sampler.notice_sql(payload.inspect, nil, (Time.now - t0).to_f)
28
+ res
29
+ end
30
+ end
31
+
32
+ alias_method :instrument_without_newrelic_trace, :instrument
33
+ alias_method :instrument, :instrument_with_newrelic_trace
34
+ end
35
+
36
+ ::Mongo::Cursor.class_eval do
37
+ include NewRelic::Agent::MethodTracer
38
+
39
+ def refresh_with_newrelic_trace
40
+ trace_execution_scoped("Database/#{collection.name}/refresh") do
41
+ refresh_without_newrelic_trace
42
+ end
43
+ end
44
+ alias_method :refresh_without_newrelic_trace, :refresh
45
+ alias_method :refresh, :refresh_with_newrelic_trace
46
+ add_method_tracer :close, 'Database/#{collection.name}/close'
47
+ end
48
+ end
49
+
50
+ end
@@ -0,0 +1,29 @@
1
+ DependencyDetection.defer do
2
+ @name = :paperclip
3
+
4
+ depends_on do
5
+ defined?(::Paperclip) && !NewRelic::Control.instance['disable_paperclip']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Paperclip instrumentation'
10
+ end
11
+
12
+ executes do
13
+ ::Paperclip::Attachment.class_eval do
14
+ add_method_tracer :save, 'Paperclip/#{name}/save'
15
+ add_method_tracer :assign, 'Paperclip/#{name}/assign'
16
+ add_method_tracer :post_process, 'Paperclip/#{name}/post_process'
17
+ end
18
+
19
+ ::Paperclip::Storage::Filesystem.class_eval do
20
+ add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
21
+ add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
22
+ end
23
+
24
+ ::Paperclip::Storage::S3.class_eval do
25
+ add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
26
+ add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,41 @@
1
+ if defined?(::Picky)
2
+
3
+ class Picky::NewRelic
4
+ def self.obfuscate_tokens tokens
5
+ tokens.map { |t|
6
+ o = 'xxx'
7
+ o += '~' if t.similar?
8
+ o += '*' if t.partial?
9
+ o = t.qualifiers.sort.join(',') + ':' + o if t.qualifiers && t.qualifiers.respond_to?(:join)
10
+ o
11
+ }.sort.join(' ')
12
+ end
13
+ end
14
+
15
+ end
16
+
17
+ DependencyDetection.defer do
18
+ @name = :picky
19
+
20
+ depends_on do
21
+ defined?(::Picky) && !NewRelic::Control.instance['disable_picky']
22
+ end
23
+
24
+ executes do
25
+ NewRelic::Agent.logger.debug 'Installing Picky instrumentation'
26
+ end
27
+
28
+ executes do
29
+ ::Picky::Search.class_eval do
30
+ include NewRelic::Agent::MethodTracer
31
+
32
+ def execute_with_newrelic_trace *args
33
+ metrics = "Custom/Picky/search: #{Picky::NewRelic.obfuscate_tokens args[0]}"
34
+ self.class.trace_execution_scoped(metrics){ execute_without_newrelic_trace(*args) }
35
+ end
36
+
37
+ alias_method :execute_without_newrelic_trace, :execute
38
+ alias_method :execute, :execute_with_newrelic_trace
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,42 @@
1
+ # Redis instrumentation contributed by Ashley Martens of ngmoco
2
+ #
3
+ DependencyDetection.defer do
4
+ @name = :redis
5
+
6
+ depends_on do
7
+ defined?(::Redis) && !NewRelic::Control.instance['disable_redis']
8
+ end
9
+
10
+ executes do
11
+ NewRelic::Agent.logger.debug 'Installing Redis instrumentation'
12
+ end
13
+
14
+ executes do
15
+ ::Redis::Client.class_eval do
16
+
17
+ include NewRelic::Agent::MethodTracer
18
+
19
+ def self.redis_call_method
20
+ ::Redis::Client.new.respond_to?(:call) ? :call : :raw_call_command
21
+ end
22
+
23
+
24
+ def raw_call_command_with_newrelic_trace *args
25
+ method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
26
+ metrics = ["Database/Redis/#{method_name}",
27
+ (NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction? ? 'Database/Redis/allWeb' : 'Database/Redis/allOther')]
28
+ self.class.trace_execution_scoped(metrics) do
29
+ # NewRelic::Control.instance.log.debug("Instrumenting Redis Call[#{method_name}]: #{args[0].inspect}")
30
+ raw_call_command_without_newrelic_trace(*args)
31
+ end
32
+ end
33
+
34
+ alias_method :raw_call_command_without_newrelic_trace, redis_call_method
35
+ alias_method redis_call_method, :raw_call_command_with_newrelic_trace
36
+
37
+ end
38
+ end
39
+ end
40
+
41
+
42
+
@@ -0,0 +1,83 @@
1
+ require 'rpm_contrib/language_support'
2
+
3
+ # call this now so it is memoized before potentially forking worker processes
4
+ RPMContrib::LanguageSupport.can_fork?
5
+
6
+ module Resque
7
+ module Plugins
8
+ module NewRelicInstrumentation
9
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
10
+
11
+ def around_perform_with_monitoring(*args)
12
+ begin
13
+ trace_options = if (defined?(::Backgrounded::Handler::ResqueHandler) && payload_class == ::Backgrounded::Handler::ResqueHandler)
14
+ {
15
+ :class_name => args[0],
16
+ :name => args[2].to_s,
17
+ :params => @payload,
18
+ :category => 'OtherTransaction/BackgroundedResqueJob'
19
+ }
20
+ else
21
+ {
22
+ :class_name => self.name,
23
+ :name => 'perform',
24
+ :category => 'OtherTransaction/ResqueJob'
25
+ }
26
+ end
27
+ perform_action_with_newrelic_trace(trace_options) do
28
+ yield(*args)
29
+ end
30
+ ensure
31
+ NewRelic::Agent.shutdown if RPMContrib::LanguageSupport.can_fork?
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ module RPMContrib
39
+ module Instrumentation
40
+ module ResqueInstrumentationInstaller
41
+ def payload_class
42
+ klass = super
43
+ klass.instance_eval do
44
+ extend ::Resque::Plugins::NewRelicInstrumentation
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+
51
+ DependencyDetection.defer do
52
+ @name = :resque
53
+
54
+ depends_on do
55
+ defined?(::Resque::Job) and not NewRelic::Control.instance['disable_resque']
56
+ end
57
+
58
+ executes do
59
+ NewRelic::Agent.logger.debug 'Installing Resque instrumentation'
60
+ end
61
+
62
+ executes do
63
+ # == Resque Instrumentation
64
+ #
65
+ # Installs a hook to ensure the agent starts manually when the worker
66
+ # starts and also adds the tracer to the process method which executes
67
+ # in the forked task.
68
+ ::Resque::Job.class_eval do
69
+ def self.new(*args)
70
+ super(*args).extend RPMContrib::Instrumentation::ResqueInstrumentationInstaller
71
+ end
72
+ end
73
+
74
+ ::Resque.before_first_fork do
75
+ NewRelic::Agent.manual_start(:dispatcher => :resque,
76
+ :sync_startup => true)
77
+ end
78
+
79
+ ::Resque.after_fork do
80
+ NewRelic::Agent.after_fork(:force_reconnect => false)
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,48 @@
1
+ DependencyDetection.defer do
2
+ @name = :riak_client
3
+
4
+ depends_on do
5
+ defined?(::Riak) and not NewRelic::Control.instance['disable_riak_client']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Riak client instrumentation'
10
+ end
11
+
12
+ executes do
13
+ backend_tracers = proc do
14
+ add_method_tracer :ping, 'Database/Riak/ping'
15
+
16
+ add_method_tracer :list_buckets, 'Database/Riak/list_buckets'
17
+ add_method_tracer :get_bucket_props, 'Database/Riak/get_bucket_props'
18
+ add_method_tracer :set_bucket_props, 'Database/Riak/set_bucket_props'
19
+
20
+ add_method_tracer :mapred, 'Database/Riak/mapred'
21
+
22
+ add_method_tracer :list_keys, 'Database/Riak/list_keys'
23
+ add_method_tracer :fetch_object, 'Database/Riak/fetch_object'
24
+ add_method_tracer :reload_object, 'Database/Riak/reload_object'
25
+ add_method_tracer :store_object, 'Database/Riak/store_object'
26
+ add_method_tracer :delete_object, 'Database/Riak/delete_object'
27
+ end
28
+
29
+ ::Riak::Client::BeefcakeProtobuffsBackend.class_eval &backend_tracers
30
+ ::Riak::Client::BeefcakeProtobuffsBackend.class_eval do
31
+ add_method_tracer :server_info, 'Database/Riak/server_info'
32
+ add_method_tracer :get_client_id, 'Database/Riak/get_client_id'
33
+ add_method_tracer :set_client_id, 'Database/Riak/set_client_id'
34
+ end
35
+ ::Riak::Client::HTTPBackend.class_eval &backend_tracers
36
+ ::Riak::Client::HTTPBackend.class_eval do
37
+ add_method_tracer :stats, 'Database/Riak/stats'
38
+ add_method_tracer :link_walk, 'Database/Riak/link_walk'
39
+ add_method_tracer :get_index, 'Database/Riak/get_index'
40
+ add_method_tracer :search, 'Database/Riak/search'
41
+ add_method_tracer :update_search_index, 'Database/Riak/update_search_index'
42
+ end
43
+
44
+ ::Riak::RObject.class_eval do
45
+ add_method_tracer :serialize, 'Database/Riak/serialize'
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,37 @@
1
+ DependencyDetection.defer do
2
+ @name = :ripple
3
+
4
+ depends_on do
5
+ defined?(::Ripple) and not
6
+ NewRelic::Control.instance['disable_ripple']
7
+ end
8
+
9
+ executes do
10
+ NewRelic::Agent.logger.debug 'Installing Ripple instrumentation'
11
+ end
12
+
13
+ executes do
14
+ ::Ripple::Callbacks::InstanceMethods.class_eval do
15
+ add_method_tracer :valid?, 'Database/Riak/Ripple/valid?'
16
+ end
17
+
18
+ ::Ripple::Document::Persistence::ClassMethods.class_eval do
19
+ add_method_tracer :create, 'Database/Riak/Ripple/create'
20
+ add_method_tracer :destroy_all, 'Database/Riak/Ripple/destroy_all'
21
+ end
22
+
23
+ ::Ripple::Document::Persistence::InstanceMethods.class_eval do
24
+ add_method_tracer :really_save, 'Database/Riak/Ripple/really_save'
25
+ add_method_tracer :reload, 'Database/Riak/Ripple/reload'
26
+ add_method_tracer :delete, 'Database/Riak/Ripple/delete'
27
+ add_method_tracer :destroy, 'Database/Riak/Ripple/destroy'
28
+ add_method_tracer :update_attribute, 'Database/Riak/Ripple/update_attribute'
29
+ add_method_tracer :update_attributes, 'Database/Riak/Ripple/update_attributes'
30
+ end
31
+
32
+ ::Ripple::Document::Finders::ClassMethods.class_eval do
33
+ add_method_tracer :find, 'Database/Riak/Ripple/find'
34
+ add_method_tracer :list, 'Database/Riak/Ripple/list'
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,30 @@
1
+ DependencyDetection.defer do
2
+ @name = :sinatra_view
3
+
4
+ depends_on do
5
+ defined?(::Sinatra::Base) and not NewRelic::Control.instance['disable_sinatra_template']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Sinatra view instrumentation'
10
+ end
11
+
12
+ executes do
13
+ ::Sinatra::Base.class_eval do
14
+ def render_with_newrelic_trace(*args, &block)
15
+ engine, file = *args
16
+ return render_without_newrelic_trace(*args, &block) if file == "= yield"
17
+
18
+ file = "Proc" if file.is_a?(Proc)
19
+ metrics = ["View/#{engine}/#{file}/Rendering"]
20
+
21
+ self.class.trace_execution_scoped metrics do
22
+ render_without_newrelic_trace(*args, &block)
23
+ end
24
+ end
25
+
26
+ alias render_without_newrelic_trace render
27
+ alias render render_with_newrelic_trace
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,22 @@
1
+ DependencyDetection.defer do
2
+ @name = :thinking_sphinx
3
+
4
+ depends_on do
5
+ defined?(::ThinkingSphinx) and not ::NewRelic::Control.instance['disable_thinking_sphinx']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Thinking Sphinx instrumentation'
10
+ end
11
+
12
+ executes do
13
+ class ::ThinkingSphinx::Search
14
+ include NewRelic::Agent::MethodTracer
15
+
16
+ add_method_tracer :initialize
17
+ add_method_tracer :populate
18
+ add_method_tracer :results
19
+ end
20
+ end
21
+ end
22
+
@@ -0,0 +1,33 @@
1
+ DependencyDetection.defer do
2
+ @name = :typhoeus
3
+
4
+ depends_on do
5
+ defined?(::Typhoeus) and not ::NewRelic::Control.instance['disable_typhoeus']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Typhoeus instrumentation'
10
+ end
11
+
12
+ executes do
13
+ require 'uri'
14
+ ::Typhoeus::Request.instance_eval do
15
+ def get_with_newrelic_trace(*args, &block)
16
+ uri = URI.parse(args.first)
17
+ metrics = ["External/#{uri.host}/Typhoeus/GET","External/#{uri.host}/all"]
18
+ if NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction?
19
+ metrics << "External/allWeb"
20
+ else
21
+ metrics << "External/allOther"
22
+ end
23
+ self.class.trace_execution_scoped metrics do
24
+ get_without_newrelic_trace(*args, &block)
25
+ end
26
+ end
27
+ alias get_without_newrelic_trace get
28
+ alias get get_with_newrelic_trace
29
+ end
30
+ end
31
+ end
32
+
33
+
@@ -0,0 +1,22 @@
1
+ DependencyDetection.defer do
2
+ @name = :ultrasphinx
3
+
4
+ depends_on do
5
+ defined?(::Ultrasphinx) and not ::NewRelic::Control.instance['disable_ultrasphinx']
6
+ end
7
+
8
+ executes do
9
+ NewRelic::Agent.logger.debug 'Installing Ultrasphinx instrumentation'
10
+ end
11
+
12
+ executes do
13
+ class ::Ultrasphinx::Search
14
+ include NewRelic::Agent::MethodTracer
15
+
16
+ add_method_tracer :run
17
+ add_method_tracer :results
18
+ end
19
+ end
20
+ end
21
+
22
+