newrelic_rpm 3.1.0.djlogging → 3.1.0.djlogging2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of newrelic_rpm might be problematic. Click here for more details.

@@ -16,6 +16,7 @@ DependencyDetection.defer do
16
16
  NewRelic::Control.instance.log.info("Attempting to install Delayed Job initialization hook")
17
17
  value = defined?(::Delayed) && defined?(::Delayed::Worker)
18
18
  NewRelic::Control.instance.log.info("Delayed Job and Delayed Worker instrumentation #{value ? 'is' : 'is not'} being installed")
19
+ value
19
20
  end
20
21
 
21
22
  executes do
@@ -224,6 +224,11 @@ module NewRelic
224
224
  @sample_controller_name = metric_parser.controller_name
225
225
  @sample_action_name = metric_parser.action_name
226
226
 
227
+ @sql_segments = @sample.sql_segments
228
+ if params['d']
229
+ @sql_segments.sort!{|a,b| b.duration <=> a.duration }
230
+ end
231
+
227
232
  render(:show_sample)
228
233
  end
229
234
 
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 3
5
5
  MINOR = 1
6
6
  TINY = 0
7
- BUILD = 'djlogging' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 'djlogging2' #'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
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "3.1.0.djlogging"
8
+ s.version = "3.1.0.djlogging2"
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", "Justin George"]
12
- s.date = %q{2011-05-26}
12
+ s.date = %q{2011-05-31}
13
13
  s.description = %q{New Relic is a performance management system, developed by New Relic,
14
14
  Inc (http://www.newrelic.com). New Relic provides you with deep
15
15
  information about the performance of your web application as it runs
@@ -186,6 +186,7 @@ http://github.com/newrelic/rpm/
186
186
  "test/new_relic/metric_data_test.rb",
187
187
  "test/new_relic/metric_spec_test.rb",
188
188
  "test/new_relic/rack/all_test.rb",
189
+ "test/new_relic/rack/developer_mode_test.rb",
189
190
  "test/new_relic/stats_test.rb",
190
191
  "test/new_relic/transaction_analysis/segment_summary_test.rb",
191
192
  "test/new_relic/transaction_analysis_test.rb",
@@ -0,0 +1,43 @@
1
+ # ENV['SKIP_RAILS'] = 'true'
2
+ require File.expand_path(File.join(File.dirname(__FILE__),'..', '..',
3
+ 'test_helper'))
4
+ require 'rack/test'
5
+ require 'new_relic/rack/developer_mode'
6
+
7
+ ENV['RACK_ENV'] = 'test'
8
+
9
+ class DeveloperModeTest < Test::Unit::TestCase
10
+ include Rack::Test::Methods
11
+ include TransactionSampleTestHelper
12
+
13
+ def app
14
+ mock_app = lambda { |env| [500, {}, "Don't touch me!"] }
15
+ NewRelic::Rack::DeveloperMode.new(mock_app)
16
+ end
17
+
18
+ def setup
19
+ @sampler = NewRelic::Agent::TransactionSampler.new
20
+ run_sample_trace_on(@sampler, '/here')
21
+ run_sample_trace_on(@sampler, '/there')
22
+ run_sample_trace_on(@sampler, '/somewhere')
23
+ NewRelic::Agent.instance.stubs(:transaction_sampler).returns(@sampler)
24
+ end
25
+
26
+ def test_index_displays_all_samples
27
+ get '/newrelic'
28
+
29
+ assert last_response.ok?
30
+ assert last_response.body.include?('/here')
31
+ assert last_response.body.include?('/there')
32
+ assert last_response.body.include?('/somewhere')
33
+ end
34
+
35
+ def test_show_sample_summary_displays_sample_details
36
+ get "/newrelic/show_sample_summary?id=#{@sampler.samples[0].sample_id}"
37
+
38
+ assert last_response.ok?
39
+ assert last_response.body.include?('/here')
40
+ assert last_response.body.include?('SandwichesController')
41
+ assert last_response.body.include?('index')
42
+ end
43
+ end
@@ -123,4 +123,22 @@ module TransactionSampleTestHelper
123
123
 
124
124
  sampler.samples[0]
125
125
  end
126
+
127
+ def run_sample_trace_on(sampler, path='/path')
128
+ sampler.notice_first_scope_push Time.now.to_f
129
+ sampler.notice_transaction path, path, {}
130
+ sampler.notice_push_scope "Controller/sandwiches/index"
131
+ sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'wheat'", nil, 0)
132
+ sampler.notice_push_scope "ab"
133
+ sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'white'", nil, 0)
134
+ yield sampler if block_given?
135
+ sampler.notice_pop_scope "ab"
136
+ sampler.notice_push_scope "lew"
137
+ sampler.notice_sql("SELECT * FROM sandwiches WHERE bread = 'french'", nil, 0)
138
+ sampler.notice_pop_scope "lew"
139
+ sampler.notice_pop_scope "Controller/sandwiches/index"
140
+ sampler.notice_scope_empty
141
+ sampler.samples[0]
142
+ end
143
+
126
144
  end
@@ -6,15 +6,19 @@
6
6
  so that the rows logger is loaded first.
7
7
  <% else %>
8
8
  <%= render :partial => 'segment_limit_message' if trace_row_display_limit_reached %>
9
- <table width="100%">
9
+ <table width="100%" class="segment_list_table">
10
10
  <thead>
11
11
  <tr>
12
- <td>Timestamp</td>
13
- <td colspan="2">Duration</td>
12
+ <td>
13
+ <%= link_to_if params['d'], "Timestamp", "show_sample_sql?id=#{sample.sample_id}" %>
14
+ </td>
15
+ <td colspan="2">
16
+ <%= link_to_if !params['d'], "Duration", "show_sample_sql?id=#{sample.sample_id}&d=y" %>
17
+ </td>
14
18
  <td>SQL</td>
15
19
  </tr>
16
20
  </thead>
17
21
 
18
- <%= render :partial => 'sql_row', :collection => @sample.sql_segments[0...trace_row_display_limit] %>
22
+ <%= render :partial => 'sql_row', :collection => @sql_segments[0...trace_row_display_limit] %>
19
23
  </table>
20
24
  <% end %>
@@ -310,6 +310,12 @@ div.flash.notice
310
310
  text-decoration: underline;
311
311
  }
312
312
 
313
+ .segment_list_table thead a
314
+ {
315
+ color: white;
316
+ text-decoration: underline;
317
+ }
318
+
313
319
  .application_stack_trace, .full_stack_trace
314
320
  {
315
321
  font-family: monospace;
@@ -70,9 +70,10 @@
70
70
  <%= show_view_link 'SQL', 'show_sample_sql' %>
71
71
  </div>
72
72
  <br/>
73
+
73
74
  <%= %w[show_sample_summary show_sample_sql show_sample_detail].collect do |p|
74
75
  options = {:align => 'center', :id => p}
75
- options[:style] = 'display: none' unless p == params['action']
76
+ options[:style] = 'display: none' unless @req.path.include?(p)
76
77
  content_tag('div', render(:partial => p), options)
77
78
  end.join(' ') %>
78
79
  <% end %>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 886112865
4
+ hash: -511226757
5
5
  prerelease: true
6
6
  segments:
7
7
  - 3
8
8
  - 1
9
9
  - 0
10
- - djlogging
11
- version: 3.1.0.djlogging
10
+ - djlogging2
11
+ version: 3.1.0.djlogging2
12
12
  platform: ruby
13
13
  authors:
14
14
  - Bill Kayser
@@ -17,7 +17,7 @@ autorequire:
17
17
  bindir: bin
18
18
  cert_chain: []
19
19
 
20
- date: 2011-05-26 00:00:00 -07:00
20
+ date: 2011-05-31 00:00:00 -07:00
21
21
  default_executable:
22
22
  dependencies:
23
23
  - !ruby/object:Gem::Dependency
@@ -243,6 +243,7 @@ files:
243
243
  - test/new_relic/metric_data_test.rb
244
244
  - test/new_relic/metric_spec_test.rb
245
245
  - test/new_relic/rack/all_test.rb
246
+ - test/new_relic/rack/developer_mode_test.rb
246
247
  - test/new_relic/stats_test.rb
247
248
  - test/new_relic/transaction_analysis/segment_summary_test.rb
248
249
  - test/new_relic/transaction_analysis_test.rb