wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[TheSchwartz] r157: LJSUP-11381: Create counters for monitor...

Committer: wisest-owl
LJSUP-11381: Create counters for monitoring

U   trunk/lib/TheSchwartz/Job.pm
U   trunk/lib/TheSchwartz.pm
Modified: trunk/lib/TheSchwartz/Job.pm
===================================================================
--- trunk/lib/TheSchwartz/Job.pm	2010-10-18 14:37:35 UTC (rev 156)
+++ trunk/lib/TheSchwartz/Job.pm	2012-02-27 13:48:22 UTC (rev 157)
@@ -191,6 +191,13 @@
     $job->did_something(1);
     $job->set_exit_status(0);
     $job->driver->remove($job);
+
+    ## Counter "completed_task" for monitoring
+    my $func_name = $job->funcname;
+    $func_name =~ s/::/_/g;
+    LJ::run_hook ("update_counter", {
+        counter => "completed_$func_name",
+    });
 }
 
 sub permanent_failure {
@@ -239,6 +246,13 @@
         $job->set_exit_status($exit_status || 1);
         $job->driver->remove($job);
     }
+
+    ## Counter "failed_task" for monitoring
+    my $func_name = $job->funcname;
+    $func_name =~ s/::/_/g;
+    LJ::run_hook ("update_counter", {
+        counter => "failed_$func_name",
+    });
 }
 
 sub replace_with {

Modified: trunk/lib/TheSchwartz.pm
===================================================================
--- trunk/lib/TheSchwartz.pm	2010-10-18 14:37:35 UTC (rev 156)
+++ trunk/lib/TheSchwartz.pm	2012-02-27 13:48:22 UTC (rev 157)
@@ -370,6 +370,13 @@
 
         ## Now, insert the job. This also might fail.
         $driver->insert($job);
+    
+        ## Counter "new_task" for monitoring
+        my $func_name = $job->funcname;
+        $func_name =~ s/::/_/g;
+        LJ::run_hook ("update_counter", {
+            counter => "new_$func_name",
+        });
     };
     if ($@) {
         unless (OK_ERRORS->{ $driver->last_error || 0 }) {

Tags: pm, theschwartz, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments