dolores_rpm 3.2.0.4 → 3.2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +2 -5
- data/dolores_rpm-3.2.0.2.gem +0 -0
- data/dolores_rpm-3.3.4.fork.gem +0 -0
- data/dolores_rpm.gemspec +6 -5
- data/lib/new_relic/agent/instrumentation/data_mapper.rb +57 -97
- data/lib/new_relic/version.rb +1 -1
- metadata +8 -7
- data/dolores_rpm-3.2.0.3.gem +0 -0
data/CHANGELOG
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
v3.2.0.
|
2
|
-
*
|
3
|
-
|
4
|
-
v3.2.0.3
|
5
|
-
* Upgraded DataMapper support but it didn't work
|
1
|
+
v3.2.0.5
|
2
|
+
* Add DataMapper instrumentation for find/save/destroy with :push_scope => false (gets find to show up on database instrumentation)
|
6
3
|
|
7
4
|
v3.2.0.2
|
8
5
|
* Roll back to previous version of DataMapper instrumentation (current one does not work for our app)
|
Binary file
|
Binary file
|
data/dolores_rpm.gemspec
CHANGED
@@ -5,14 +5,14 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "dolores_rpm"
|
8
|
-
s.version = "3.2.0.
|
8
|
+
s.version = "3.2.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Bill Kayser", "Jon Guymon", "Justin George", "Darin Swanson"]
|
12
|
-
s.date = "2012-05-
|
12
|
+
s.date = "2012-05-08"
|
13
13
|
s.description = "New Relic is a performance management system, developed by New Relic,\nInc (http://www.newrelic.com). This is a fork that uses an older version\nof the DataMapper instrumentation. Newer versions did not work for us.\n"
|
14
14
|
s.email = "support@newrelic.com"
|
15
|
-
s.executables = ["newrelic_cmd", "
|
15
|
+
s.executables = ["newrelic_cmd", "mongrel_rpm", "newrelic"]
|
16
16
|
s.extra_rdoc_files = [
|
17
17
|
"CHANGELOG",
|
18
18
|
"LICENSE",
|
@@ -29,7 +29,8 @@ Gem::Specification.new do |s|
|
|
29
29
|
"cert/cacert.pem",
|
30
30
|
"cert/oldsite.pem",
|
31
31
|
"cert/site.pem",
|
32
|
-
"dolores_rpm-3.2.0.
|
32
|
+
"dolores_rpm-3.2.0.2.gem",
|
33
|
+
"dolores_rpm-3.3.4.fork.gem",
|
33
34
|
"dolores_rpm.gemspec",
|
34
35
|
"install.rb",
|
35
36
|
"lib/conditional_vendored_dependency_detection.rb",
|
@@ -282,7 +283,7 @@ Gem::Specification.new do |s|
|
|
282
283
|
s.post_install_message = "\nPLEASE NOTE:\n\nDeveloper Mode is now a Rack middleware.\n\nDeveloper Mode is no longer available in Rails 2.1 and earlier.\nHowever, starting in version 2.12 you can use Developer Mode in any\nRack based framework, in addition to Rails. To install developer mode\nin a non-Rails application, just add NewRelic::Rack::DeveloperMode to\nyour middleware stack.\n\nIf you are using JRuby, we recommend using at least version 1.4 or \nlater because of issues with the implementation of the timeout library.\n\nRefer to the README.md file for more information.\n\nPlease see http://github.com/newrelic/rpm/blob/master/CHANGELOG\nfor a complete description of the features and enhancements available\nin version 3.2 of the Ruby Agent.\n \n"
|
283
284
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "New Relic Ruby Agent"]
|
284
285
|
s.require_paths = ["lib"]
|
285
|
-
s.rubygems_version = "1.8.
|
286
|
+
s.rubygems_version = "1.8.23"
|
286
287
|
s.summary = "New Relic Ruby Agent"
|
287
288
|
|
288
289
|
if s.respond_to? :specification_version then
|
@@ -1,11 +1,17 @@
|
|
1
1
|
# NewRelic instrumentation for DataMapper
|
2
2
|
# For now, we have to refer to all db metrics as "ActiveRecord"
|
3
3
|
if defined? DataMapper
|
4
|
+
|
4
5
|
DataMapper::Model.class_eval do
|
5
|
-
add_method_tracer :get,
|
6
|
-
add_method_tracer :first,
|
7
|
-
add_method_tracer :last,
|
8
|
-
add_method_tracer :all,
|
6
|
+
add_method_tracer :get, 'ActiveRecord/#{self.name}/get'
|
7
|
+
add_method_tracer :first, 'ActiveRecord/#{self.name}/first'
|
8
|
+
add_method_tracer :last, 'ActiveRecord/#{self.name}/last'
|
9
|
+
add_method_tracer :all, 'ActiveRecord/#{self.name}/all'
|
10
|
+
|
11
|
+
add_method_tracer :get, 'ActiveRecord/find', :push_scope => false
|
12
|
+
add_method_tracer :first, 'ActiveRecord/find', :push_scope => false
|
13
|
+
add_method_tracer :last, 'ActiveRecord/find', :push_scope => false
|
14
|
+
add_method_tracer :all, 'ActiveRecord/find', :push_scope => false
|
9
15
|
|
10
16
|
add_method_tracer :create, 'ActiveRecord/#{self.name}/create'
|
11
17
|
add_method_tracer :create!, 'ActiveRecord/#{self.name}/create'
|
@@ -14,103 +20,57 @@ if defined? DataMapper
|
|
14
20
|
add_method_tracer :destroy, 'ActiveRecord/#{self.name}/destroy'
|
15
21
|
add_method_tracer :destroy!, 'ActiveRecord/#{self.name}/destroy'
|
16
22
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
23
|
+
add_method_tracer :create, 'ActiveRecord/save', :push_scope => false
|
24
|
+
add_method_tracer :create!, 'ActiveRecord/save', :push_scope => false
|
25
|
+
add_method_tracer :update, 'ActiveRecord/save', :push_scope => false
|
26
|
+
add_method_tracer :update!, 'ActiveRecord/save', :push_scope => false
|
27
|
+
add_method_tracer :destroy, 'ActiveRecord/destroy', :push_scope => false
|
28
|
+
add_method_tracer :destroy!, 'ActiveRecord/destroy', :push_scope => false
|
22
29
|
end
|
23
|
-
|
24
30
|
DataMapper::Resource.class_eval do
|
25
|
-
add_method_tracer :update, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/update'
|
26
|
-
add_method_tracer :update!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/update'
|
27
|
-
add_method_tracer :save, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
|
28
|
-
add_method_tracer :save!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
|
29
|
-
add_method_tracer :destroy, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/destroy'
|
30
|
-
add_method_tracer :destroy!, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/destroy'
|
31
|
-
end
|
32
31
|
|
33
|
-
|
34
|
-
|
35
|
-
add_method_tracer :first, 'ActiveRecord/#{self.name}/first'
|
36
|
-
add_method_tracer :last, 'ActiveRecord/#{self.name}/last'
|
37
|
-
add_method_tracer :all, 'ActiveRecord/#{self.name}/all'
|
32
|
+
@@my_sql_defined = defined? ActiveRecord::ConnectionAdapters::MysqlAdapter
|
33
|
+
@@postgres_defined = defined? ActiveRecord::ConnectionAdapters::PostgreSQLAdapter
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
add_method_tracer :create!, 'ActiveRecord/#{self.name}/create'
|
43
|
-
add_method_tracer :update, 'ActiveRecord/#{self.name}/update'
|
44
|
-
add_method_tracer :update!, 'ActiveRecord/#{self.name}/update'
|
45
|
-
add_method_tracer :destroy, 'ActiveRecord/#{self.name}/destroy'
|
46
|
-
add_method_tracer :destroy!, 'ActiveRecord/#{self.name}/destroy'
|
47
|
-
|
48
|
-
# For dm-aggregates support:
|
49
|
-
for method in [ :aggregate ] do
|
50
|
-
next unless method_defined? method
|
51
|
-
add_method_tracer(method, 'ActiveRecord/#{self.name}/' + method.to_s)
|
35
|
+
for method in [:query] do
|
36
|
+
add_method_tracer method, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/execute'
|
37
|
+
add_method_tracer method, 'ActiveRecord/all', :push_scope => false
|
52
38
|
end
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
add_method_tracer :
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
module Agent
|
68
|
-
module Instrumentation
|
69
|
-
module DataMapperInstrumentation
|
70
|
-
|
71
|
-
def self.included(klass)
|
72
|
-
klass.class_eval do
|
73
|
-
alias_method :log_without_newrelic_instrumentation, :log
|
74
|
-
alias_method :log, :log_with_newrelic_instrumentation
|
75
|
-
end
|
76
|
-
end
|
77
|
-
|
78
|
-
# Unlike in AR, log is called in DM after the query actually ran,
|
79
|
-
# complete with metrics. Since DO has already calculated the
|
80
|
-
# duration, there's nothing more to measure, so just record and log.
|
81
|
-
#
|
82
|
-
# We rely on the assumption that all possible entry points have been
|
83
|
-
# hooked with tracers, ensuring that notice_sql attaches this SQL to
|
84
|
-
# the proper call scope.
|
85
|
-
def log_with_newrelic_instrumentation(msg)
|
86
|
-
return unless NewRelic::Agent.is_execution_traced?
|
87
|
-
return unless operation = case msg.query
|
88
|
-
when /^\s*select/i then 'find'
|
89
|
-
when /^\s*(update|insert)/i then 'save'
|
90
|
-
when /^\s*delete/i then 'destroy'
|
91
|
-
else nil
|
92
|
-
end
|
93
|
-
|
94
|
-
# FYI: self.to_s will yield connection URI string.
|
95
|
-
duration = msg.duration / 1000000.0
|
96
|
-
|
97
|
-
# Attach SQL to current segment/scope.
|
98
|
-
NewRelic::Agent.instance.transaction_sampler.notice_sql(msg.query, nil, duration)
|
99
|
-
|
100
|
-
# Record query duration associated with each of the desired metrics.
|
101
|
-
metrics = [ "ActiveRecord/#{operation}", 'ActiveRecord/all' ]
|
102
|
-
metrics.each do |metric|
|
103
|
-
NewRelic::Agent.instance.stats_engine.get_stats_no_scope(metric).trace_call(duration)
|
104
|
-
end
|
105
|
-
ensure
|
106
|
-
log_without_newrelic_instrumentation(msg)
|
39
|
+
for method in [:update, :save] do
|
40
|
+
add_method_tracer method, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/save'
|
41
|
+
add_method_tracer method, 'ActiveRecord/save', :push_scope => false
|
42
|
+
end
|
43
|
+
add_method_tracer :destroy, 'ActiveRecord/#{self.class.name[/[^:]*$/]}/destroy'
|
44
|
+
add_method_tracer :destroy, 'ActiveRecord/destroy', :push_scope => false
|
45
|
+
|
46
|
+
def log_with_newrelic_instrumentation(sql, name, &block)
|
47
|
+
# if we aren't in a blamed context, then add one so that we can
|
48
|
+
# see that controllers are calling SQL directly we check
|
49
|
+
# scope_depth vs 2 since the controller is 1
|
50
|
+
if NewRelic::Agent.instance.transaction_sampler.scope_depth < 2
|
51
|
+
self.class.trace_method_execution "Database/DirectSQL", true, true do
|
52
|
+
log_with_capture_sql(sql, name, &block)
|
107
53
|
end
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
54
|
+
else
|
55
|
+
log_with_capture_sql(sql, name, &block)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def log_with_capture_sql(sql, name, &block)
|
60
|
+
if @@my_sql_defined && self.is_a?(ActiveRecord::ConnectionAdapters::MysqlAdapter)
|
61
|
+
config = @config
|
62
|
+
elsif @@postgres_defined && self.is_a?(ActiveRecord::ConnectionAdapters::PostgreSQLAdapter)
|
63
|
+
config = @config
|
64
|
+
else
|
65
|
+
config = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
t0 = Time.now
|
69
|
+
result = log_without_newrelic_instrumentation(sql, name, &block)
|
70
|
+
|
71
|
+
NewRelic::Agent.instance.transaction_sampler.notice_sql(sql, config, (Time.now - t0).to_f)
|
72
|
+
|
73
|
+
result
|
74
|
+
end
|
75
|
+
end
|
116
76
|
end
|
data/lib/new_relic/version.rb
CHANGED
@@ -4,7 +4,7 @@ module NewRelic
|
|
4
4
|
MAJOR = 3
|
5
5
|
MINOR = 2
|
6
6
|
TINY = 0
|
7
|
-
BUILD =
|
7
|
+
BUILD = 5 #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
|
8
8
|
STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
|
9
9
|
end
|
10
10
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dolores_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 101
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 2
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 3.2.0.
|
10
|
+
- 5
|
11
|
+
version: 3.2.0.5
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Bill Kayser
|
@@ -19,7 +19,7 @@ autorequire:
|
|
19
19
|
bindir: bin
|
20
20
|
cert_chain: []
|
21
21
|
|
22
|
-
date: 2012-05-
|
22
|
+
date: 2012-05-08 00:00:00 Z
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|
25
25
|
name: jeweler
|
@@ -71,8 +71,8 @@ description: |
|
|
71
71
|
email: support@newrelic.com
|
72
72
|
executables:
|
73
73
|
- newrelic_cmd
|
74
|
-
- newrelic
|
75
74
|
- mongrel_rpm
|
75
|
+
- newrelic
|
76
76
|
extensions: []
|
77
77
|
|
78
78
|
extra_rdoc_files:
|
@@ -90,7 +90,8 @@ files:
|
|
90
90
|
- cert/cacert.pem
|
91
91
|
- cert/oldsite.pem
|
92
92
|
- cert/site.pem
|
93
|
-
- dolores_rpm-3.2.0.
|
93
|
+
- dolores_rpm-3.2.0.2.gem
|
94
|
+
- dolores_rpm-3.3.4.fork.gem
|
94
95
|
- dolores_rpm.gemspec
|
95
96
|
- install.rb
|
96
97
|
- lib/conditional_vendored_dependency_detection.rb
|
@@ -391,7 +392,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
391
392
|
requirements: []
|
392
393
|
|
393
394
|
rubyforge_project:
|
394
|
-
rubygems_version: 1.8.
|
395
|
+
rubygems_version: 1.8.23
|
395
396
|
signing_key:
|
396
397
|
specification_version: 3
|
397
398
|
summary: New Relic Ruby Agent
|
data/dolores_rpm-3.2.0.3.gem
DELETED
Binary file
|