Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Partial templates rendered time analysis #127

Merged
merged 1 commit into from

2 participants

@sars

Partial templates rendered time analysis added to rails3 logs analytics

@barttenbrinke
Collaborator
@barttenbrinke
Collaborator

Hi Sars,

that looks raelly nice!
However, it seems you forgot to add a test for the new behaviour and also change the current tests that are now failing.
It should be easy to convert the log fragment from issue 86 into a test and fix the failing ones.
You can find the test failures at travis (see link above or here; https://travis-ci.org/#!/wvanbergen/request-log-analyzer/jobs/3035568).
Please let me know if I can help you figure stuff out?
Greetings, Bart

@barttenbrinke barttenbrinke was assigned
@barttenbrinke barttenbrinke merged commit 4da346e into wvanbergen:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 12 additions and 3 deletions.
  1. +12 −3 lib/request_log_analyzer/file_format/rails3.rb
View
15 lib/request_log_analyzer/file_format/rails3.rb
@@ -61,13 +61,20 @@ class Rails3 < Base
line.capture(:line).as(:integer)
line.capture(:file)
end
-
+
+ # Rendered queries/index.html.erb (0.6ms)
+ line_definition :rendered do |line|
+ line.teaser = / Rendered /
+ line.regexp = / Rendered ([a-zA-Z0-9_\-.]+(?:\/[a-zA-Z0-9_\-.]+)+) \((\d+(?:\.\d+)?)ms\)/
+ line.capture(:rendered_file)
+ line.capture(:rendered_duration).as(:duration, :unit => :msec)
+ end
+
# # Not parsed at the moment:
# SQL (0.2ms) SET SQL_AUTO_IS_NULL=0
# Query Load (0.4ms) SELECT `queries`.* FROM `queries`
# Rendered collection (0.0ms)
- # Rendered queries/index.html.erb (0.6ms)
-
+
REQUEST_CATEGORIZER = lambda { |request| "#{request[:controller]}##{request[:action]}.#{request[:format]}" }
report do |analyze|
@@ -82,6 +89,8 @@ class Rails3 < Base
analyze.duration :duration, :category => REQUEST_CATEGORIZER, :title => "Request duration", :line_type => :completed
analyze.duration :view, :category => REQUEST_CATEGORIZER, :title => "View rendering time", :line_type => :completed
analyze.duration :db, :category => REQUEST_CATEGORIZER, :title => "Database time", :line_type => :completed
+
+ analyze.duration :rendered_duration, :category => :rendered_file, :title => 'Partials rendering time', :line_type => :rendered
analyze.frequency :category => REQUEST_CATEGORIZER, :title => 'Process blockers (> 1 sec duration)',
:if => lambda { |request| request[:duration] && request[:duration] > 1.0 }
Something went wrong with that request. Please try again.