newrelic_rpm 3.15.0.314 → 3.15.1.316

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +6 -1
  3. data/.yardopts +1 -1
  4. data/CHANGELOG +50 -0
  5. data/{GUIDELINES_FOR_CONTRIBUTING.md → CONTRIBUTING.md} +0 -0
  6. data/README.md +1 -1
  7. data/lib/new_relic/agent/autostart.rb +1 -1
  8. data/lib/new_relic/agent/database/obfuscation_helpers.rb +2 -1
  9. data/lib/new_relic/agent/instrumentation/action_view_subscriber.rb +14 -7
  10. data/lib/new_relic/agent/instrumentation/active_record_4.rb +4 -1
  11. data/lib/new_relic/agent/method_tracer.rb +18 -3
  12. data/lib/new_relic/agent/samplers/delayed_job_sampler.rb +1 -1
  13. data/lib/new_relic/control/instance_methods.rb +1 -1
  14. data/lib/new_relic/version.rb +1 -1
  15. data/lib/tasks/versions.html.erb +1 -2
  16. data/newrelic_rpm.gemspec +1 -1
  17. data/test/environments/rails21/Gemfile +2 -0
  18. data/test/environments/rails22/Gemfile +2 -0
  19. data/test/environments/rails32/Gemfile +1 -6
  20. data/test/environments/rails40/Gemfile +1 -1
  21. data/test/environments/rails41/Gemfile +1 -1
  22. data/test/environments/rails42/Gemfile +1 -1
  23. data/test/environments/rails50/Gemfile +2 -2
  24. data/test/multiverse/lib/multiverse/suite.rb +10 -0
  25. data/test/multiverse/suites/active_record/Envfile +1 -2
  26. data/test/multiverse/suites/capistrano/Envfile +1 -0
  27. data/test/multiverse/suites/rack/Envfile +17 -0
  28. data/test/multiverse/suites/rails/Envfile +3 -11
  29. data/test/multiverse/suites/rake/Envfile +7 -0
  30. data/test/multiverse/suites/resque/Envfile +0 -2
  31. data/test/new_relic/agent/database_test.rb +3 -2
  32. data/test/new_relic/agent/instrumentation/action_view_subscriber_test.rb +11 -0
  33. data/test/new_relic/agent/method_tracer_test.rb +29 -0
  34. data/ui/views/newrelic/_sql_row.rhtml +1 -1
  35. data/ui/views/newrelic/explain_sql.rhtml +1 -1
  36. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 391d2537bee4bdb7f87f25c7d20d017876638851
4
- data.tar.gz: 974e57e947784e5cba3caf6b802e5d62fd5d8cf3
3
+ metadata.gz: 1bc3b5920b3b7ea0c2997962168a45b01127ea75
4
+ data.tar.gz: e48ce51b1f0bb6847fa09ab23dfa005a3f068311
5
5
  SHA512:
6
- metadata.gz: 50197fcecbff1272846495f6ac2948f274d6c3cca935d34d26aa024c8606bff4b3fb47c59a54a915904a419e227e2a3ab9445d245200f6b2d38a25d8cb2208c0
7
- data.tar.gz: 56a7a8be8c4e01941baf2dd8c03395debab36e5311ca4e92b4c704d73945a5176f1629a7937b08636de570cf9ef5c7cfcadb830232fb62f32b67b69aacec38cd
6
+ metadata.gz: 47057832e75c7c3319433fb03ee49475136c1e8c284fa3b238d5e591d185f6f5222cfb7b8c3f6696b0aa99bcbfae827ea964beb7712a0b15954dea8b72b69033
7
+ data.tar.gz: 6428ef632749929082e53b93e74df3239c41430bf7688ab6c28822dcf3889cf23b1e17501f1f2eb75ee186327231ca3fbd77f6ca1963f97f8c6041ed7c6aef0e
data/.travis.yml CHANGED
@@ -36,6 +36,11 @@ branches:
36
36
  - dev
