Hello,

  I'm willing to release another module to CPAN: Guard::Stat.

  It allows to create guard objects and gather overall usage statistics
of those: how many are still alive, how many are gone etc.

  It was initially created for tracking down callback subroutines usage
in an AnyEvent application but can really deal with any kind of
subroutines or objects.

The interface is rather simple:

  my $stat = Guard::Stat->new;

  my $guard = $stat->guard; # increase alive counter
  $guard->end("foo"); # increase finished counter 
  undef $guard; # increase dead counter

  $stat->get_stat; # alive = 0, dead = 1, total = 1, etc

  There are also broken() and zombie() statistics that show difference
between DESTROY and end calls. running() count is for alive guards whose
end() method was never called.

  Other features include:

  * If needed, time statistics can also be gathered through an external
class (like Statistics::Descriptive::Sparse).

  * If needed, a on_level callback can be provided to do some action
whenever running() counter goes above or below certain threshold. (E.g.
defer incoming requests if load gets too high).

  The module is already used in-house and is more or less tested. 

  My only concern is the name - is Guard::Stat a good one? Is it clear
what the module does? Doesn't it occupy a sweet spot where another
future module could fit much better? (Looks like "stat()" system call is
not a resource one would build guard for).

  The code is available at github in case anyone is interested:
https://github.com/dallaylaen/perl-Guard-Stat

  If no objections follow, I'll probably release it around July, 10. 

-- 
Konstantin S. Uvarin


Reply via email to