[Jifty-commit] r4135 - in jifty/trunk: lib/Jifty/Plugin lib/Jifty/Plugin/LeakDetector

jifty-commit at lists.jifty.org jifty-commit at lists.jifty.org
Tue Sep 18 16:35:56 EDT 2007


Author: sartak
Date: Tue Sep 18 16:35:55 2007
New Revision: 4135

Modified:
   jifty/trunk/   (props changed)
   jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm
   jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm
   jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm

Log:
 r42798 at onn:  sartak | 2007-09-18 16:35:47 -0400
 More cleanup, hide zero-leak requests by default


Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector.pm	Tue Sep 18 16:35:55 2007
@@ -88,10 +88,20 @@
 
     http://your.app/leaks
 
+View the top-level leak report, including zero-leak requests
+
+    http://your.app/leaks/all
+
 View an individual request's detailed leak report (which objects were leaked)
 
     http://your.app/leaks/3
 
+=head1 WARNING
+
+If you use this in production, be sure to block off 'leaks' from
+non-administrators. The full Data::Dumper output of the objects
+leaked is available, which may of course contain sensitive information.
+
 =cut
 
 1;

Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector/Dispatcher.pm	Tue Sep 18 16:35:55 2007
@@ -6,7 +6,14 @@
 
 # http://your.app/leaks -- display full leak report
 on 'leaks' => run {
-        show "leaks/all";
+    set 'skip_zero' => 1;
+    show "leaks/all";
+};
+
+# http://your.app/leaks/all -- full leak report with non-leaked requests
+on 'leaks/all' => run {
+    set 'skip_zero' => 0;
+    show "leaks/all";
 };
 
 # http://your.app/leaks/xxx -- display leak report for request ID xxx

Modified: jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm
==============================================================================
--- jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm	(original)
+++ jifty/trunk/lib/Jifty/Plugin/LeakDetector/View.pm	Tue Sep 18 16:35:55 2007
@@ -19,8 +19,23 @@
 =cut
 
 template 'leaks/all' => sub {
+    my $skip_zero = get 'skip_zero';
+
     html {
         body {
+            h1 { "Leaked Objects" }
+            p {
+                if ($skip_zero) {
+                    a { attr { href => "/leaks/all" }
+                        "Show zero-leak requests" }
+                }
+                else {
+                    a { attr { href => "/leaks" }
+                        "Hide zero-leak requests" }
+                }
+            }
+            hr {}
+
             table {
                 row {
                     th { "ID" }
@@ -32,6 +47,8 @@
 
                 for (@Jifty::Plugin::LeakDetector::requests)
                 {
+                    next if $_->{leaks} == 0 && $skip_zero;
+
                     row {
                         cell { a { attr { href => "leaks/$_->{id}" }
                                    $_->{id} } }


More information about the Jifty-commit mailing list