rpm_contrib 1.0.13 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/Rakefile +1 -1
- data/lib/rpm_contrib/detection.rb +7 -0
- data/lib/rpm_contrib/instrumentation/aws/s3.rb +58 -50
- data/lib/rpm_contrib/instrumentation/aws.rb +7 -0
- data/lib/rpm_contrib/instrumentation/cassandra.rb +26 -20
- data/lib/rpm_contrib/instrumentation/paperclip.rb +26 -20
- data/lib/rpm_contrib/instrumentation/redis.rb +29 -23
- data/lib/rpm_contrib/instrumentation/resque.rb +20 -22
- data/lib/rpm_contrib/instrumentation.rb +11 -0
- data/lib/rpm_contrib.rb +3 -7
- metadata +15 -14
- data/lib/rpm_contrib/instrumentation/mongo_mapper.rb +0 -44
- data/lib/rpm_contrib/instrumentation/mongoid.rb +0 -51
data/CHANGELOG
CHANGED
data/Rakefile
CHANGED
@@ -22,7 +22,7 @@ begin
|
|
22
22
|
gem.email = "support@newrelic.com"
|
23
23
|
gem.homepage = "http://github.com/newrelic/rpm_contrib"
|
24
24
|
gem.author = "Bill Kayser"
|
25
|
-
gem.add_dependency 'newrelic_rpm', '>=
|
25
|
+
gem.add_dependency 'newrelic_rpm', '>=3.0.0'
|
26
26
|
gem.version = version
|
27
27
|
gem.files = FileList['LICENSE', 'README*', 'lib/**/*.rb', 'bin/*', '[A-Z]*', 'test/**/*'].to_a
|
28
28
|
gem.rdoc_options <<
|
@@ -1,56 +1,64 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module RpmContrib
|
2
|
+
module Instrumentation
|
3
|
+
module Aws
|
4
|
+
module S3
|
5
|
+
# Instrumentation for the AWS-S3 gem for New Relic RPM by Brian Doll
|
6
|
+
if defined?(::AWS::S3) && !NewRelic::Control.instance['disable_aws-s3']
|
3
7
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
+
# Instrument connections to the AWS-S3 service
|
9
|
+
::AWS::S3::Connection::Management::ClassMethods.module_eval do
|
10
|
+
add_method_tracer :establish_connection!, 'AWS-S3/establish_connection!'
|
11
|
+
end
|
8
12
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
# Instrument methods on Bucket
|
14
|
+
::AWS::S3::Bucket.instance_eval do
|
15
|
+
class << self
|
16
|
+
add_method_tracer :create, 'AWS-S3/Bucket/create'
|
17
|
+
add_method_tracer :find, 'AWS-S3/Bucket/find'
|
18
|
+
add_method_tracer :objects, 'AWS-S3/Bucket/objects'
|
19
|
+
add_method_tracer :delete, 'AWS-S3/Bucket/delete'
|
20
|
+
add_method_tracer :list, 'AWS-S3/Bucket/list'
|
21
|
+
end
|
22
|
+
end
|
19
23
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
# Instrument methods on Bucket instances
|
25
|
+
::AWS::S3::Bucket.class_eval do
|
26
|
+
add_method_tracer :[], 'AWS-S3/Bucket/#{self.name}/[]'
|
27
|
+
add_method_tracer :new_object,'AWS-S3/Bucket/#{self.name}/new_objects'
|
28
|
+
add_method_tracer :objects, 'AWS-S3/Bucket/#{self.name}/objects'
|
29
|
+
add_method_tracer :delete, 'AWS-S3/Bucket/#{self.name}/delete'
|
30
|
+
add_method_tracer :delete_all,'AWS-S3/Bucket/#{self.name}/delete_all'
|
31
|
+
add_method_tracer :update, 'AWS-S3/Bucket/#{self.name}/update'
|
32
|
+
end
|
29
33
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
# Instrument methods on S3Object
|
35
|
+
::AWS::S3::S3Object.instance_eval do
|
36
|
+
class << self
|
37
|
+
add_method_tracer :about, 'AWS-S3/S3Object/about'
|
38
|
+
add_method_tracer :copy, 'AWS-S3/S3Object/copy'
|
39
|
+
add_method_tracer :delete, 'AWS-S3/S3Object/delete'
|
40
|
+
add_method_tracer :rename, 'AWS-S3/S3Object/rename'
|
41
|
+
add_method_tracer :store, 'AWS-S3/S3Object/store'
|
42
|
+
end
|
43
|
+
end
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
45
|
+
# Instrument methods on S3Object instances
|
46
|
+
# Metric names are aggregated across all S3Objects since having a metric for
|
47
|
+
# every single S3Object instance and method pair would be fairly useless
|
48
|
+
::AWS::S3::S3Object.class_eval do
|
49
|
+
add_method_tracer :value, 'AWS-S3/S3Objects/value'
|
50
|
+
add_method_tracer :about, 'AWS-S3/S3Objects/about'
|
51
|
+
add_method_tracer :metadata, 'AWS-S3/S3Objects/metadata'
|
52
|
+
add_method_tracer :store, 'AWS-S3/S3Objects/store'
|
53
|
+
add_method_tracer :delete, 'AWS-S3/S3Objects/delete'
|
54
|
+
add_method_tracer :copy, 'AWS-S3/S3Objects/copy'
|
55
|
+
add_method_tracer :rename, 'AWS-S3/S3Objects/rename'
|
56
|
+
add_method_tracer :etag, 'AWS-S3/S3Objects/etag'
|
57
|
+
add_method_tracer :owner, 'AWS-S3/S3Objects/owner'
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
54
63
|
end
|
55
|
-
|
56
|
-
end
|
64
|
+
end
|
@@ -1,23 +1,29 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module RpmContrib
|
2
|
+
module Instrumentation
|
3
|
+
module Cassandra
|
4
|
+
# == Cassandra Instrumentation
|
5
|
+
#
|
3
6
|
|
4
|
-
if defined?(::Cassandra) and not NewRelic::Control.instance['disable_cassandra_instrumentation']
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
7
|
+
if defined?(::Cassandra) and not NewRelic::Control.instance['disable_cassandra_instrumentation']
|
8
|
+
|
9
|
+
::Cassandra.class_eval do
|
10
|
+
add_method_tracer :insert, 'Database/Cassandra/insert'
|
11
|
+
add_method_tracer :remove, 'Database/Cassandra/remove'
|
12
|
+
add_method_tracer :clear_column_family!, 'Database/Cassandra/clear_column_family!'
|
13
|
+
add_method_tracer :clear_keyspace!, 'Database/Cassandra/clear_keyspace!'
|
14
|
+
add_method_tracer :count_columns, 'Database/Cassandra/count_columns'
|
15
|
+
add_method_tracer :multi_count_columns, 'Database/Cassandra/multi_count_columns'
|
16
|
+
add_method_tracer :get_columns, 'Database/Cassandra/get_columns'
|
17
|
+
add_method_tracer :multi_get_columns, 'Database/Cassandra/multi_get_columns'
|
18
|
+
add_method_tracer :get, 'Database/Cassandra/get'
|
19
|
+
add_method_tracer :multi_get, 'Database/Cassandra/multi_get'
|
20
|
+
add_method_tracer :exists?, 'Database/Cassandra/exists?'
|
21
|
+
add_method_tracer :get_range, 'Database/Cassandra/get_range'
|
22
|
+
add_method_tracer :count_range, 'Database/Cassandra/count_range'
|
23
|
+
add_method_tracer :batch, 'Database/Cassandra/batch'
|
24
|
+
end
|
22
25
|
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
23
29
|
end
|
@@ -1,22 +1,28 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
1
|
+
module RpmContrib
|
2
|
+
module Instrumentation
|
3
|
+
module Paperclip
|
4
|
+
# Paperclip Instrumentation.
|
5
|
+
|
6
|
+
if defined?(::Paperclip) && !NewRelic::Control.instance['disable_paperclip']
|
7
|
+
|
8
|
+
::Paperclip::Attachment.class_eval do
|
9
|
+
add_method_tracer :save, 'Paperclip/#{name}/save'
|
10
|
+
add_method_tracer :assign, 'Paperclip/#{name}/assign'
|
11
|
+
add_method_tracer :post_process, 'Paperclip/#{name}/post_process'
|
12
|
+
end
|
13
|
+
|
14
|
+
::Paperclip::Storage::Filesystem.class_eval do
|
15
|
+
add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
|
16
|
+
add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
|
17
|
+
end
|
18
|
+
|
19
|
+
::Paperclip::Storage::S3.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
|
+
end
|
25
|
+
|
26
|
+
end
|
9
27
|
end
|
10
|
-
|
11
|
-
::Paperclip::Storage::Filesystem.class_eval do
|
12
|
-
add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
|
13
|
-
add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
|
14
|
-
end
|
15
|
-
|
16
|
-
::Paperclip::Storage::S3.class_eval do
|
17
|
-
add_method_tracer :flush_deletes, 'Paperclip/Storage/flush_deletes'
|
18
|
-
add_method_tracer :flush_writes, 'Paperclip/Storage/flush_writes'
|
19
|
-
end
|
20
|
-
|
21
28
|
end
|
22
|
-
|
@@ -1,33 +1,39 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module RpmContrib
|
2
|
+
module Instrumentation
|
3
|
+
module Redis
|
4
|
+
# Redis instrumentation contributed by Ashley Martens of ngmoco
|
5
|
+
#
|
3
6
|
|
4
|
-
if defined?(::Redis) and not NewRelic::Control.instance['disable_redis']
|
7
|
+
if defined?(::Redis) and not NewRelic::Control.instance['disable_redis']
|
5
8
|
|
6
9
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
+
::Redis::Client.class_eval do
|
11
|
+
|
12
|
+
include NewRelic::Agent::MethodTracer
|
10
13
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
+
def self.redis_call_method
|
15
|
+
::Redis::Client.new.respond_to?(:call) ? :call : :raw_call_command
|
16
|
+
end
|
14
17
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
18
|
+
|
19
|
+
def raw_call_command_with_newrelic_trace *args
|
20
|
+
method_name = args[0].is_a?(Array) ? args[0][0] : args[0]
|
21
|
+
metrics = ["Database/Redis/#{method_name}",
|
22
|
+
(NewRelic::Agent::Instrumentation::MetricFrame.recording_web_transaction? ? 'Database/Redis/allWeb' : 'Database/Redis/allOther')]
|
23
|
+
self.class.trace_execution_scoped(metrics) do
|
24
|
+
# NewRelic::Control.instance.log.debug("Instrumenting Redis Call[#{method_name}]: #{args[0].inspect}")
|
25
|
+
raw_call_command_without_newrelic_trace(*args)
|
26
|
+
end
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
29
|
+
alias_method :raw_call_command_without_newrelic_trace, redis_call_method
|
30
|
+
alias_method redis_call_method, :raw_call_command_with_newrelic_trace
|
31
|
+
|
32
|
+
end
|
30
33
|
|
31
34
|
|
32
35
|
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
33
39
|
end
|
@@ -1,34 +1,32 @@
|
|
1
1
|
|
2
2
|
module RPMContrib
|
3
3
|
module Instrumentation
|
4
|
-
# == Resque Instrumentation
|
5
|
-
#
|
6
|
-
# Installs a hook to ensure the agent starts manually when the worker
|
7
|
-
# starts and also adds the tracer to the process method which executes
|
8
|
-
# in the forked task.
|
9
4
|
module ResqueInstrumentation
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
old_perform_method = instance_method(:perform)
|
5
|
+
Resque.before_first_fork do
|
6
|
+
NewRelic::Agent.manual_start(:dispatcher => :resque)
|
7
|
+
end
|
14
8
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
perform_action_with_newrelic_trace(:name => 'perform', :class_name => class_name,
|
19
|
-
:category => 'OtherTransaction/ResqueJob') do
|
20
|
-
old_perform_method.bind(self).call
|
21
|
-
end
|
9
|
+
Resque.after_fork do
|
10
|
+
NewRelic::Agent.after_fork(:force_reconnect => false)
|
11
|
+
end
|
22
12
|
|
23
|
-
|
24
|
-
|
13
|
+
Resque.before_child_exit do
|
14
|
+
NewRelic::Agent.shutdown
|
25
15
|
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end if defined?(::Resque) and not NewRelic::Control.instance['disable_resque']
|
19
|
+
|
20
|
+
module Resque
|
21
|
+
module Plugins
|
22
|
+
module NewRelicInstrumentation
|
23
|
+
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
26
24
|
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
def around_perform_with_monitoring(*args)
|
26
|
+
perform_action_with_newrelic_trace(:name => 'perform', :class_name => class_name, :category => 'OtherTransaction/ResqueJob') do
|
27
|
+
yield(*args)
|
30
28
|
end
|
31
29
|
end
|
32
30
|
end
|
33
31
|
end
|
34
|
-
end
|
32
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rpm_contrib/instrumentation/cassandra'
|
2
|
+
require 'rpm_contrib/instrumentation/camping'
|
3
|
+
require 'rpm_contrib/instrumentation/paperclip'
|
4
|
+
require 'rpm_contrib/instrumentation/redis'
|
5
|
+
require 'rpm_contrib/instrumentation/resque'
|
6
|
+
require 'rpm_contrib/instrumentation/aws'
|
7
|
+
|
8
|
+
module RpmContrib
|
9
|
+
module Instrumentation
|
10
|
+
end
|
11
|
+
end
|
data/lib/rpm_contrib.rb
CHANGED
@@ -16,13 +16,9 @@ module RPMContrib
|
|
16
16
|
end
|
17
17
|
|
18
18
|
end
|
19
|
-
|
20
19
|
# Perform any framework/dispatcher detection before loading the rpm gem.
|
21
|
-
|
22
|
-
|
23
|
-
Dir.glob(RPM_CONTRIB_LIB + "/rpm_contrib/detection/**/*.rb") { |file| require file }
|
24
|
-
|
25
|
-
require 'newrelic_rpm'
|
20
|
+
require 'rpm_contrib/detection'
|
21
|
+
raise "The rpm_contrib gem must be loaded before the newrelic_rpm gem." unless require 'newrelic_rpm'
|
26
22
|
|
27
23
|
if defined? Rails
|
28
24
|
# Rails 3.x+
|
@@ -40,4 +36,4 @@ if defined? Rails
|
|
40
36
|
end
|
41
37
|
else
|
42
38
|
RPMContrib.init_sequence.call
|
43
|
-
end
|
39
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rpm_contrib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
|
-
-
|
7
|
+
- 2
|
8
|
+
- 0
|
8
9
|
- 0
|
9
|
-
|
10
|
-
version: 1.0.13
|
10
|
+
version: 2.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Bill Kayser
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-05-11 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 7
|
30
30
|
segments:
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
version:
|
31
|
+
- 3
|
32
|
+
- 0
|
33
|
+
- 0
|
34
|
+
version: 3.0.0
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
description: |
|
@@ -54,13 +54,14 @@ files:
|
|
54
54
|
- Rakefile
|
55
55
|
- lib/new_relic/control/camping.rb
|
56
56
|
- lib/rpm_contrib.rb
|
57
|
+
- lib/rpm_contrib/detection.rb
|
57
58
|
- lib/rpm_contrib/detection/camping.rb
|
58
59
|
- lib/rpm_contrib/detection/resque.rb
|
60
|
+
- lib/rpm_contrib/instrumentation.rb
|
61
|
+
- lib/rpm_contrib/instrumentation/aws.rb
|
59
62
|
- lib/rpm_contrib/instrumentation/aws/s3.rb
|
60
63
|
- lib/rpm_contrib/instrumentation/camping.rb
|
61
64
|
- lib/rpm_contrib/instrumentation/cassandra.rb
|
62
|
-
- lib/rpm_contrib/instrumentation/mongo_mapper.rb
|
63
|
-
- lib/rpm_contrib/instrumentation/mongoid.rb
|
64
65
|
- lib/rpm_contrib/instrumentation/paperclip.rb
|
65
66
|
- lib/rpm_contrib/instrumentation/redis.rb
|
66
67
|
- lib/rpm_contrib/instrumentation/resque.rb
|
@@ -104,7 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
105
|
requirements: []
|
105
106
|
|
106
107
|
rubyforge_project:
|
107
|
-
rubygems_version: 1.
|
108
|
+
rubygems_version: 1.5.2
|
108
109
|
signing_key:
|
109
110
|
specification_version: 3
|
110
111
|
summary: Contributed Instrumentation for New Relic RPM
|
@@ -1,44 +0,0 @@
|
|
1
|
-
if defined?(::MongoMapper) && !NewRelic::Control.instance['disable_mongodb']
|
2
|
-
|
3
|
-
module RPMContrib::Instrumentation
|
4
|
-
# Just drop this little diddy in your app to get some (not perfect) information
|
5
|
-
# on query times and such.
|
6
|
-
#
|
7
|
-
# Currently only MongoMapper is implemented
|
8
|
-
module MongoMapper
|
9
|
-
def self.included(model)
|
10
|
-
model.class_eval do
|
11
|
-
class << self
|
12
|
-
add_method_tracer :find, 'Database/#{self.name}/find'
|
13
|
-
add_method_tracer :find!, 'Database/#{self.name}/find!'
|
14
|
-
add_method_tracer :paginate, 'Database/#{self.name}/paginate'
|
15
|
-
add_method_tracer :first, 'Database/#{self.name}/first'
|
16
|
-
add_method_tracer :last, 'Database/#{self.name}/last'
|
17
|
-
add_method_tracer :all, 'Database/#{self.name}/all'
|
18
|
-
add_method_tracer :count, 'Database/#{self.name}/count'
|
19
|
-
add_method_tracer :create, 'Database/#{self.name}/create'
|
20
|
-
add_method_tracer :create!, 'Database/#{self.name}/create!'
|
21
|
-
add_method_tracer :update, 'Database/#{self.name}/update'
|
22
|
-
add_method_tracer :delete, 'Database/#{self.name}/delete'
|
23
|
-
add_method_tracer :delete_all, 'Database/#{self.name}/delete_all'
|
24
|
-
add_method_tracer :destroy, 'Database/#{self.name}/destroy'
|
25
|
-
add_method_tracer :destroy_all, 'Database/#{self.name}/destroy_all'
|
26
|
-
add_method_tracer :exists?, 'Database/#{self.name}/exists?'
|
27
|
-
add_method_tracer :find_by_id, 'Database/#{self.name}/find_by_id'
|
28
|
-
add_method_tracer :increment, 'Database/#{self.name}/increment'
|
29
|
-
add_method_tracer :decrement, 'Database/#{self.name}/decrement'
|
30
|
-
add_method_tracer :set, 'Database/#{self.name}/set'
|
31
|
-
add_method_tracer :push, 'Database/#{self.name}/push'
|
32
|
-
add_method_tracer :push_all, 'Database/#{self.name}/push_all'
|
33
|
-
add_method_tracer :push_uniq, 'Database/#{self.name}/push_uniq'
|
34
|
-
add_method_tracer :pull, 'Database/#{self.name}/pull'
|
35
|
-
add_method_tracer :pull_all, 'Database/#{self.name}/pull_all'
|
36
|
-
end
|
37
|
-
|
38
|
-
add_method_tracer :save, 'Database/#{self.class.name}/save'
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
::MongoMapper::Document.append_inclusions(::RPMContrib::Instrumentation::MongoMapper)
|
43
|
-
end
|
44
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
if defined?(::Mongoid) && !NewRelic::Control.instance['disable_mongodb']
|
2
|
-
|
3
|
-
module Mongoid #:nodoc:
|
4
|
-
module Document
|
5
|
-
|
6
|
-
#adding call to super
|
7
|
-
class << self
|
8
|
-
alias :old_included :included
|
9
|
-
|
10
|
-
def included(model)
|
11
|
-
old_included(model)
|
12
|
-
super
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
module RPMContrib::Instrumentation
|
19
|
-
|
20
|
-
module Mongoid
|
21
|
-
def included(model)
|
22
|
-
model.class_eval do
|
23
|
-
class << self
|
24
|
-
add_method_tracer :create, 'Database/#{self.name}/create'
|
25
|
-
add_method_tracer :create!, 'Database/#{self.name}/create!'
|
26
|
-
add_method_tracer :delete_all, 'Database/#{self.name}/delete_all'
|
27
|
-
add_method_tracer :destroy_all, 'Database/#{self.name}/destroy_all'
|
28
|
-
add_method_tracer :all, 'Database/#{self.name}/all'
|
29
|
-
add_method_tracer :find, 'Database/#{self.name}/find'
|
30
|
-
add_method_tracer :first, 'Database/#{self.name}/first'
|
31
|
-
add_method_tracer :last, 'Database/#{self.name}/last'
|
32
|
-
add_method_tracer :find_or_create_by, 'Database/#{self.name}/find_or_create_by'
|
33
|
-
add_method_tracer :find_or_initialize_by, 'Database/#{self.name}/find_or_initialize_by'
|
34
|
-
add_method_tracer :min, 'Database/#{self.name}/min'
|
35
|
-
add_method_tracer :max, 'Database/#{self.name}/max'
|
36
|
-
add_method_tracer :sum, 'Database/#{self.name}/sum'
|
37
|
-
end
|
38
|
-
|
39
|
-
add_method_tracer :update_attributes, 'Database/#{self.class.name}/update_attributes'
|
40
|
-
add_method_tracer :update_attributes!, 'Database/#{self.class.name}/update_attributes!'
|
41
|
-
add_method_tracer :save, 'Database/#{self.class.name}/save'
|
42
|
-
add_method_tracer :save!, 'Database/#{self.class.name}/save!'
|
43
|
-
add_method_tracer :delete, 'Database/#{self.class.name}/delete'
|
44
|
-
add_method_tracer :destroy, 'Database/#{self.class.name}/destroy'
|
45
|
-
end
|
46
|
-
super
|
47
|
-
end
|
48
|
-
end
|
49
|
-
::Mongoid::Document.extend(RPMContrib::Instrumentation::Mongoid)
|
50
|
-
end
|
51
|
-
end
|