Index: openacs-4/packages/xotcl-request-monitor/xotcl-request-monitor.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/xotcl-request-monitor.info,v diff -u -r1.10.2.7 -r1.10.2.8 --- openacs-4/packages/xotcl-request-monitor/xotcl-request-monitor.info 29 Jan 2017 18:15:15 -0000 1.10.2.7 +++ openacs-4/packages/xotcl-request-monitor/xotcl-request-monitor.info 30 Jan 2017 11:29:51 -0000 1.10.2.8 @@ -8,11 +8,11 @@ t request-monitor - + Gustaf Neumann WU Vienna Request Monitor with user tracking functionality - 2016-04-26 + 2017-01-30 <pre> This package provides a Request Monitor for OpenACS applications. It computes performance summary information such as requests/views per seconds, average response time, number @@ -34,7 +34,7 @@ BSD-Style 2 - + Index: openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl,v diff -u -r1.43.2.10 -r1.43.2.11 --- openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 29 Jan 2017 18:15:15 -0000 1.43.2.10 +++ openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 30 Jan 2017 11:29:51 -0000 1.43.2.11 @@ -334,29 +334,29 @@ # # conntime: time spent in connection thread in ms, not including queuing times # totaltime: time since start of the request - #set conntime [expr {int(([dict get $partialtimes runtime] + [dict get $partialtimes filtertime]) * 1000)}] + set conntime [expr {int(([dict get $partialtimes runtime] + [dict get $partialtimes filtertime]) * 1000)}] set totaltime [dict get $partialtimes ms] - #ns_log notice "url=<$url> totaltime $totaltime" + #ns_log notice "conntime $conntime totaltime $totaltime url=<$url>" if { $url in {/register/ / /dotlrn/} } { # # calculate for certain URLs separate statistics # incr ::agg_time($url) $totaltime incr ::count(calls:$url) } - if {$totaltime > 5000} { + if {$conntime > 3000} { if {$url eq "/register/"} { set color unexpected - } elseif {$totaltime > 10000} { + } elseif {$conntime > 7000} { set color red - } elseif {$totaltime > 6000} { + } elseif {$conntime > 5000} { set color orange } else { set color yellow } incr ::count(longcalls:$color) - catch {:log [list $url $totaltime $key $pa $content_type]} + catch {:log [list $url $partialtimes $key $pa $content_type]} } next } Index: openacs-4/packages/xotcl-request-monitor/www/long-calls.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/long-calls.adp,v diff -u -r1.2.2.3 -r1.2.2.4 --- openacs-4/packages/xotcl-request-monitor/www/long-calls.adp 30 Nov 2016 08:16:17 -0000 1.2.2.3 +++ openacs-4/packages/xotcl-request-monitor/www/long-calls.adp 30 Jan 2017 11:29:51 -0000 1.2.2.4 @@ -19,7 +19,10 @@ - + + + + Index: openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl,v diff -u -r1.2.2.5 -r1.2.2.6 --- openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl 14 Dec 2016 08:05:12 -0000 1.2.2.5 +++ openacs-4/packages/xotcl-request-monitor/www/long-calls.tcl 30 Jan 2017 11:29:51 -0000 1.2.2.6 @@ -1,5 +1,5 @@ ad_page_contract { - Displays last n lines of long-calls log + Displays last n lines of long-calls log @author Gustaf Neumann @@ -13,28 +13,38 @@ } proc ::xo::userid_link {uid} { - if {![string is integer -strict $uid]} { - set userinfo 0 - } else { - set user_url [acs_community_member_admin_url -user_id $uid] - set userinfo "$uid" - } - return $userinfo + if {![string is integer -strict $uid]} { + set userinfo 0 + } else { + set user_url [acs_community_member_admin_url -user_id $uid] + set userinfo "$uid" + } + return $userinfo } proc ::xo::regsub_eval {re string cmd {prefix ""}} { set map { \" \\\" \[ \\[ \] \\] \$ \\$ \\ \\\\} return [uplevel [list subst [regsub -all $re [string map $map $string] "\[$cmd\]"]]] } proc ::xo::subst_user_link {prefix uid} { - return $prefix[::xo::userid_link $uid] + return $prefix[::xo::userid_link $uid] } +nsf::proc ::xo::colorize_slow_calls {-warning:required -danger:required value} { + if {$value > $danger} { + return danger + } elseif {$value > $warning} { + return warning + } else { + return info + } +} + set long_calls_file [file dirname [ns_info log]]/long-calls.log set filesize [file size $long_calls_file] set F [open $long_calls_file] if {$readsize < $filesize} { - seek $F -$readsize end + seek $F -$readsize end } set c [read $F]; close $F @@ -43,20 +53,43 @@ set c1 [string range $c [lindex $o 0]+1 end] set rows "" foreach line [lreverse [split $c1 \n]] { - if {$line eq ""} continue - lassign $line wday mon day hours tz year dash url time uid ip fmt - set userinfo [::xo::userid_link $uid] - set iplink [subst {[ns_quotehtml $ip]}] + if {$line eq ""} continue + lassign $line wday mon day hours tz year dash url time uid ip fmt + set userinfo [::xo::userid_link $uid] + set iplink [subst {[ns_quotehtml $ip]}] + if {[llength $time] > 1} { + set queuetime [dict get $time queuetime] + set filtertime [dict get $time filtertime] + set runtime [dict get $time runtime] + set totaltime [expr {$queuetime + $filtertime + $runtime}] + set color(queuetime) [::xo::colorize_slow_calls -warning 1.000 -danger 5.000 $queuetime] + set color(filtertime) [::xo::colorize_slow_calls -warning 0.500 -danger 1.000 $filtertime] + set color(runtime) [::xo::colorize_slow_calls -warning 3.000 -danger 5.000 $runtime] + set color(totaltime) [::xo::colorize_slow_calls -warning 6.000 -danger 10.000 $totaltime] + } else { + lassign {"" "" ""} queuetime filtertime runtime + lassign {"" "" ""} color(queuetime) color(filtertime) color(runtime) + set totaltime $time + set color(totaltime) [::xo::colorize_slow_calls -warning 6000 -danger 10000 $totaltime] + } if {$time < 6000} { - set class info + set class info } elseif {$time < 10000} { - set class warning + set class warning } else { - set class danger + set class danger } set request [ns_quotehtml $url] set request [::xo::regsub_eval {user_id=([0-9]+)} $request {::xo::subst_user_link user_id= \1} user_id=] - append rows "\n" + append rows "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "" \ + "\n" } set doc(title) "Long Calls" @@ -67,6 +100,6 @@ # Local variables: # mode: tcl -# tcl-indent-level: 2 +# tcl-indent-level: 4 # indent-tabs-mode: nil # End:
MillisecondsQueuetimeFiltertimeRuntimeTotaltime Date User ID IP
$time$year $mon $day $hours$userinfo$iplink$request
$queuetime$filtertime$runtime$totaltime$year $mon $day $hours$userinfo$iplink$request