37
37
  - release
38
38
 
39
+ notifications:
40
+ webhooks: http://notifitron.herokuapp.com/
41
+ on_success: always
42
+ on_failure: always
43
+
39
44
  rvm:
40
45
  # Run slowest builds first to try and optimize overall cycle time.
41
46
  - jruby-1.7.23
@@ -54,7 +59,7 @@ env:
54
59
  - CI_BUNDLE_PATH=/home/travis/bundle
55
60
  - BUNDLE_PATH=/home/travis/bundle
56
61
  - MONGODB=2.6.11
57
- - JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx512m"
62
+ - JAVA_OPTS="-XX:+TieredCompilation -XX:TieredStopAtLevel=1 -Xmx640m"
58
63
  - JRUBY_OPTS="-Xcompile.invokedynamic=false -J-Djruby.compile.mode=OFF"
59
64
  - RBXOPT="-Xcompiler.no_rbc -Xint"
60
65
  - SERIALIZE=1
data/.yardopts CHANGED
@@ -18,4 +18,4 @@ lib/new_relic/rack.rb
18
18
  -
19
19
  LICENSE
20
20
  CHANGELOG
21
- GUIDELINES_FOR_CONTRIBUTING.md
21
+ CONTRIBUTING.md
data/CHANGELOG CHANGED
@@ -1,5 +1,55 @@
1
1
  # New Relic Ruby Agent Release Notes #
2
2
 
3
+ ## v3.15.1 ##
4
+ * Rack 2 alpha support
5
+
6
+ This release includes experimental support for Rack 2 as of 2.0.0.alpha.
7
+ Rack 2 is still in development, but the agent should work as expected for
8
+ those who are experimenting with Rack 2.
9
+
10
+ * Rails 5 beta 3 support
11
+
12
+ We've tweaked our Action View instrumentation to accommodate changes introduced
13
+ in Rails v5.0.0.beta3.
14
+
15
+ * Defer referencing ::ActiveRecord::Base to avoid triggering its autoloading
16
+ too soon
17
+
18
+ In 3.12.1 and later versions of the agent, the agent references (and
19
+ therefore loads) ActiveRecord::Base earlier on in the Rails loading process.
20
+ This could jump ahead of initializers that should be run first. We now wait
21
+ until ActiveRecord::Base is loaded elsewhere.
22
+
23
+ * Fix explain plans for non-parameterized queries with single quote literals
24
+
25
+ The agent does not run explain plans for queries still containing parameters
26
+ (such as `SELECT * FROM UNICORNS WHERE ID = $1 LIMIT 1`). This check was
27
+ unfortunately mutating the query to be obfuscated, causing an inability to
28
+ collect an explain plan. This has now been fixed.
29
+
30
+ * Fix default metric name for tracing class methods
31
+
32
+ When using `add_method_tracer` on a class method but without passing in a
33
+ `metric_name_code`, the default metric name will now look like
34
+ `Custom/ClassName/Class/method_name`. We also addressed default
35
+ metric names for anonymous classes and modules.
36
+
37
+ * Fix issue when rendering SQL strings in developer mode
38
+
39
+ When we obfuscate SQL statements, we rewrite the Statement objects as
40
+ SQL strings inline in our sample buffers at harvest time. However, in
41
+ developer mode, we also read out of these buffers when rendering pages.
42
+ Depending on whether a harvest has run yet, the buffer will contain either
43
+ Statement objects, SQL strings, or a mix. Now, developer mode can handle
44
+ them all!
45
+
46
+ * Fix DelayedJob Sampler reporting incorrect counts in Active Record 3 and below
47
+
48
+ When fixing various deprecation warnings on ActiveRecord 4, we introduced
49
+ a regression in our DelayedJob sampler which caused us to incorrectly report
50
+ failed and locked job counts in ActiveRecord 3 and below. This is now fixed.
51
+ Thanks Rangel Dokov for the contribution!
52
+
3
53
  ## v3.15.0 ##
