genki-newrelic_rpm 2.10.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (158) hide show
  1. data/CHANGELOG +316 -0
  2. data/LICENSE +37 -0
  3. data/Manifest +156 -0
  4. data/README.md +138 -0
  5. data/Rakefile +22 -0
  6. data/bin/mongrel_rpm +33 -0
  7. data/bin/newrelic_cmd +4 -0
  8. data/cert/cacert.pem +34 -0
  9. data/genki-newrelic_rpm.gemspec +32 -0
  10. data/init.rb +38 -0
  11. data/install.rb +37 -0
  12. data/lib/new_relic/agent.rb +280 -0
  13. data/lib/new_relic/agent/agent.rb +627 -0
  14. data/lib/new_relic/agent/chained_call.rb +13 -0
  15. data/lib/new_relic/agent/collection_helper.rb +61 -0
  16. data/lib/new_relic/agent/error_collector.rb +125 -0
  17. data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
  18. data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +83 -0
  19. data/lib/new_relic/agent/instrumentation/authlogic.rb +8 -0
  20. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +368 -0
  21. data/lib/new_relic/agent/instrumentation/data_mapper.rb +90 -0
  22. data/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb +132 -0
  23. data/lib/new_relic/agent/instrumentation/memcache.rb +21 -0
  24. data/lib/new_relic/agent/instrumentation/merb/controller.rb +26 -0
  25. data/lib/new_relic/agent/instrumentation/merb/dispatcher.rb +13 -0
  26. data/lib/new_relic/agent/instrumentation/merb/errors.rb +8 -0
  27. data/lib/new_relic/agent/instrumentation/net.rb +12 -0
  28. data/lib/new_relic/agent/instrumentation/passenger_instrumentation.rb +20 -0
  29. data/lib/new_relic/agent/instrumentation/rack.rb +77 -0
  30. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +59 -0
  31. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
  32. data/lib/new_relic/agent/instrumentation/rails/dispatcher.rb +38 -0
  33. data/lib/new_relic/agent/instrumentation/rails/errors.rb +27 -0
  34. data/lib/new_relic/agent/instrumentation/sinatra.rb +39 -0
  35. data/lib/new_relic/agent/method_tracer.rb +277 -0
  36. data/lib/new_relic/agent/patch_const_missing.rb +125 -0
  37. data/lib/new_relic/agent/sampler.rb +12 -0
  38. data/lib/new_relic/agent/samplers/cpu_sampler.rb +49 -0
  39. data/lib/new_relic/agent/samplers/memory_sampler.rb +137 -0
  40. data/lib/new_relic/agent/samplers/mongrel_sampler.rb +22 -0
  41. data/lib/new_relic/agent/shim_agent.rb +21 -0
  42. data/lib/new_relic/agent/stats_engine.rb +24 -0
  43. data/lib/new_relic/agent/stats_engine/metric_stats.rb +111 -0
  44. data/lib/new_relic/agent/stats_engine/samplers.rb +71 -0
  45. data/lib/new_relic/agent/stats_engine/transactions.rb +155 -0
  46. data/lib/new_relic/agent/transaction_sampler.rb +319 -0
  47. data/lib/new_relic/agent/worker_loop.rb +118 -0
  48. data/lib/new_relic/commands/deployments.rb +145 -0
  49. data/lib/new_relic/commands/new_relic_commands.rb +30 -0
  50. data/lib/new_relic/control.rb +436 -0
  51. data/lib/new_relic/control/external.rb +13 -0
  52. data/lib/new_relic/control/merb.rb +22 -0
  53. data/lib/new_relic/control/rails.rb +143 -0
  54. data/lib/new_relic/control/ruby.rb +34 -0
  55. data/lib/new_relic/control/sinatra.rb +14 -0
  56. data/lib/new_relic/histogram.rb +89 -0
  57. data/lib/new_relic/local_environment.rb +285 -0
  58. data/lib/new_relic/merbtasks.rb +6 -0
  59. data/lib/new_relic/metric_data.rb +44 -0
  60. data/lib/new_relic/metric_parser.rb +120 -0
  61. data/lib/new_relic/metric_parser/action_mailer.rb +9 -0
  62. data/lib/new_relic/metric_parser/active_merchant.rb +26 -0
  63. data/lib/new_relic/metric_parser/active_record.rb +25 -0
  64. data/lib/new_relic/metric_parser/controller.rb +54 -0
  65. data/lib/new_relic/metric_parser/controller_cpu.rb +38 -0
  66. data/lib/new_relic/metric_parser/errors.rb +6 -0
  67. data/lib/new_relic/metric_parser/external.rb +50 -0
  68. data/lib/new_relic/metric_parser/mem_cache.rb +12 -0
  69. data/lib/new_relic/metric_parser/view.rb +61 -0
  70. data/lib/new_relic/metric_parser/web_frontend.rb +14 -0
  71. data/lib/new_relic/metric_parser/web_service.rb +9 -0
  72. data/lib/new_relic/metric_spec.rb +52 -0
  73. data/lib/new_relic/metrics.rb +7 -0
  74. data/lib/new_relic/noticed_error.rb +25 -0
  75. data/lib/new_relic/rack/metric_app.rb +56 -0
  76. data/lib/new_relic/rack/newrelic.ru +25 -0
  77. data/lib/new_relic/rack/newrelic.yml +25 -0
  78. data/lib/new_relic/rack_app.rb +5 -0
  79. data/lib/new_relic/recipes.rb +82 -0
  80. data/lib/new_relic/stats.rb +360 -0
  81. data/lib/new_relic/transaction_analysis.rb +121 -0
  82. data/lib/new_relic/transaction_sample.rb +583 -0
  83. data/lib/new_relic/version.rb +54 -0
  84. data/lib/new_relic_api.rb +315 -0
  85. data/lib/newrelic_rpm.rb +40 -0
  86. data/lib/tasks/all.rb +4 -0
  87. data/lib/tasks/install.rake +7 -0
  88. data/lib/tasks/tests.rake +13 -0
  89. data/newrelic.yml +214 -0
  90. data/recipes/newrelic.rb +6 -0
  91. data/test/active_record_fixtures.rb +55 -0
  92. data/test/config/newrelic.yml +46 -0
  93. data/test/config/test_control.rb +39 -0
  94. data/test/new_relic/agent/active_record_instrumentation_test.rb +234 -0
  95. data/test/new_relic/agent/agent_controller_test.rb +107 -0
  96. data/test/new_relic/agent/agent_test.rb +117 -0
  97. data/test/new_relic/agent/agent_test_controller.rb +44 -0
  98. data/test/new_relic/agent/classloader_patch_test.rb +56 -0
  99. data/test/new_relic/agent/collection_helper_test.rb +118 -0
  100. data/test/new_relic/agent/dispatcher_instrumentation_test.rb +76 -0
  101. data/test/new_relic/agent/error_collector_test.rb +155 -0
  102. data/test/new_relic/agent/method_tracer_test.rb +335 -0
  103. data/test/new_relic/agent/metric_data_test.rb +56 -0
  104. data/test/new_relic/agent/mock_ar_connection.rb +40 -0
  105. data/test/new_relic/agent/mock_scope_listener.rb +23 -0
  106. data/test/new_relic/agent/net_instrumentation_test.rb +51 -0
  107. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +79 -0
  108. data/test/new_relic/agent/stats_engine/samplers_test.rb +78 -0
  109. data/test/new_relic/agent/stats_engine/stats_engine_test.rb +177 -0
  110. data/test/new_relic/agent/task_instrumentation_test.rb +67 -0
  111. data/test/new_relic/agent/testable_agent.rb +13 -0
  112. data/test/new_relic/agent/transaction_sample_builder_test.rb +195 -0
  113. data/test/new_relic/agent/transaction_sample_test.rb +146 -0
  114. data/test/new_relic/agent/transaction_sampler_test.rb +387 -0
  115. data/test/new_relic/agent/worker_loop_test.rb +103 -0
  116. data/test/new_relic/control_test.rb +94 -0
  117. data/test/new_relic/deployments_api_test.rb +68 -0
  118. data/test/new_relic/environment_test.rb +75 -0
  119. data/test/new_relic/metric_parser_test.rb +172 -0
  120. data/test/new_relic/metric_spec_test.rb +177 -0
  121. data/test/new_relic/shim_agent_test.rb +9 -0
  122. data/test/new_relic/stats_test.rb +291 -0
  123. data/test/new_relic/version_number_test.rb +74 -0
  124. data/test/test_helper.rb +38 -0
  125. data/test/ui/newrelic_controller_test.rb +14 -0
  126. data/test/ui/newrelic_helper_test.rb +53 -0
  127. data/ui/controllers/newrelic_controller.rb +214 -0
  128. data/ui/helpers/google_pie_chart.rb +55 -0
  129. data/ui/helpers/newrelic_helper.rb +314 -0
  130. data/ui/views/layouts/newrelic_default.rhtml +47 -0
  131. data/ui/views/newrelic/_explain_plans.rhtml +27 -0
  132. data/ui/views/newrelic/_sample.rhtml +15 -0
  133. data/ui/views/newrelic/_segment.rhtml +28 -0
  134. data/ui/views/newrelic/_segment_limit_message.rhtml +1 -0
  135. data/ui/views/newrelic/_segment_row.rhtml +14 -0
  136. data/ui/views/newrelic/_show_sample_detail.rhtml +24 -0
  137. data/ui/views/newrelic/_show_sample_sql.rhtml +20 -0
  138. data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
  139. data/ui/views/newrelic/_sql_row.rhtml +11 -0
  140. data/ui/views/newrelic/_stack_trace.rhtml +30 -0
  141. data/ui/views/newrelic/_table.rhtml +12 -0
  142. data/ui/views/newrelic/explain_sql.rhtml +42 -0
  143. data/ui/views/newrelic/images/arrow-close.png +0 -0
  144. data/ui/views/newrelic/images/arrow-open.png +0 -0
  145. data/ui/views/newrelic/images/blue_bar.gif +0 -0
  146. data/ui/views/newrelic/images/file_icon.png +0 -0
  147. data/ui/views/newrelic/images/gray_bar.gif +0 -0
  148. data/ui/views/newrelic/images/new_relic_rpm_desktop.gif +0 -0
  149. data/ui/views/newrelic/images/textmate.png +0 -0
  150. data/ui/views/newrelic/index.rhtml +45 -0
  151. data/ui/views/newrelic/javascript/prototype-scriptaculous.js +7288 -0
  152. data/ui/views/newrelic/javascript/transaction_sample.js +107 -0
  153. data/ui/views/newrelic/sample_not_found.rhtml +2 -0
  154. data/ui/views/newrelic/show_sample.rhtml +77 -0
  155. data/ui/views/newrelic/show_source.rhtml +3 -0
  156. data/ui/views/newrelic/stylesheets/style.css +433 -0
  157. data/ui/views/newrelic/threads.rhtml +52 -0
  158. metadata +327 -0
