newrelic_rpm 2.8.0

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.

Files changed (107) hide show
  1. data/LICENSE +37 -0
  2. data/README +93 -0
  3. data/Rakefile +38 -0
  4. data/install.rb +37 -0
  5. data/lib/new_relic/agent.rb +26 -0
  6. data/lib/new_relic/agent/agent.rb +762 -0
  7. data/lib/new_relic/agent/chained_call.rb +13 -0
  8. data/lib/new_relic/agent/collection_helper.rb +81 -0
  9. data/lib/new_relic/agent/error_collector.rb +105 -0
  10. data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +95 -0
  11. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +151 -0
  12. data/lib/new_relic/agent/instrumentation/data_mapper.rb +90 -0
  13. data/lib/new_relic/agent/instrumentation/dispatcher_instrumentation.rb +105 -0
  14. data/lib/new_relic/agent/instrumentation/memcache.rb +18 -0
  15. data/lib/new_relic/agent/instrumentation/merb/controller.rb +17 -0
  16. data/lib/new_relic/agent/instrumentation/merb/dispatcher.rb +15 -0
  17. data/lib/new_relic/agent/instrumentation/merb/errors.rb +6 -0
  18. data/lib/new_relic/agent/instrumentation/rails/action_controller.rb +35 -0
  19. data/lib/new_relic/agent/instrumentation/rails/action_web_service.rb +27 -0
  20. data/lib/new_relic/agent/instrumentation/rails/dispatcher.rb +30 -0
  21. data/lib/new_relic/agent/instrumentation/rails/errors.rb +23 -0
  22. data/lib/new_relic/agent/instrumentation/rails/rails.rb +6 -0
  23. data/lib/new_relic/agent/method_tracer.rb +171 -0
  24. data/lib/new_relic/agent/patch_const_missing.rb +31 -0
  25. data/lib/new_relic/agent/samplers/cpu.rb +29 -0
  26. data/lib/new_relic/agent/samplers/memory.rb +55 -0
  27. data/lib/new_relic/agent/samplers/mongrel.rb +26 -0
  28. data/lib/new_relic/agent/stats_engine.rb +241 -0
  29. data/lib/new_relic/agent/synchronize.rb +40 -0
  30. data/lib/new_relic/agent/transaction_sampler.rb +281 -0
  31. data/lib/new_relic/agent/worker_loop.rb +128 -0
  32. data/lib/new_relic/api/deployments.rb +92 -0
  33. data/lib/new_relic/config.rb +194 -0
  34. data/lib/new_relic/config/merb.rb +35 -0
  35. data/lib/new_relic/config/rails.rb +113 -0
  36. data/lib/new_relic/config/ruby.rb +9 -0
  37. data/lib/new_relic/local_environment.rb +108 -0
  38. data/lib/new_relic/merbtasks.rb +6 -0
  39. data/lib/new_relic/metric_data.rb +26 -0
  40. data/lib/new_relic/metric_spec.rb +39 -0
  41. data/lib/new_relic/metrics.rb +7 -0
  42. data/lib/new_relic/noticed_error.rb +21 -0
  43. data/lib/new_relic/shim_agent.rb +95 -0
  44. data/lib/new_relic/stats.rb +359 -0
  45. data/lib/new_relic/transaction_analysis.rb +122 -0
  46. data/lib/new_relic/transaction_sample.rb +499 -0
  47. data/lib/new_relic/version.rb +111 -0
  48. data/lib/new_relic_api.rb +275 -0
  49. data/lib/newrelic_rpm.rb +27 -0
  50. data/lib/tasks/agent_tests.rake +14 -0
  51. data/lib/tasks/all.rb +4 -0
  52. data/lib/tasks/install.rake +7 -0
  53. data/newrelic.yml +137 -0
  54. data/recipes/newrelic.rb +46 -0
  55. data/test/config/newrelic.yml +26 -0
  56. data/test/config/test_config.rb +9 -0
  57. data/test/new_relic/agent/mock_ar_connection.rb +40 -0
  58. data/test/new_relic/agent/mock_scope_listener.rb +23 -0
  59. data/test/new_relic/agent/model_fixture.rb +17 -0
  60. data/test/new_relic/agent/tc_active_record.rb +91 -0
  61. data/test/new_relic/agent/tc_agent.rb +112 -0
  62. data/test/new_relic/agent/tc_collection_helper.rb +104 -0
  63. data/test/new_relic/agent/tc_controller.rb +98 -0
  64. data/test/new_relic/agent/tc_dispatcher_instrumentation.rb +52 -0
  65. data/test/new_relic/agent/tc_error_collector.rb +127 -0
  66. data/test/new_relic/agent/tc_method_tracer.rb +306 -0
  67. data/test/new_relic/agent/tc_stats_engine.rb +218 -0
  68. data/test/new_relic/agent/tc_synchronize.rb +37 -0
  69. data/test/new_relic/agent/tc_transaction_sample.rb +175 -0
  70. data/test/new_relic/agent/tc_transaction_sample_builder.rb +200 -0
  71. data/test/new_relic/agent/tc_transaction_sampler.rb +305 -0
  72. data/test/new_relic/agent/tc_worker_loop.rb +101 -0
  73. data/test/new_relic/agent/testable_agent.rb +13 -0
  74. data/test/new_relic/tc_config.rb +36 -0
  75. data/test/new_relic/tc_deployments_api.rb +37 -0
  76. data/test/new_relic/tc_environment.rb +94 -0
  77. data/test/new_relic/tc_metric_spec.rb +150 -0
  78. data/test/new_relic/tc_shim_agent.rb +9 -0
  79. data/test/new_relic/tc_stats.rb +141 -0
  80. data/test/test_helper.rb +39 -0
  81. data/test/ui/tc_newrelic_helper.rb +44 -0
  82. data/ui/controllers/newrelic_controller.rb +200 -0
  83. data/ui/helpers/google_pie_chart.rb +55 -0
  84. data/ui/helpers/newrelic_helper.rb +286 -0
  85. data/ui/views/layouts/newrelic_default.rhtml +49 -0
  86. data/ui/views/newrelic/_explain_plans.rhtml +27 -0
  87. data/ui/views/newrelic/_sample.rhtml +12 -0
  88. data/ui/views/newrelic/_segment.rhtml +28 -0
  89. data/ui/views/newrelic/_segment_row.rhtml +14 -0
  90. data/ui/views/newrelic/_show_sample_detail.rhtml +22 -0
  91. data/ui/views/newrelic/_show_sample_sql.rhtml +19 -0
  92. data/ui/views/newrelic/_show_sample_summary.rhtml +3 -0
  93. data/ui/views/newrelic/_sql_row.rhtml +11 -0
  94. data/ui/views/newrelic/_stack_trace.rhtml +30 -0
  95. data/ui/views/newrelic/_table.rhtml +12 -0
  96. data/ui/views/newrelic/explain_sql.rhtml +45 -0
  97. data/ui/views/newrelic/images/arrow-close.png +0 -0
  98. data/ui/views/newrelic/images/arrow-open.png +0 -0
  99. data/ui/views/newrelic/images/blue_bar.gif +0 -0
  100. data/ui/views/newrelic/images/gray_bar.gif +0 -0
  101. data/ui/views/newrelic/index.rhtml +37 -0
  102. data/ui/views/newrelic/javascript/transaction_sample.js +107 -0
  103. data/ui/views/newrelic/sample_not_found.rhtml +2 -0
  104. data/ui/views/newrelic/show_sample.rhtml +62 -0
  105. data/ui/views/newrelic/show_source.rhtml +3 -0
  106. data/ui/views/newrelic/stylesheets/style.css +394 -0
  107. metadata +180 -0
@@ -0,0 +1,49 @@
1
+ <html xmlns="http://www.w3.org/1999/xhtml"
2
+ xml:lang="en" lang="en">
3
+ <head>
4
+ <%= javascript_include_tag "#{server}/javascripts/prototype" %>
5
+ <%= javascript_include_tag "#{server}/javascripts/effects" %>
6
+ <%= javascript_include_tag "#{server}/javascripts/dragdrop" %>
7
+ <%= javascript_include_tag "#{server}/javascripts/controls" %>
8
+ <link href="<%= url_for(:controller => :newrelic, :action => :css, :file => 'style.css') %>"
9
+ media="screen" rel="stylesheet" type="text/css" />
10
+ </head>
11
+ <body>
12
+ <div id="header">
13
+ <img width="100%" height="4" src="<%= url_for(:controller => :newrelic, :action => :image, :file => 'blue_bar.gif', :content_type => 'image/gif') %>" alt="spacer"/>
14
+ <table width="100%" height="60">
15
+ <tr>
16
+ <td valign="middle">
17
+ <a href='/newrelic'><img src="<%= server %>/images/new_relic_rpm_desktop.gif" hspace="10" alt="New Relic RPM"/></a>
18
+ </td>
19
+ <td class="top_nav" valign="bottom">
20
+ <ul id="navlist">
21
+ <li>&raquo; <a href='/newrelic'>Home</a></li>
22
+ </ul>
23
+ </td>
24
+ </tr>
25
+ </table>
26
+ <div id="page_nav">
27
+ <table width="100%" height="100%" background="<%= url_for(:controller => :newrelic, :action => :image, :file => 'gray_bar.gif', :content_type => 'image/gif') %>">
28
+ <tr valign="middle">
29
+ <td>
30
+ <span class="application_title">DEVELOPER MODE</span>
31
+ </td>
32
+ <td class="title_bar_right">
33
+ Monitor your Rails Application in production. <%=link_to 'Learn more.', 'http://www.newrelic.com/dev-upgrade.html' %>
34
+ </td>
35
+ </tr>
36
+ </table>
37
+ </div>
38
+ </div>
39
+ <div id='content'>
40
+ <%= yield %>
41
+ </div>
42
+ <div id='footer'>
43
+ <img width="100%" height="4" src="<%= url_for(:controller => :newrelic, :action => :image, :file => 'blue_bar.gif', :content_type => 'image/gif') %>" alt="spacer"/>
44
+ <p>We're Hiring! Are you a Rails Jock? We're venture funded and growing! <a href="&#109;&#97;&#105;&#108;&#116;&#111;:&#x6A;&#x6F;&#x62;&#115;&#64;&#x6E;&#101;&#x77;&#x72;&#x65;&#108;&#105;&#x63;&#x2E;&#99;&#x6F;&#x6D;?subject=&#x4A;&#x6F;&#105;&#110;&#x20;&#x55;&#x73;" title="">&#74;&#x6F;&#105;&#x6E;&#x20;&#85;&#x73;&#32;&#187;</a><br />
45
+ <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 />
46
+ Monitor your Rails Application in Production. <a href="http://www.newrelic.com/dev-upgrade.html">Learn more. &raquo;</a><br />
47
+ &copy; 2008 New Relic. All rights reserved.</p>
48
+ </div>
49
+ </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,12 @@
1
+ <tr class="<%= cycle('even_row', 'odd_row') %>">
2
+ <td align=right nowrap=true>
3
+ <%= colorize(stripped_sample(sample).duration, 1, 2) %> ms
4
+ </td>
5
+ <td>
6
+ <%= link_to "#{sample.params[:uri]}", :action => :show_sample_summary, :id => sample.sample_id %>
7
+ </td>
8
+ <td>
9
+ <%= link_to "[Detail]", :action => :show_sample_detail, :id => sample.sample_id %>
10
+ <%= link_to "[SQL]", :action => :show_sample_sql, :id => sample.sample_id %>
11
+ </td>
12
+ </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
+ <%= segment.duration.to_ms.with_delimiter %>
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,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><%= segment_row.exclusive_time.to_ms.with_delimiter %> ms</td>
10
+ <td align=right><%= segment_row.exclusive_time_percentage.to_percentage(0) %>% </td>
11
+ <td> </td>
12
+ <td align=right><%= segment_row.total_time.to_ms.with_delimiter %> ms</td>
13
+ <td align=right><%= segment_row.total_time_percentage.to_percentage(0) %>%</td>
14
+ </tr>
@@ -0,0 +1,22 @@
1
+ <script>
2
+ var EXPANDED_IMAGE = '<%=expanded_image_path%>';
3
+ var COLLAPSED_IMAGE = '<%= collapsed_image_path %>';
4
+ function Tip(tip) {}
5
+ function UnTip() {}
6
+ </script>
7
+ <span>
8
+ <%= link_to_function("Expand All", 'expand_all_segments()') %>&nbsp;&nbsp;
9
+ <%= link_to_function("Collapse All", 'collapse_all_segments()') %>
10
+ </span>
11
+ <table id="trace_detail_table" class="light_background" width="800px">
12
+ <thead>
13
+ <tr>
14
+ <td>Metric</td>
15
+ <td>Timestamp<br/><small>seconds</small></td>
16
+ <td>Duration<br/><small>ms</small></td>
17
+ <td>Exclusive<br/><small>ms</small></td>
18
+ <td></td>
19
+ </tr>
20
+ </thead>
21
+ <%= render_sample_details(@sample) %>
22
+ </table>
@@ -0,0 +1,19 @@
1
+ <% if rows_logger_present? %>
2
+ <h3>Plugin Incompatibility</h3>
3
+ The Rows Logger plugin rewrites part of Active Record, which in effect turns off the
4
+ SQL statement tracing functionality of NewRelic RPM Developer Mode. To gain SQL statement
5
+ visibility, you must remove <samp>rows_logger_plugin</samp>, or change your plugin load order
6
+ so that the rows logger is loaded first.
7
+ <% else %>
8
+ <table width="100%">
9
+ <thead>
10
+ <tr>
11
+ <td>Timestamp</td>
12
+ <td colspan="2">Duration</td>
13
+ <td>SQL</td>
14
+ </tr>
15
+ </thead>
16
+
17
+ <%= render :partial => agent_views_path('sql_row'), :collection => @sample.sql_segments %>
18
+ </table>
19
+ <% end %>
@@ -0,0 +1,3 @@
1
+ <h3>Performance Summary</h3>
2
+ <%= summary_pie_chart(@sample, 800, 300) %>
3
+ <%= render :partial => 'table', :object => @sample.breakdown_data(6) %>
@@ -0,0 +1,11 @@
1
+ <% segment = sql_row %>
2
+ <tr class='<%= cycle('even_row', 'odd_row') %>'>
3
+ <td align=right><%= timestamp(segment) %></td>
4
+ <td align=right><%= segment_duration_value(segment) %> </td>
5
+ <td> <%= link_to_source(segment[:backtrace]) %> </td>
6
+ <td align=left>
7
+ <div class="sql_statement">
8
+ <small><%= line_wrap_sql(segment[:sql] || segment[:sql_obfuscated]) %></small>
9
+ </div>
10
+ </td>
11
+ </tr>
@@ -0,0 +1,30 @@
1
+ <% trace = segment[:backtrace]
2
+ unique_id = "_#{trace.object_id}_#{(rand * 100000).to_i}"
3
+ show_link_id = "show_rails_link#{unique_id}"
4
+ hide_link_id = "hide_rails_link#{unique_id}"
5
+ app_stack_trace_id = "application_stack_trace#{unique_id}"
6
+ full_stack_trace_id = "full_stack_trace#{unique_id}"
7
+ %>
8
+ <%=
9
+ link_to_function('Show Rails', :id => show_link_id) do |page|
10
+ page[full_stack_trace_id].show
11
+ page[app_stack_trace_id].hide
12
+ page[show_link_id].hide
13
+ page[hide_link_id].show
14
+ end %>
15
+ <%=
16
+ link_to_function('Hide Rails', :id => hide_link_id, :style => "display: none;") do |page|
17
+ page[full_stack_trace_id].hide
18
+ page[app_stack_trace_id].show
19
+ page[hide_link_id].hide
20
+ page[show_link_id].show
21
+ end %>
22
+
23
+ <div id='<%=app_stack_trace_id%>' class="application_stack_trace">
24
+ <%= application_stack_trace(trace, false).collect { |trace_line| write_stack_trace_line(trace_line)}.join("<br/>") %>
25
+ </div>
26
+
27
+ <div id='<%=full_stack_trace_id%>' style="display: none;" class="full_stack_trace">
28
+ <%= application_stack_trace(trace, true).collect { |trace_line| write_stack_trace_line(trace_line)}.join("<br/>") %>
29
+ </div>
30
+
@@ -0,0 +1,12 @@
1
+ <table border="0" cellpadding="5" cellspacing="0">
2
+ <thead>
3
+ <tr>
4
+ <td>Metric</td>
5
+ <td>Count</td>
6
+ <td colspan=2>Exclusive</td>
7
+ <td/>
8
+ <td colspan=2>Total</td>
9
+ </tr>
10
+ </thead>
11
+ <%= render :partial => agent_views_path('segment_row'), :collection => table %>
12
+ </table>
@@ -0,0 +1,45 @@
1
+ <h3>Statement Analysis</h3>
2
+ <table>
3
+ <% colspan = @explanation ? @explanation.length : 1 %>
4
+ <% if @sql %>
5
+ <tr>
6
+ <th align=right valign=top>
7
+ Query
8
+ </th>
9
+ <td colspan=<%= colspan %>><small>
10
+ <div class="sql_statement">
11
+ <%= line_wrap_sql(@sql) %>
12
+ </div>
13
+ </small></td>
14
+ </tr>
15
+ <% end %>
16
+
17
+ <% if @obfuscated_sql %>
18
+ <tr>
19
+ <th align=right valign=top>
20
+ Obfuscated Query
21
+ </th>
22
+ <td colspan=<%= colspan %>><small>
23
+ <div class="sql_statement">
24
+ <%= line_wrap_sql(@obfuscated_sql) %>
25
+ </div>
26
+ </small></td>
27
+ </tr>
28
+ <% end %>
29
+
30
+ <tr>
31
+ <th align=right>
32
+ Duration
33
+ </th>
34
+ <td><%= @segment.duration.to_ms.with_delimiter %> ms</td>
35
+ </tr>
36
+ <% if @explanation %>
37
+ <%= render :partial => agent_views_path('explain_plans') %>
38
+ <% end %>
39
+ </table>
40
+
41
+ <p/>
42
+ <% if @segment[:backtrace] %>
43
+ <h3>Application Stack Trace</h3>
44
+ <%= render :partial => agent_views_path('stack_trace'), :locals => {:segment => @segment} %>
45
+ <% end %>
@@ -0,0 +1,37 @@
1
+ <table>
2
+ <tr>
3
+ <td valign=top>
4
+ <table class="transaction_list_table">
5
+ <thead>
6
+ <tr>
7
+ <td>Resp Time</td>
8
+ <td>URL</td>
9
+ <td/>
10
+ </tr>
11
+ </thead>
12
+ <%= render :partial => 'sample', :collection => @samples %>
13
+ </table>
14
+ </td>
15
+ <td valign=top>
16
+ <h3>Welcome</h3>
17
+ <p>
18
+ Welcome to <b>New Relic RPM Developer Mode</b>. This Rails extension traces the performance activity
19
+ of your 100 most recent controller actions in your rails application, and presents the performance
20
+ information for your analysis.
21
+ </p>
22
+ <p>
23
+ The url's of the most recent transactions are presented to the left, most-recent first. Click
24
+ on any one of these to drill down and inspect its performance information.
25
+ </p>
26
+ <p>
27
+ The identical agent technology that provides this data is also capable of monitoring your application as it
28
+ runs in production. For more information, visit <a href="http://www.newrelic.com">http://www.newrelic.com</a>.
29
+ </p>
30
+ <p>
31
+ Note, to increase the accuracy of our performance measurement, we automatically "strip out" any
32
+ time spent in application code loading, which will not happen when your application runs in
33
+ production mode.
34
+ </p>
35
+ </td>
36
+ <tr>
37
+ </table>
@@ -0,0 +1,107 @@
1
+
2
+ function show_request_params()
3
+ {
4
+ $('params_link').hide();
5
+ $('request_params').show();
6
+ }
7
+ function show_view(page_id){
8
+ ['show_sample_summary', 'show_sample_sql', 'show_sample_detail'].each(Element.hide);
9
+ $(page_id).show();
10
+ }
11
+ function toggle_row_class(theLink)
12
+ {
13
+ var image = theLink.firstChild;
14
+ var visible = toggle_row_class_for_image(image);
15
+ image.src = visible ? EXPANDED_IMAGE : COLLAPSED_IMAGE;
16
+ }
17
+ function toggle_row_class_for_image(image)
18
+ {
19
+ var clazz = image.getAttribute('class_for_children');
20
+ var elements = $('trace_detail_table').select('tr.' + clazz);
21
+ if (elements.length == 0) return;
22
+ var visible = !elements[0].visible();
23
+ show_or_hide_elements(elements, visible);
24
+ return visible;
25
+ }
26
+ function show_or_hide_class_elements(clazz, visible)
27
+ {
28
+ var elements = $('trace_detail_table').select('tr.' + clazz);
29
+ show_or_hide_elements(elements, visible);
30
+ }
31
+ function show_or_hide_elements(elements, visible)
32
+ {
33
+ elements.each(visible ? Element.show : Element.hide);
34
+ }
35
+
36
+ function mouse_over_row(element)
37
+ {
38
+ clazz = element.getAttribute('child_row_class')
39
+ element.style.cssText = "background-color:lightyellow";
40
+ return;
41
+ var style_element = get_cleared_highlight_styles();
42
+ style_element.appendChild(document.createTextNode('.' + clazz + ' { opacity: .7; }'));
43
+ }
44
+
45
+ var g_style_element;
46
+ function get_cleared_highlight_styles()
47
+ {
48
+ if (!g_style_element)
49
+ {
50
+ g_style_element = document.createElement('style');
51
+ g_style_element.setAttribute('id', 'highlight_styles');
52
+ document.getElementsByTagName('head')[0].appendChild(g_style_element);
53
+ }
54
+ else if (g_style_element.lastChild) {
55
+ g_style_element.removeChild(g_style_element.lastChild);
56
+ }
57
+ return g_style_element;
58
+ }
59
+
60
+ function mouse_out_row(element)
61
+ {
62
+ element.style.cssText = "";
63
+ return;
64
+ clazz = element.getAttribute('child_row_class')
65
+ get_cleared_highlight_styles();
66
+ }
67
+ function get_parent_segments()
68
+ {
69
+ return $('trace_detail_table').select('img.parent_segment_image');
70
+ }
71
+
72
+ function expand_all_segments()
73
+ {
74
+ var parent_segments = get_parent_segments();
75
+ for (var i = 0; i < parent_segments.length; i++)
76
+ {
77
+ parent_segments[i].src = EXPANDED_IMAGE;
78
+ show_or_hide_class_elements(parent_segments[i].getAttribute('class_for_children'), true);
79
+ }
80
+ }
81
+ function collapse_all_segments()
82
+ {
83
+ var parent_segments = get_parent_segments();
84
+ for (var i = 0; i < parent_segments.length; i++)
85
+ {
86
+ parent_segments[i].src = COLLAPSED_IMAGE;
87
+ show_or_hide_class_elements(parent_segments[i].getAttribute('class_for_children'), false);
88
+ }
89
+ }
90
+ function jump_to_metric(metric_name)
91
+ {
92
+ var elements = $('trace_detail_table').select('tr.' + metric_name);
93
+ for (var i = 0; i < elements.length; i++)
94
+ {
95
+ new Effect.Highlight(elements[i]); //, {endcolor : 'aliceblue'});
96
+ //elements[i].setStyle({backgroundColor: 'lightyellow'});
97
+ }
98
+ expand_all_segments();
99
+ }
100
+ function sql_mouse_over(id) {
101
+ var sql_div = $('sql_statement' + id);
102
+ if (sql_div)
103
+ Tip(sql_div.innerHTML);
104
+ }
105
+ function sql_mouse_out(id) {
106
+ UnTip();
107
+ }
@@ -0,0 +1,2 @@
1
+ <p>No sample found with this id. Did you restart your application? </p>
2
+ <%= link_to "Back", :action => :index%>