4
54
 
5
55
  * Rails 5 support
File without changes
data/README.md CHANGED
@@ -31,7 +31,7 @@ Environments" section under "Getting Started".
31
31
 
32
32
  We welcome code contributions (in the form of pull requests) from our user
33
33
  community. Before submitting a pull request please review
34
- [GUIDELINES_FOR_CONTRIBUTING](https://github.com/newrelic/rpm/blob/master/GUIDELINES_FOR_CONTRIBUTING.md).
34
+ [these guidelines](https://github.com/newrelic/rpm/blob/master/CONTRIBUTING.md).
35
35
 
36
36
  Following these helps us efficiently review and incorporate your contribution
37
37
  and avoid breaking your code with future changes to the agent.
@@ -13,7 +13,7 @@ module NewRelic
13
13
  # the console during interactive sessions.
14
14
  #
15
15
  # It should be possible to override Autostart logic with an explicit
16
- # configuration, for example the NEWRELIC_AGENT_ENABLED environment variable or
16
+ # configuration, for example the NEW_RELIC_AGENT_ENABLED environment variable or
17
17
  # agent_enabled key in newrelic.yml
18
18
  module Autostart
19
19
  extend self
@@ -50,7 +50,8 @@ module NewRelic
50
50
  FAILED_TO_OBFUSCATE_MESSAGE = "Failed to obfuscate SQL query - quote characters remained after obfuscation".freeze
51
51
 
52
52
  def obfuscate_single_quote_literals(sql)
53
- sql.gsub!(COMPONENTS_REGEX_MAP[:single_quotes], PLACEHOLDER) || sql
53
+ return sql unless sql =~ COMPONENTS_REGEX_MAP[:single_quotes]
54
+ sql.gsub(COMPONENTS_REGEX_MAP[:single_quotes], PLACEHOLDER)
54
55
  end
55
56
 
56
57
  def self.generate_regex(dialect)
@@ -44,6 +44,11 @@ module NewRelic
44
44
  end
45
45
 
46
46
  class RenderEvent < Event
47
+
48
+ RENDER_TEMPLATE_EVENT_NAME = 'render_template.action_view'.freeze
49
+ RENDER_PARTIAL_EVENT_NAME = 'render_partial.action_view'.freeze
50
+ RENDER_COLLECTION_EVENT_NAME = 'render_collection.action_view'.freeze
51
+
47
52
  # Nearly every "render_blah.action_view" event has a child
48
53
  # in the form of "!render_blah.action_view". The children
49
54
  # are the ones we want to record. There are a couple
@@ -65,16 +70,18 @@ module NewRelic
65
70
  end
66
71
 
67
72
  # memoize
68
- @metric_name ||= "View/#{metric_path(identifier)}/#{metric_action(name)}"
73
+ @metric_name ||= "View/#{metric_path(name, identifier)}/#{metric_action(name)}"
69
74
  @metric_name
70
75
  end
71
76
 
72
- def metric_path(identifier)
73
- if identifier == nil
77
+ def metric_path(name, identifier)
78
+ # Rails 5 sets identifier to nil for empty collections,
79
+ # so do not mistake rendering a collection for rendering a file.
80
+ if identifier == nil && name != RENDER_COLLECTION_EVENT_NAME
74
81
  'file'
75
82
  elsif identifier =~ /template$/
76
83
  identifier
77
- elsif (parts = identifier.split('/')).size > 1
84
+ elsif identifier && (parts = identifier.split('/')).size > 1
78
85
  parts[-2..-1].join('/')
79
86
  else
80
87
  ::NewRelic::Agent::UNKNOWN_METRIC
@@ -83,9 +90,9 @@ module NewRelic
83
90
 
84
91
  def metric_action(name)
85
92
  case name
86
- when /render_template.action_view$/ then 'Rendering'
87
- when 'render_partial.action_view' then 'Partial'
88
- when 'render_collection.action_view' then 'Partial'
93
+ when /#{RENDER_TEMPLATE_EVENT_NAME}$/ then 'Rendering'
94
+ when RENDER_PARTIAL_EVENT_NAME then 'Partial'
95
+ when RENDER_COLLECTION_EVENT_NAME then 'Partial'
89
96
  end
90
97
  end
91
98
  end
@@ -24,6 +24,9 @@ DependencyDetection.defer do
24
24
  executes do
25
25
  ActiveSupport::Notifications.subscribe('sql.active_record',
26
26
  NewRelic::Agent::Instrumentation::ActiveRecordSubscriber.new)
27
- ::NewRelic::Agent::Instrumentation::ActiveRecordHelper.instrument_additional_methods
27
+
28
+ ActiveSupport.on_load(:active_record) do
29
+ ::NewRelic::Agent::Instrumentation::ActiveRecordHelper.instrument_additional_methods
30
+ end
28
31
  end
29
32
  end
@@ -202,7 +202,7 @@ module NewRelic
202
202
  # Example:
203
203
  # Foo.default_metric_name_code('bar') #=> "Custom/#{Foo.name}/bar"
204
204
  def default_metric_name_code(method_name)
205
- "Custom/#{self.name}/#{method_name.to_s}"
205
+ "Custom/#{class_name}/#{method_name}"
206
206
  end
207
207
 
208
208
  # Checks to see if the method we are attempting to trace
@@ -210,7 +210,7 @@ module NewRelic
210
210
  # anything if the method doesn't exist.
211
211
  def newrelic_method_exists?(method_name)
212
212
  exists = method_defined?(method_name) || private_method_defined?(method_name)
213
- ::NewRelic::Agent.logger.error("Did not trace #{self.name}##{method_name} because that method does not exist") unless exists
213
+ ::NewRelic::Agent.logger.error("Did not trace #{class_name}##{method_name} because that method does not exist") unless exists
214
214
  exists
215
215
  end
216
216
 
@@ -345,7 +345,7 @@ module NewRelic
345
345
  alias_method method_name, _traced_method_name(method_name, metric_name_code)
346
346
  send visibility, method_name
347
347
  send visibility, _traced_method_name(method_name, metric_name_code)
348
- ::NewRelic::Agent.logger.debug("Traced method: class = #{self.name},"+
348
+ ::NewRelic::Agent.logger.debug("Traced method: class = #{class_name},"+
349
349
  "method = #{method_name}, "+
350
350
  "metric = '#{metric_name_code}'")
351
351
  end
@@ -383,6 +383,21 @@ module NewRelic
383
383
  def _sanitize_name(name)
384
384
  name.to_s.tr_s('^a-zA-Z0-9', '_')
385
385
  end
386
+
387
+ def class_name
388
+ return self.name if self.name && !self.name.empty?
389
+ return "AnonymousModule" if self.to_s.start_with?("#<Module:")
390
+
391
+ # trying to get the "MyClass" portion of "#<Class:MyClass>"
392
+ name = self.to_s[/^#<Class:(.+)>$/, 1]
393
+ if name.start_with?("0x")
394
+ "AnonymousClass"
395
+ elsif name.start_with?("#<Class:")
396
+ "AnonymousClass/Class"
397
+ else
398
+ "#{name}/Class"
399
+ end
400
+ end
386
401
  end
387
402
 
388
403
  # @!parse extend ClassMethods
@@ -51,7 +51,7 @@ module NewRelic
51
51
 
52
52
  def count(query)
53
53
  if ::ActiveRecord::VERSION::MAJOR.to_i < 4
54
- ::Delayed::Job.count(query)
54
+ ::Delayed::Job.count(:conditions => query)
55
55
  else
56
56
  ::Delayed::Job.where(query).count
57
57
  end
@@ -87,7 +87,7 @@ module NewRelic
87
87
  "The agent will continue running in #{@started_in_env.inspect}. To alter this, ensure the desired environment is set before the agent starts.")
88
88
  else
89
89
  Agent.logger.info("Starting the New Relic agent in #{env.inspect} environment.",
90
- "To prevent agent startup add a NEWRELIC_AGENT_ENABLED=false environment variable or modify the #{env.inspect} section of your newrelic.yml.")
90
+ "To prevent agent startup add a NEW_RELIC_AGENT_ENABLED=false environment variable or modify the #{env.inspect} section of your newrelic.yml.")
91
91
  end
92
92
 
93
93
  env
@@ -12,7 +12,7 @@ module NewRelic
12
12
 
13
13
  MAJOR = 3
14
14
  MINOR = 15
15
- TINY = 0
15
+ TINY = 1
16
16
 
17
17
  begin
18
18
  require File.join(File.dirname(__FILE__), 'build')
@@ -11,14 +11,13 @@
11
11
  <tbody>
12
12
  <% for version in versions %>
13
13
  <tr>
14
- <td><b><%= version.name %></b></td>
14
+ <td rowspan=<%= if version.notes; 2; else; 1; end %>><b><%= version.name %></b></td>
15
15
  <td><%= CGI.escapeHTML(version_list(version.supported)) %></td>
16
16
  <td><%= CGI.escapeHTML(version_list(version.deprecated)) %></td>
17
17
  <td><%= CGI.escapeHTML(version_list(version.experimental)) %></td>
18
18
  </tr>
19
19
  <% if version.notes %>
20
20
  <tr>
21
- <td></td>
22
21
  <td colspan="3">
23
22
  <%= version.notes.join("<br />") %>
24
23
  </td>
data/newrelic_rpm.gemspec CHANGED
@@ -27,7 +27,7 @@ EOS
27
27
  "CHANGELOG",
28
28
  "LICENSE",
29
29
  "README.md",
30
- "GUIDELINES_FOR_CONTRIBUTING.md",
30
+ "CONTRIBUTING.md",
31
31
  "newrelic.yml"
32
32
  ]
33
33
 
@@ -23,3 +23,5 @@ end
23
23
 
24
24
  gem 'pry', '~> 0.9.12'
25
25
  gem 'hometown', '~> 0.2.5'
26
+
27
+ gem 'git', '< 1.3' if RUBY_VERSION < '1.9' # git 1.3.0 requires Ruby version >= 1.9
@@ -23,3 +23,5 @@ end
23
23
 
24
24
  gem 'pry', '~> 0.9.12'
25
25
  gem 'hometown', '~> 0.2.5'
26
+
27
+ gem 'git', '< 1.3' if RUBY_VERSION < '1.9' # git 1.3.0 requires Ruby version >= 1.9
@@ -1,11 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- if RUBY_VERSION < '1.9.3' # Rails 3.2.22.1 is incompatible with MRI 1.8.7 / ree
4
- gem 'rails', '3.2.22'
5
- else
6
- gem 'rails', '~>3.2.20'
7
- end
8
-
3
+ gem 'rails', '~>3.2.20'
9
4
  gem 'i18n', '0.6.11'
10
5
 
11
6
  gem 'rake', '~>10.1.1'
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake'
3
+ gem 'rake', '< 11'
4
4
 
5
5
  gem 'rails', '~>4.0.13'
6
6
 
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake'
3
+ gem 'rake', '< 11'
4
4
 
5
5
  gem 'rails', '~>4.1.10'
6
6
 
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake'
3
+ gem 'rake', '< 11'
4
4
 
5
5
  gem 'rails', '~>4.2.1'
6
6
 
@@ -1,8 +1,8 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'rake'
3
+ gem 'rake', '< 11'
4
4
 
5
- gem 'rails', '~>5.0.0beta2'
5
+ gem 'rails', '5.0.0beta3'
6
6
 
7
7
  gem 'minitest', '5.2.3'
8
8
  gem 'mocha', :require => false
@@ -174,6 +174,7 @@ module Multiverse
174
174
  f.puts newrelic_gemfile_line unless gemfile_text =~ /^\s*gem .newrelic_rpm./
175
175
  f.puts jruby_openssl_line unless gemfile_text =~ /^\s*gem .jruby-openssl./ || (defined?(JRUBY_VERSION) && JRUBY_VERSION > '1.7')
176
176
  f.puts minitest_line unless gemfile_text =~ /^\s*gem .minitest[^_]./
177
+ f.puts rake_line unless gemfile_text =~ /^\s*gem .rake[^_]./ || suite == 'rake'
177
178
  if RUBY_VERSION == "1.8.7"
178
179
  f.puts "gem 'json'" unless gemfile_text =~ /^\s.*gem .json./
179
180
  end
@@ -222,6 +223,15 @@ module Multiverse
222
223
  "gem 'minitest', '~> 4.7.5', :require => false"
223
224
  end
224
225
 
226
+ # rake 11 dropped support for ruby < 1.9.3
227
+ def rake_line
228
+ if RUBY_VERSION < '1.9.3'
229
+ "gem 'rake', '< 11'"
230
+ else
231
+ "gem 'rake'"
232
+ end
233
+ end
234
+
225
235
  def print_environment
226
236
  puts yellow("Environment loaded with:") if verbose?
227
237
  gems = Bundler.definition.specs.inject([]) do |m, s|
@@ -1,6 +1,5 @@
1
1
  boilerplate_gems = <<-BOILERPLATE
2
2
  gem 'rack'
3
- gem 'rake'
4
3
  gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3' # i18n >= 0.7.0 only works on Ruby 1.9.3 and newer
5
4
 
6
5
  if RUBY_PLATFORM == 'java'
@@ -14,7 +13,7 @@ BOILERPLATE
14
13
 
15
14
  if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
16
15
  gemfile <<-RB
17
- gem 'activerecord', '~> 5.0.0beta2'
16
+ gem 'activerecord', '~> 5.0.0beta3'
18
17
  gem 'minitest', '~> 5.2.3'
19
18
  #{boilerplate_gems}
20
19
  RB
@@ -3,6 +3,7 @@ suite_condition("Capistrano 3 not supported in 1.8.7 and flaky on JRuby") do
3
3
  end
4
4
 
5
5
  boilerplate = <<-BOILERPLATE
6
+ gem 'sshkit', '~> 1.8.1'
6
7
  gem 'rack'
7
8
  gem 'net-ssh', '2.9.2' if RUBY_VERSION <= '1.9.3'
8
9
  gem 'i18n', '< 0.7.0' if RUBY_VERSION < '1.9.3'
@@ -8,6 +8,23 @@ gemfile <<-RB
8
8
  gem 'rack-test'
9
9
  RB
10
10
 
11
+ gemfile <<-RB
12
+ gem 'puma', '~>2.12.3'
13
+ RB
14
+
15
+ if RUBY_VERSION >= '2.2.2'
16
+ gemfile <<-RB
17
+ gem 'puma', '~>2.12.3'
18
+ gem 'rack', '2.0.0.alpha'
19
+ gem 'rack-test'
20
+ RB
21
+
22
+ gemfile <<-RB
23
+ gem 'rack', '2.0.0.alpha'
24
+ gem 'rack-test'
25
+ RB
26
+ end
27
+
11
28
  gemfile <<-RB
12
29
  gem 'rack', '~>1.6.0'
13
30
  gem 'rack-test'
@@ -1,6 +1,6 @@
1
1
  if RUBY_VERSION >= '2.2.2' && RUBY_PLATFORM != 'java'
2
2
  gemfile <<-RB
3
- gem 'rails', '~>5.0.0beta2'
3
+ gem 'rails', '5.0.0beta3'
4
4
  gem 'haml', :require => false
5
5
  gem 'minitest', '5.2.3'
6
6
  RB
@@ -30,11 +30,7 @@ if RUBY_VERSION >= '1.9.3'
30
30
  end
31
31
 
32
32
  gemfile <<-RB
33
- if RUBY_VERSION < '1.9.3' # Rails 3.2.22.1 is incompatible with MRI 1.8.7 / ree
34
- gem 'rails', '3.2.22'
35
- else
36
- gem 'rails', '~>3.2.20'
37
- end
33
+ gem 'rails', '~>3.2.20'
38
34
  gem 'i18n', '~>0.6.11'
39
35
  gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
40
36
  gem 'minitest_tu_shim', :require => false
@@ -42,11 +38,7 @@ gemfile <<-RB
42
38
  RB
43
39
 
44
40
  gemfile <<-RB
45
- if RUBY_VERSION < '1.9.3' # Rails 3.2.22.1 is incompatible with MRI 1.8.7 / ree
46
- gem 'rails', '3.2.22'
47
- else
48
- gem 'rails', '~>3.2.20'
49
- end
41
+ gem 'rails', '~>3.2.20'
50
42
  gem 'i18n', '~>0.6.11'
51
43
  gem 'sinatra', '~> 1.4.5'
52
44
  gem 'haml', '4.0.2' # Getting load issues with haml 4.0.3
@@ -1,3 +1,10 @@
1
+ if RUBY_VERSION >= '1.9.3'
2
+ gemfile <<-RB
3
+ gem 'rack'
4
+ gem 'rake', '~> 11.1.0'
5
+ RB
6
+ end
7
+
1
8
  gemfile <<-RB
2
9
  gem 'rack'
3
10
  gem 'rake', '~> 10.4'
@@ -1,11 +1,9 @@
1
1
  gemfile <<-RB
2
2
  gem 'resque', '1.23.0'
3
3
  gem 'json'
4
- gem 'rake'
5
4
  RB
6
5
 
7
6
  gemfile <<-RB
8
7
  gem 'resque', '~>1.25.1'
9
8
  gem 'json'
10
- gem 'rake'
11
9
  RB
@@ -242,10 +242,11 @@ class NewRelic::Agent::DatabaseTest < Minitest::Test
242
242
  config.default('val')
243
243
  connection = mock('literal connection')
244
244
  plan = [{"QUERY PLAN"=>"Some Jazz"}]
245
- connection.stubs(:execute).returns(plan)
245
+ sql = "SELECT * FROM table WHERE id = 'noise $11'"
246
+ confirm_sql = Proc.new {|query| query.include?(sql) }
247
+ connection.expects(:execute).with(&confirm_sql).returns(plan)
246
248
  NewRelic::Agent::Database.stubs(:get_connection).with(config).returns(connection)
247
249
 
248
- sql = "SELECT * FROM table WHERE id = 'noise $11'"
249
250
  assert_equal([['QUERY PLAN'], [["Some Jazz"]]],
250
251
  NewRelic::Agent::Database.explain_sql(sql, config, @explainer))
251
252
  end
@@ -232,6 +232,17 @@ class NewRelic::Agent::Instrumentation::ActionViewSubscriberTest < Minitest::Tes
232
232
  assert_equal('View/model/_list.html.erb/Partial',
233
233
  partial_nodes[0].metric_name)
234
234
  end
235
+
236
+ def test_metric_path_identifies_file_render_event
237
+ render_event = NewRelic::Agent::Instrumentation::ActionViewSubscriber::RenderEvent.new('foo', 0, 0, 'bar', {} )
238
+ assert_equal('file', render_event.metric_path('baz', nil) )
239
+ end
240
+
241
+ def test_metric_path_cannot_identify_empty_collection_render_event
242
+ render_event = NewRelic::Agent::Instrumentation::ActionViewSubscriber::RenderEvent.new('foo', 0, 0, 'bar', {} )
243
+ assert_equal('(unknown)', render_event.metric_path('render_collection.action_view', nil) )
244
+ end
245
+
235
246
  end if ::Rails::VERSION::MAJOR.to_i >= 4
236
247
 
237
248
  else
@@ -57,6 +57,16 @@ module TestModuleWithLog
57
57
  add_method_tracer :other_method, 'Custom/foo/bar'
58
58
  end
59
59
 
60
+ class MyClass
61
+ def self.class_method
62
+ end
63
+
64
+ class << self
65
+ include NewRelic::Agent::MethodTracer
66
+ add_method_tracer :class_method
67
+ end
68
+ end
69
+
60
70
  class NewRelic::Agent::MethodTracerTest < Minitest::Test
61
71
  attr_reader :stats_engine
62
72
 
@@ -181,6 +191,25 @@ class NewRelic::Agent::MethodTracerTest < Minitest::Test
181
191
  assert stats.call_count == 1
182
192
  end
183
193
 
194
+ def test_add_class_method_tracer
195
+ MyClass.class_method
196
+ stats = @stats_engine.get_stats("Custom/MyClass/Class/class_method")
197
+ assert stats.call_count == 1
198
+ end
199
+
200
+ def test_add_anonymous_class_method_tracer
201
+ cls = Class.new do
202
+ def instance_method; end
203
+ include NewRelic::Agent::MethodTracer
204
+ add_method_tracer :instance_method
205
+ end
206
+
207
+ cls.new.instance_method
208
+ # require 'pry'; binding.pry
209
+ stats = @stats_engine.get_stats("Custom/AnonymousClass/instance_method")
210
+ assert stats.call_count == 1
211
+ end
212
+
184
213
  def test_add_method_tracer__reentry
185
214
  self.class.add_method_tracer :simple_method
186
215
  self.class.add_method_tracer :simple_method
@@ -7,7 +7,7 @@
7
7
  <div class="sql_statement">
8
8
  <small>
9
9
  <% if segment[:sql] %>
10
- <%= line_wrap_sql(segment[:sql].sql ) %>
10
+ <%= line_wrap_sql(segment[:sql].respond_to?(:sql) ? segment[:sql].sql : segment[:sql]) %>
11
11
  <% else %>
12
12
  Non-sql query: <%= segment.metric_name %> <%= line_wrap_sql(segment[:key]) %>
13
13
  <% end %></small>
@@ -9,7 +9,7 @@
9
9
  </th>
10
10
  <td colspan=<%= colspan %>><small>
11
11
  <div class="sql_statement">
12
- <%= line_wrap_sql(@sql.sql) %>
12
+ <%= line_wrap_sql(@sql.respond_to?(:sql) ? @sql.sql : @sql) %>
13
13
  </div>
14
14
  </small></td>
15
15
  </tr>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.0.314
4
+ version: 3.15.1.316
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tim Krajcar
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2016-02-11 00:00:00.000000000 Z
14
+ date: 2016-03-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rake
@@ -199,7 +199,7 @@ extra_rdoc_files:
199
199
  - CHANGELOG
200
200
  - LICENSE
201
201
  - README.md
202
- - GUIDELINES_FOR_CONTRIBUTING.md
202
+ - CONTRIBUTING.md
203
203
  - newrelic.yml
204
204
  files:
205
205
  - ".gitignore"
@@ -207,7 +207,7 @@ files:
207
207
  - ".travis.yml"
208
208
  - ".yardopts"
209
209
  - CHANGELOG
210
- - GUIDELINES_FOR_CONTRIBUTING.md
210
+ - CONTRIBUTING.md
211
211
  - Gemfile
212
212
  - Guardfile
213
213
  - LICENSE