@@ -0,0 +1,314 @@
1
+ require 'pathname'
2
+ require 'new_relic/agent/collection_helper'
3
+ module NewrelicHelper
4
+ include NewRelic::Agent::CollectionHelper
5
+
6
+ # return the host that serves static content (css, metric documentation, images, etc)
7
+ # that supports the desktop edition.
8
+ def server
9
+ NewRelic::Control.instance['desktop_server'] || "http://rpm.newrelic.com"
10
+ end
11
+
12
+ # limit of how many detail/SQL rows we display - very large data sets (~10000+) crash browsers
13
+ def trace_row_display_limit
14
+ 2000
15
+ end
16
+
17
+ def trace_row_display_limit_reached
18
+ (!@detail_segment_count.nil? && @detail_segment_count > trace_row_display_limit) || @sample.sql_segments.length > trace_row_display_limit
19
+ end
20
+
21
+ # return the sample but post processed to strip out segments that normally don't show
22
+ # up in production (after the first execution, at least) such as application code loading
23
+ def stripped_sample(sample = @sample)
24
+ if session[:newrelic_strip_code_loading] || true
25
+ sample.omit_segments_with('(Rails/Application Code Loading)|(Database/.*/.+ Columns)')
26
+ else
27
+ sample
28
+ end
29
+ end
30
+
31
+ # return the highest level in the call stack for the trace that is not rails or
32
+ # newrelic agent code
33
+ def application_caller(trace)
34
+ trace = strip_nr_from_backtrace(trace) unless params[:show_nr]
35
+ trace.each do |trace_line|
36
+ file = file_and_line(trace_line).first
37
+ unless exclude_file_from_stack_trace?(file, false)
38
+ return trace_line
39
+ end
40
+ end
41
+ trace.last
42
+ end
43
+
44
+ def application_stack_trace(trace, include_rails = false)
45
+ trace = strip_nr_from_backtrace(trace) unless params[:show_nr]
46
+ trace.reject do |trace_line|
47
+ file = file_and_line(trace_line).first
48
+ exclude_file_from_stack_trace?(file, include_rails)
49
+ end
50
+ end
51
+
52
+ def render_backtrace
53
+ if @segment[:backtrace]
54
+ content_tag('h3', 'Application Stack Trace') +
55
+ render(:partial => agent_views_path('stack_trace'), :locals => {:segment => @segment})
56
+ end
57
+ end
58
+
59
+ def agent_views_path(path)
60
+ path
61
+ end
62
+
63
+ def url_for_metric_doc(metric_name)
64
+ "#{server}/metric_doc?metric=#{CGI::escape(metric_name)}"
65
+ end
66
+
67
+ def url_for_source(trace_line)
68
+ file, line = file_and_line(trace_line)
69
+
70
+ begin
71
+ file = Pathname.new(file).realpath
72
+ rescue Errno::ENOENT
73
+ # we hit this exception when Pathame.realpath fails for some reason; attempt a link to
74
+ # the file without a real path. It may also fail, only when the user clicks on this specific
75
+ # entry in the stack trace
76
+ rescue
77
+ # catch all other exceptions. We're going to create an invalid link below, but that's okay.
78
+ end
79
+
80
+ if using_textmate?
81
+ "txmt://open?url=file://#{file}&line=#{line}"
82
+ else
83
+ url_for :action => 'show_source', :file => file, :line => line, :anchor => 'selected_line'
84
+ end
85
+ end
86
+
87
+ def dev_name(metric_name)
88
+ NewRelic::MetricParser.parse(metric_name).developer_name
89
+ end
90
+
91
+ # write the metric label for a segment metric in the detail view
92
+ def write_segment_label(segment)
93
+ if source_available && segment[:backtrace] && (source_url = url_for_source(application_caller(segment[:backtrace])))
94
+ link_to dev_name(segment.metric_name), source_url
95
+ else
96
+ h(dev_name(segment.metric_name))
97
+ end
98
+ end
99
+
100
+ def source_available
101
+ true
102
+ end
103
+
104
+ # write the metric label for a segment metric in the summary table of metrics
105
+ def write_summary_segment_label(segment)
106
+ dev_name(segment.metric_name)
107
+ end
108
+
109
+ def write_stack_trace_line(trace_line)
110
+ link_to h(trace_line), url_for_source(trace_line)
111
+ end
112
+
113
+ # write a link to the source for a trace
114
+ def link_to_source(trace)
115
+ image_url = url_for(:controller => :newrelic, :action => :file, :file => (using_textmate? ? "textmate.png" : "file_icon.png"))
116
+
117
+ link_to image_tag(image_url, :alt => (title = 'View Source'), :title => title), url_for_source(application_caller(trace))
118
+ end
119
+
120
+ # print the formatted timestamp for a segment
121
+ def timestamp(segment)
122
+ sprintf("%1.3f", segment.entry_timestamp)
123
+ end
124
+
125
+ def format_timestamp(time)
126
+ time.strftime("%H:%M:%S")
127
+ end
128
+
129
+ def colorize(value, yellow_threshold = 0.05, red_threshold = 0.15, s=to_ms(value))
130
+ if value > yellow_threshold
131
+ color = (value > red_threshold ? 'red' : 'orange')
132
+ "<font color=#{color}>#{s}</font>"
133
+ else
134
+ "#{s}"
135
+ end
136
+ end
137
+
138
+ def expanded_image_path()
139
+ url_for(:controller => :newrelic, :action => :file, :file => 'arrow-open.png')
140
+ end
141
+
142
+ def collapsed_image_path()
143
+ url_for(:controller => :newrelic, :action => :file, :file => 'arrow-close.png')
144
+ end
145
+
146
+ def explain_sql_url(segment)
147
+ url_for(:action => :explain_sql,
148
+ :id => @sample.sample_id,
149
+ :segment => segment.segment_id)
150
+ end
151
+
152
+ def segment_duration_value(segment)
153
+ link_to colorize(segment.duration, 0.05, 0.15, "#{with_delimiter(to_ms(segment.duration))} ms"), explain_sql_url(segment)
154
+ end
155
+
156
+ def line_wrap_sql(sql)
157
+ h(sql.gsub(/\,/,', ').squeeze(' ')) if sql
158
+ end
159
+
160
+ def render_sample_details(sample)
161
+ @indentation_depth=0
162
+ # skip past the root segments to the first child, which is always the controller
163
+ first_segment = sample.root_segment.called_segments.first
164
+
165
+ # render the segments, then the css classes to indent them
166
+ render_segment_details(first_segment) + render_indentation_classes(@indentation_depth)
167
+ end
168
+
169
+ # the rows logger plugin disables the sql tracing functionality of the NewRelic agent -
170
+ # notify the user about this
171
+ def rows_logger_present?
172
+ File.exist?(File.join(File.dirname(__FILE__), "../../../rows_logger/init.rb"))
173
+ end
174
+
175
+ def expand_segment_image(segment, depth)
176
+ if depth > 0
177
+ if !segment.called_segments.empty?
178
+ row_class =segment_child_row_class(segment)
179
+ link_to_function(tag('img', :src => collapsed_image_path, :id => "image_#{row_class}",
180
+ :class_for_children => row_class,
181
+ :class => (!segment.called_segments.empty?) ? 'parent_segment_image' : 'child_segment_image'),
182
+ "toggle_row_class(this)")
183
+ end
184
+ end
185
+ end
186
+
187
+ def segment_child_row_class(segment)
188
+ "segment#{segment.segment_id}"
189
+ end
190
+
191
+ def summary_pie_chart(sample, width, height)
192
+ pie_chart = GooglePieChart.new
193
+ pie_chart.color, pie_chart.width, pie_chart.height = '6688AA', width, height
194
+
195
+ chart_data = sample.breakdown_data(6)
196
+ chart_data.each { |s| pie_chart.add_data_point dev_name(s.metric_name), to_ms(s.exclusive_time) }
197
+
198
+ pie_chart.render
199
+ end
200
+
201
+ def segment_row_classes(segment, depth)
202
+ classes = []
203
+
204
+ classes << "segment#{segment.parent_segment.segment_id}" if depth > 1
205
+
206
+ classes << "view_segment" if segment.metric_name.starts_with?('View')
207
+ classes << "summary_segment" if segment.is_a?(NewRelic::TransactionSample::CompositeSegment)
208
+
209
+ classes.join(' ')
210
+ end
211
+
212
+ # render_segment_details should be called before calling this method
213
+ def render_indentation_classes(depth)
214
+ styles = []
215
+ (1..depth).each do |d|
216
+ styles << ".segment_indent_level#{d} { display: inline-block; margin-left: #{(d-1)*20}px }"
217
+ end
218
+ content_tag("style", styles.join(' '))
219
+ end
220
+
221
+ def sql_link_mouseover_options(segment)
222
+ { :onmouseover => "sql_mouse_over(#{segment.segment_id})", :onmouseout => "sql_mouse_out(#{segment.segment_id})"}
223
+ end
224
+
225
+ def explain_sql_link(segment, child_sql = false)
226
+ link_to 'SQL', explain_sql_url(segment), sql_link_mouseover_options(segment)
227
+ end
228
+
229
+ def explain_sql_links(segment)
230
+ if segment[:sql_obfuscated] || segment[:sql]
231
+ explain_sql_link segment
232
+ else
233
+ links = []
234
+ segment.called_segments.each do |child|
235
+ if child[:sql_obfuscated] || child[:sql]
236
+ links << explain_sql_link(child, true)
237
+ end
238
+ end
239
+ links[0..1].join(', ') + (links.length > 2?', ...':'')
240
+ end
241
+ end
242
+
243
+ private
244
+ def file_and_line(stack_trace_line)
245
+ stack_trace_line.match(/(.*):(\d+)/)[1..2]
246
+ end
247
+
248
+ def using_textmate?
249
+ NewRelic::Control.instance.use_textmate?
250
+ end
251
+
252
+
253
+ def render_segment_details(segment, depth=0)
254
+ @detail_segment_count ||= 0
255
+ @detail_segment_count += 1
256
+
257
+ return '' if @detail_segment_count > trace_row_display_limit
258
+
259
+ @indentation_depth = depth if depth > @indentation_depth
260
+ repeat = nil
261
+ if segment.is_a?(NewRelic::TransactionSample::CompositeSegment)
262
+ html = ''
263
+ else
264
+ repeat = segment.parent_segment.detail_segments.length if segment.parent_segment.is_a?(NewRelic::TransactionSample::CompositeSegment)
265
+ html = render(:partial => agent_views_path('segment'), :object => segment, :locals => {:indent => depth, :repeat => repeat})
266
+ depth += 1
267
+ end
268
+
269
+ segment.called_segments.each do |child|
270
+ html << render_segment_details(child, depth)
271
+ end
272
+
273
+ html
274
+ end
275
+
276
+ def exclude_file_from_stack_trace?(file, include_rails)
277
+ !include_rails && (
278
+ file =~ /\/active(_)*record\// ||
279
+ file =~ /\/action(_)*controller\// ||
280
+ file =~ /\/activesupport\// ||
281
+ file =~ /\/lib\/mongrel/ ||
282
+ file =~ /\/actionpack\// ||
283
+ file =~ /\/passenger\// ||
284
+ file =~ /\/benchmark.rb/ ||
285
+ file !~ /\.rb/) # must be a .rb file, otherwise it's a script of something else...we could have gotten trickier and tried to see if this file exists...
286
+ end
287
+
288
+ def show_view_link(title, page_name)
289
+ link_to_function("[#{title}]", "show_view('#{page_name}')");
290
+ end
291
+ def mime_type_from_extension(extension)
292
+ extension = extension[/[^.]*$/].downcase
293
+ case extension
294
+ when 'png'; 'image/png'
295
+ when 'gif'; 'image/gif'
296
+ when 'jpg'; 'image/jpg'
297
+ when 'css'; 'text/css'
298
+ when 'js'; 'text/javascript'
299
+ else 'text/plain'
300
+ end
301
+ end
302
+ def to_ms(number)
303
+ (number*1000).round
304
+ end
305
+ def to_percentage(value)
306
+ (value * 100).round if value
307
+ end
308
+ def with_delimiter(val)
309
+ return '0' if val.nil?
310
+ parts = val.to_s.split('.')
311
+ parts[0].gsub!(/(\d)(?=(\d\d\d)+(?!\d))/, "\\1,")
312
+ parts.join '.'
313
+ end
314
+ end
@@ -0,0 +1,47 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml"
2
+ xml:lang="en" lang="en">
3
+ <head>
4
+ <script type="text/javascript" src="<%= url_for(:controller => :newrelic, :action => :file, :file => 'prototype-scriptaculous.js') %>"></script>
5
+ <title>New Relic RPM Developer Mode</title>
6
+ <link href="<%= url_for(:controller => :newrelic, :action => :file, :file => 'style.css') %>"
7
+ media="screen" rel="stylesheet" type="text/css" />
8
+ </head>
9
+ <body>
10
+ <div id="header">
11
+ <img width="100%" height="4" src="<%= url_for(:controller => :newrelic, :action => :file, :file => 'blue_bar.gif') %>" alt="spacer"/>
12
+ <table width="100%" height="60">
13
+ <tr>
14
+ <td valign="middle">
15
+ <a href='/newrelic'><img src="<%= url_for(:controller => :newrelic, :action => :file, :file => 'new_relic_rpm_desktop.gif') %>" hspace="10" alt="New Relic RPM"/></a>
16
+ </td>
17
+ <td class="top_nav" valign="bottom">
18
+ <ul id="navlist">
19
+ <li>&raquo; <a href='/newrelic'>Home</a></li>
20
+ </ul>
21
+ </td>
22
+ </tr>
23
+ </table>
24
+ <div id="page_nav">
25
+ <table width="100%" height="100%" background="<%= url_for(:controller => :newrelic, :action => :file, :file => 'gray_bar.gif') %>">
26
+ <tr valign="middle">
27
+ <td>
28
+ <span class="application_title">Developer Mode</span>
29
+ </td>
30
+ <td class="title_bar_right">
31
+ Monitor your Rails Application in production. <%=link_to 'Learn more.', 'http://www.newrelic.com/dev-upgrade.html' %>
32
+ </td>
33
+ </tr>
34
+ </table>
35
+ </div>
36
+ </div>
37
+ <div id='content'>
38
+ <%= yield %>
39
+ </div>
40
+ <div id='footer'>
41
+ <img width="100%" height="4" src="<%= url_for(:controller => :newrelic, :action => :file, :file => 'blue_bar.gif', :content_type => 'image/gif') %>" alt="spacer"/>
42
+ <p>
43
+ <a href="/newrelic">Home</a> | <a href="&#109;&#97;&#105;&#108;&#116;&#111;:&#x73;&#x75;&#x70;&#112;&#111;&#x72;&#116;&#x40;&#x6E;&#x65;&#119;&#114;&#x65;&#x6C;&#105;&#x63;&#x2E;&#99;&#x6F;&#109;?subject=&#70;&#101;&#x65;&#x64;&#x62;&#x61;&#x63;&#107;" title="">&#x46;&#x65;&#101;&#x64;&#98;&#97;&#x63;&#x6B;</a><br />
44
+ Monitor your Rails Application in Production. <a href="http://www.newrelic.com/dev-upgrade.html">Learn more. &raquo;</a><br />
45
+ &copy; 2008 - <%= Time.now.strftime('%Y') %> New Relic. All rights reserved.</p>
46
+ </div>
47
+ </body>
@@ -0,0 +1,27 @@
1
+ <% if @row_headers %>
2
+ <% @row_headers.length.times do |r| %>
3
+ <% if @row_headers[r] %>
4
+ <tr>
5
+ <th align=right nowrap>
6
+ <%= @row_headers[r]%>
7
+ </th>
8
+ <% @explanation.each do |exp| %>
9
+ <td>
10
+ <%= exp[r]%>
11
+ </td>
12
+ <% end %>
13
+ </tr>
14
+ <% end %>
15
+ <% end %>
16
+ <% else %>
17
+ <tr>
18
+ <th align=right>Plan</th>
19
+ <td><p class="plan">
20
+ <% @explanation.each do |row| -%>
21
+ <% row.each do |col| -%>
22
+ <%= h(col) %>
23
+ <% end -%>
24
+ <% end -%>
25
+ </p></td>
26
+ </tr>
27
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <tr class="<%= cycle('even_row', 'odd_row') %>">
2
+ <td align=right nowrap=true>
3
+ <%= Time.at(stripped_sample(sample).timestamp).strftime "%H:%M:%S" %>
4
+ </td>
5
+ <td align=right nowrap=true>
6
+ <%= colorize(stripped_sample(sample).duration, 1, 2) %> ms
7
+ </td>
8
+ <td>
9
+ <%= link_to "#{sample.params[:uri]}", :action => :show_sample_summary, :id => sample.sample_id %>
10
+ </td>
11
+ <td>
12
+ <%= link_to "[Detail]", :action => :show_sample_detail, :id => sample.sample_id %>
13
+ <%= link_to "[SQL (#{sample.sql_segments.size})]", :action => :show_sample_sql, :id => sample.sample_id %>
14
+ </td>
15
+ </tr>
@@ -0,0 +1,28 @@
1
+ <tr style="<%= 'display:none' if indent > 1 %>" child_row_class="<%=segment_child_row_class(segment)%>" onmouseover="mouse_over_row(this)" onmouseout="mouse_out_row(this)" class='<%=segment_row_classes(segment, indent)%>'>
2
+
3
+ <td nowrap=true>
4
+ <div class="segment_indent_level<%=indent%> <%='leaf_segment' if segment.called_segments.empty?%>">
5
+ <div style="display:inline;">
6
+ <%= expand_segment_image(segment, indent) %>
7
+ </div>
8
+ <%= write_segment_label segment%>
9
+ <small><%= link_to '?', url_for_metric_doc(segment.metric_name)%></small>
10
+ </div>
11
+ </td>
12
+
13
+ <td nowrap=true align="right">
14
+ <%= timestamp(segment) %>
15
+ </td>
16
+ <td nowrap=true align="right">
17
+ <%= with_delimiter(to_ms(segment.duration)) %>
18
+ </td>
19
+ <td nowrap=true align="right">
20
+ <%= colorize(segment.exclusive_duration) %>
21
+ </td>
22
+
23
+ <td nowrap=true>
24
+ <small>
25
+ <%= explain_sql_links(segment) if indent > 0 %>
26
+ </small>
27
+ </td>
28
+ </tr>
@@ -0,0 +1 @@
1
+ This report is limited to <%= trace_row_display_limit %> rows.
@@ -0,0 +1,14 @@
1
+ <tr class='<%= cycle('even_row', 'odd_row') %>'>
2
+ <td>
3
+ <%= write_summary_segment_label segment_row %>
4
+ <small>
5
+ <%= link_to "?", url_for_metric_doc(segment_row.metric_name) %>
6
+ </small>
7
+ </td>
8
+ <td align=left> <%= segment_row.call_count %></td>
9
+ <td align=right><%= with_delimiter(to_ms(segment_row.exclusive_time)) %> ms</td>
10
+ <td align=right><%= to_percentage(segment_row.exclusive_time_percentage) %>% </td>
11
+ <td> </td>
12
+ <td align=right><%= with_delimiter(to_ms(segment_row.total_time)) %> ms</td>
13
+ <td align=right><%= to_percentage(segment_row.total_time_percentage) %>%</td>
14
+ </tr>