mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-04-26 07:08 pm

[dw-free] Business statistics

[commit: http://hg.dwscoalition.org/dw-free/rev/c2251ce4caf8]

http://bugs.dwscoalition.org/show_bug.cgi?id=124

Add tracing to stats collector tool.

Patch by [personal profile] pauamma.

Files modified:
  • bin/worker/stats-collection
--------------------------------------------------------------------------------
diff -r ae9449e5ee12 -r c2251ce4caf8 bin/worker/stats-collection
--- a/bin/worker/stats-collection	Sun Apr 26 18:49:11 2009 +0000
+++ b/bin/worker/stats-collection	Sun Apr 26 19:07:59 2009 +0000
@@ -40,20 +40,27 @@ sub work {
     my %module_categories;
     foreach my $module ( LJ::ModuleLoader::module_subclasses( 'DW::StatData' ) ) {
         eval "use $module";
-        $module_categories{$module->category} = [ $module, $module->keylist ];
+        die "use $module: $@" if $@;
+        $module_categories{$module->category} = $module;
+        $class->cond_debug( "Module $module is category " . $module->category );
     }
     
     foreach my $job ( keys %{$conf} ) {
-        my $module = $module_categories{$job}->[0];
-        my $keylist = $module_categories{$job}->[1];
+        my $module = $module_categories{$job};
 
-        unless ( $module_categories{$job}->[0] ) {
+        unless ( $module ) {
             warn "stats-collection: No stat data module matching '$job'\n";
             next;
         }
 
-        $keylist = $conf->{$job} eq '*' ? $module->keylist : $conf->{$job};
+        my $keylist = $conf->{$job} eq '*' ? $module->keylist : $conf->{$job};
+
+        $class->cond_debug( "Category $job, module $module, requested keys "
+                            . join( ", ", @$keylist ) );
+
         my $data = $module->collect( @$keylist );
+        $class->cond_debug( join( ", ", map { "$_=$data->{$_}" }
+                                            keys %$data ) );
         DW::StatStore->add( $job, %$data )
             or warn "stats-collection: can't store data collected for $job\n";
     }
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org