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.15.2.7 -r1.15.2.8 --- openacs-4/packages/xotcl-request-monitor/xotcl-request-monitor.info 14 Jul 2020 19:52:19 -0000 1.15.2.7 +++ openacs-4/packages/xotcl-request-monitor/xotcl-request-monitor.info 21 Nov 2020 23:55:24 -0000 1.15.2.8 @@ -8,7 +8,7 @@ t request-monitor - + Gustaf Neumann WU Vienna Request Monitor with user tracking functionality @@ -34,13 +34,14 @@ BSD-Style 2 - + + @@ -55,7 +56,13 @@ - + + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/xotcl-request-monitor/tcl/callback-proc.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/xotcl-request-monitor/tcl/callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-request-monitor/tcl/callback-procs.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/xotcl-request-monitor/tcl/callback-procs.tcl 6 Apr 2020 17:17:55 -0000 1.4.2.1 +++ openacs-4/packages/xotcl-request-monitor/tcl/callback-procs.tcl 21 Nov 2020 23:55:24 -0000 1.4.2.2 @@ -1,42 +1,91 @@ -ad_library { +::xo::library doc { + XOTcl request monitor - Callback procs - Procs to support a simple callback mechanism that allows other - applications to register callbacks triggered when objects, like - groups, in the subsite application are created. + Procs to support a simple callback mechanism that allows other + applications to register callbacks triggered when objects, like + groups, in the subsite application are created. - @author mbryzek@arsdigita.com - @creation-date Wed Feb 21 17:10:24 2001 - @cvs-id $Id$ + @creation-date 2020-11-20 + @author Gustaf Neumann } ad_proc -public -callback subsite::parameter_changed -impl xotcl-request-monitor { - -package_id:required - -parameter:required - -value:required + -package_id:required + -parameter:required + -value:required } { - Implementation of subsite::parameter_changed for xotcl-request-monitor + Implementation of subsite::parameter_changed for xotcl-request-monitor - @author Nima Mazloumi (nima.mazloumi@gmx.de) - @creation-date 2005-08-17 + @author Nima Mazloumi (nima.mazloumi@gmx.de) + @creation-date 2005-08-17 - @param package_id the package_id of the package the parameter was changed for - @param parameter the parameter name - @param value the new value + @param package_id the package_id of the package the parameter was changed for + @param parameter the parameter name + @param value the new value - @see package::set_value + @see package::set_value } { - if {$package_id == [apm_package_id_from_key "xotcl-request-monitor"]} { - ns_log debug "subsite::parameter_changed -impl xotcl-request-monitor changing $parameter to $value" - # - # Just update these parameters, which are defined in the throttle thread. - # - if {[throttle do info commands $parameter] ne ""} { - throttle do $parameter update $value + if {$package_id == [apm_package_id_from_key "xotcl-request-monitor"]} { + ns_log debug "subsite::parameter_changed -impl xotcl-request-monitor changing $parameter to $value" + # + # Just update these parameters, which are defined in the throttle thread. + # + if {[throttle do info commands $parameter] ne ""} { + throttle do $parameter update $value + } + } +} + +namespace eval ::request_monitor { + ad_proc -private upgrade_callback { + {-from_version_name:required} + {-to_version_name:required} + } { + + Callback for upgrading + + @author Gustaf Neumann (neumann@wu-wien.ac.at) + } { + ns_log notice "-- UPGRADE xotcl-request-monitor $from_version_name -> $to_version_name" + + set v 0.60 + if {[apm_version_names_compare $from_version_name $v] == -1 && + [apm_version_names_compare $to_version_name $v] > -1} { + ns_log notice "-- upgrading to $v" + + foreach parameter_id [xo::dc list get_old_parameter { + select parameter_id + from apm_parameters + where package_key = 'xotcl-request-monitor' + and parameter_name not in ( + 'do_double_click_prevention', + 'do_slowdown_overactive', + 'do_slowdown_overactive', + 'do_throttle', + 'do_track_activity', + 'hide-requests', + 'max-stats-elements', + 'max-url-stats', + 'monitor_urls', + 'peer-groups', + 'time-window', + 'trend-elements' + ) + }] { + xo::dc dml delete_value { + delete from apm_parameter_values where parameter_id = :parameter_id + } + xo::dc dml delete_parameter { + delete from apm_parameters where parameter_id = :parameter_id + } } } + } } +::xo::library source_dependent + # Local variables: # mode: tcl # tcl-indent-level: 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.67.2.31 -r1.67.2.32 --- openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 14 Nov 2020 10:14:08 -0000 1.67.2.31 +++ openacs-4/packages/xotcl-request-monitor/tcl/throttle_mod-procs.tcl 21 Nov 2020 23:55:24 -0000 1.67.2.32 @@ -42,13 +42,15 @@ package_parameter log-dir \ -default [file dirname [file rootname [ns_config ns/parameters ServerLog]]] - package_parameter max-url-stats -default 500 - package_parameter time-window -default 10 - package_parameter trend-elements -default 48 - package_parameter max-stats-elements -default 5 - package_parameter do_throttle -default on - package_parameter do_track_activity -default off - package_parameter do_slowdown_overactive -default off + package_parameter do_double_click_prevention -default on + package_parameter do_slowdown_overactive -default off + package_parameter do_throttle -default on + package_parameter do_track_activity -default off + package_parameter max-stats-elements -default 5 + package_parameter max-url-stats -default 500 + package_parameter monitor_urls -default "/ /register/ /dotlrn/" + package_parameter time-window -default 10 + package_parameter trend-elements -default 48 # # When updates happen on @@ -69,6 +71,14 @@ next throttler set do_throttle $value } + do_double_click_prevention proc update {value} { + next + throttler set do_double_click_prevention $value + } + monitor_urls proc update {value} { + next + set ::monitor_urls $value + } # get the value from the logdir parameter set ::logdir [log-dir] @@ -155,6 +165,7 @@ Throttle instproc init {} { set :do_throttle [do_throttle] + set :do_double_click_prevention [do_double_click_prevention] Object create [self]::stats Object create [self]::users next @@ -195,6 +206,7 @@ } Throttle instproc register_access {requestKey pa url community_id is_embedded_request} { + ns_log notice "register_access $requestKey $pa $url " set obj [Users current_object] $obj addKey $requestKey $pa $url $community_id $is_embedded_request Users expSmooth [$obj point_in_time] $requestKey @@ -247,7 +259,8 @@ set range [expr {[dict exists $context Range] ? [dict get $context Range] : ""}] # - # Check whether request blocking is turned off. + # Check whether all request monitor performance tracking is turned + # off. If so, it does not even track the number of active users. # if {!${:do_throttle}} { return [list 0 0 0] @@ -289,7 +302,7 @@ # image in many places, so we can't block it, but this is already # covered above. # - if {[info exists $var]} { + if {${:do_double_click_prevention} && [info exists $var]} { # # Request already running # ns_log notice "### already $var" @@ -304,10 +317,6 @@ :register_access $requestKey $pa $url $community_id 0 ;# $is_embedded_request #set t2 [clock milliseconds] - #if {$t2 - $t0 > 500} { - # ns_log warning "throttle_check slow, can lead to filter time >1sec: total time [expr {$t2 - $t0}], t1 [expr {$t1 - $t0}]" - #} - if {[do_slowdown_overactive]} { # # Check, whether the last request from a user was within @@ -1236,7 +1245,7 @@ Users instproc destroy {} { set class [self class] #ns_log notice "=== [self] destroy [array names :active]" - if {[Users set last_mkey] eq [self]} { + if {[Users exists last_mkey] && [Users set last_mkey] eq [self]} { Users set last_mkey "" } foreach key [array names :active] {