Index: openacs-4/packages/acs-developer-support/www/request-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-developer-support/www/request-info.tcl,v diff -u -r1.25.2.2 -r1.25.2.3 --- openacs-4/packages/acs-developer-support/www/request-info.tcl 3 Mar 2020 14:41:48 -0000 1.25.2.2 +++ openacs-4/packages/acs-developer-support/www/request-info.tcl 3 Mar 2020 14:53:25 -0000 1.25.2.3 @@ -22,25 +22,25 @@ foreach name [nsv_array names ds_request] { ns_log Debug "DS: Checking request $request, $name." if { [regexp {^([0-9]+)\.([a-z]+)$} $name "" m_request key] && $m_request == $request } { - set property($key) [nsv_get ds_request $name] + set property($key) [nsv_get ds_request $name] } } if { [info exists property(start)] } { set expired_p 0 append body [subst { -

Parameters

+

Parameters

-
- - -
Request Start Time: [clock format [lindex $property(start) 0] -format "%Y-%m-%d %H:%M:%S"] +
+ + + - - - }] - } + append body [subst { + + + + }] + } } } append body "
Request Start Time: [clock format [lindex $property(start) 0] -format "%Y-%m-%d %H:%M:%S"] }] } else { set expired_p 1 append body [subst { - The information for this request is gone - either the server has been restarted, or - the request is more than [parameter::get -parameter DeveloperSupportLifetime -default 900] seconds old. + The information for this request is gone - either the server has been restarted, or + the request is more than [parameter::get -parameter DeveloperSupportLifetime -default 900] seconds old. }] return } @@ -50,163 +50,163 @@ foreach { key name } { end {Request Completion Time} - endclicks {Request Duration} + endclicks {Request Duration} peeraddr IP - method Method - url URL - query Query + method Method + url URL + query Query user_id {User ID} session_id {Session ID} browser_id {Browser ID} validated {Session Validation} - error {Error} + error {Error} } { - if { [dict exists $property(conn) $key] } { - set raw [dict get $property(conn) $key] - switch $key { - error { - set value "
[ns_quotehtml $raw]
" - } - endclicks { - set value [format "%.f ms" [expr { ($raw - [dict get $property(conn) startclicks]) / 1000.0 }]] - } - end { - set value [clock format $raw -format "%Y-%m-%d %H:%M:%S"] - } - user_id { - if { [db_0or1row user_info { + if { [dict exists $property(conn) $key] } { + set raw [dict get $property(conn) $key] + switch $key { + error { + set value "
[ns_quotehtml $raw]
" + } + endclicks { + set value [format "%.f ms" [expr { ($raw - [dict get $property(conn) startclicks]) / 1000.0 }]] + } + end { + set value [clock format $raw -format "%Y-%m-%d %H:%M:%S"] + } + user_id { + if { [db_0or1row user_info { select first_names, last_name, email from users where user_id = :raw - }] } { - set value [subst { - $raw: - $first_names $last_name (mailto:$email) - }] - } else { - set value $raw - } - } - default { - set value [ns_quotehtml $raw] - } - } + }] } { + set value [subst { + $raw: + $first_names $last_name (mailto:$email) + }] + } else { + set value $raw + } + } + default { + set value [ns_quotehtml $raw] + } + } - append body [subst { -
$name: [expr {$value eq "" ? "(empty)" : $value}]
$name: [expr {$value eq "" ? "(empty)" : $value}]
" if { [info exists property(rp)] } { append body [subst { -

Request Processor

-
    +

    Request Processor

    +
      }] foreach rp $property(rp) { - lassign $rp kind info startclicks endclicks action error + lassign $rp kind info startclicks endclicks action error - if { $kind eq "debug" && !$rp_show_debug_p } { - continue - } + if { $kind eq "debug" && !$rp_show_debug_p } { + continue + } - set duration [format "%.1f ms" [expr { ($endclicks - $startclicks)/1000.0 }]] + set duration [format "%.1f ms" [expr { ($endclicks - $startclicks)/1000.0 }]] - if { [info exists conn(startclicks)] } { - append body "
    • [format "%+06.1f" [expr { ($startclicks - $conn(startclicks))/1000.0 }]] ms: " - } else { - append body "
    • " - } + if { [info exists conn(startclicks)] } { + append body "
    • [format "%+06.1f" [expr { ($startclicks - $conn(startclicks))/1000.0 }]] ms: " + } else { + append body "
    • " + } - switch $kind { - transformation { - lassign $info proc from to - if { $to eq "" } { - set to "?" - } - append body "Applied transformation from $from -> $to - $duration\n" - } - filter { - lassign $info . kind method path proc args + switch $kind { + transformation { + lassign $info proc from to + if { $to eq "" } { + set to "?" + } + append body "Applied transformation from $from -> $to - $duration\n" + } + filter { + lassign $info . kind method path proc args - append body "Applied $kind filter: $proc [ns_quotehtml $args] (for $method $path) - $duration\n" - if {$action eq "error"} { - append body "
      • returned error:
        [ns_quotehtml $error]
      \n" - } elseif { $action ne "" } { - append body "
      • returned $action
      \n" - } - } - registered_proc { - set proc [lindex $info 2] - set args [lindex $info 3] - append body "Called registered procedure: $proc [ns_quotehtml $args] for ($method $path) - $duration\n" - if {$action eq "error"} { - append body "
      • returned error:
        [ns_quotehtml $error]
      \n" - } - } - serve_file { - lassign $info file handler - append body "Served file $file with $handler - $duration\n" - if {$action eq "error"} { - append body "
      • returned error:
        [ns_quotehtml $error]
      \n" - } - } + append body "Applied $kind filter: $proc [ns_quotehtml $args] (for $method $path) - $duration\n" + if {$action eq "error"} { + append body "
      • returned error:
        [ns_quotehtml $error]
      \n" + } elseif { $action ne "" } { + append body "
      • returned $action
      \n" + } + } + registered_proc { + set proc [lindex $info 2] + set args [lindex $info 3] + append body "Called registered procedure: $proc [ns_quotehtml $args] for ($method $path) - $duration\n" + if {$action eq "error"} { + append body "
      • returned error:
        [ns_quotehtml $error]
      \n" + } + } + serve_file { + lassign $info file handler + append body "Served file $file with $handler - $duration\n" + if {$action eq "error"} { + append body "
      • returned error:
        [ns_quotehtml $error]
      \n" + } + } notice { - append body "$info\n" + append body "$info\n" } - debug { - append body "$info\n" - } - } + debug { + append body "$info\n" + } + } } if { !$rp_show_debug_p } { - set href "./request-info?[export_ns_set_vars url]&rp_show_debug_p=1" - append body [subst { -

      show RP debugging information - }] + set href "./request-info?[export_ns_set_vars url]&rp_show_debug_p=1" + append body [subst { +

      show RP debugging information + }] } append body "

    \n" } if { [info exists property(comment)] } { append body "

    Comments

      \n" foreach comment $property(comment) { - append body "
    • [ns_quotehtml $comment]\n" + append body "
    • [ns_quotehtml $comment]\n" } append body "
    \n" } if { [info exists property(headers)] } { append body {

    Headers

    -
    +
    } foreach { name value } $property(headers) { - append body [subst { - - - - - }] + append body [subst { + + + + + }] } append body "
    $name: [ns_quotehtml $value]
    $name: [ns_quotehtml $value]
    \n" } if { [info exists property(oheaders)] } { append body {

    Output Headers

    -
    +
    } foreach { name value } $property(oheaders) { - append body [subst { - - - - - }] + append body [subst { + + + + + }] } append body "
    $name: [ns_quotehtml $value]
    $name: [ns_quotehtml $value]
    \n" } @@ -221,25 +221,25 @@ foreach { handle command statement_name sql start end errno return } $property(db) { - if { $handle ne "" && [info exists pool($handle)] } { - set statement_pool $pool($handle) - } else { - set statement_pool "" - } + if { $handle ne "" && [info exists pool($handle)] } { + set statement_pool $pool($handle) + } else { + set statement_pool "" + } - if { $command eq "gethandle" } { - # Remember which handle was acquired from which pool. - set statement_pool $sql - set value "gethandle (returned $return)" - set pool($return) $sql - } elseif { $command eq "releasehandle" } { - set value "releasehandle $handle" - } else { - if { $statement_name eq "" } { - set value "" - } else { - set value "$statement_name: " - } + if { $command eq "gethandle" } { + # Remember which handle was acquired from which pool. + set statement_pool $sql + set value "gethandle (returned $return)" + set pool($return) $sql + } elseif { $command eq "releasehandle" } { + set value "releasehandle $handle" + } else { + if { $statement_name eq "" } { + set value "" + } else { + set value "$statement_name: " + } # Remove extra whitespace before query set min_whitespace -1 @@ -262,8 +262,8 @@ set sql $new_sql } - append value "$command $statement_pool $handle
    [ns_quotehtml $sql]
    " - } + append value "$command $statement_pool $handle
    [ns_quotehtml $sql]
    " + } if { $command ne "getrow" || [template::util::is_true $getrow_p] } { multirow append dbreqs $handle [lindex $command 0] $sql [format %.2f [expr { $end - $start }]] $value @@ -291,41 +291,41 @@ aggregate_label "Total Duration (ms)" display_template {@dbreqs.value;noquote@} } - } -filters { - getrow_p { - label "Getrow" - values { - {"Include" t} - {"Exclude" f} - } - default_value t + } -filters { + getrow_p { + label "Getrow" + values { + {"Include" t} + {"Exclude" f} } - request { - hide_p t - } + default_value t } + request { + hide_p t + } + } } # Profiling information global ds_profile__total_ms ds_profile__iterations template::list::create -name profiling -multirow profiling -elements { - file_links { - label "Ops" - display_template { - @profiling.file_links;noquote@ - } - } - tag { - label "Template" - } - total_ms { - label "Total time" - } - size { - label "Size" - } + file_links { + label "Ops" + display_template { + @profiling.file_links;noquote@ + } + } + tag { + label "Template" + } + total_ms { + label "Total time" + } + size { + label "Size" + } } multirow create profiling tag total_ms file_links size