The OP has not said if he uses Guvnor or not. We can only guess.

"Last run date" is a run-time metric. Guvnor only contains design-time metrics. Therefore you'll have to devise your own mechanism using AgendaListener as Wolfgang proposes.

"Author" (and other such metadata) is stored in Guvnor and is (probably) available using the REST API - but it'll be on a per-asset basis and definitely not lend itself to batch querying (e.g. as with a RDBMS) as you imply.

"Rule validity" is another analysis you do not mention. drools-verifier may be able to help there.

On 25 April 2012 17:43, Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
On 25/04/2012, thomashatz@yahoo.com <thomashatz@yahoo.com> wrote:
> Thanks Wolfgang,
>
> But don't the rules tables have basic info like 'last run date and time and
> user' type info...

I'm not aware of any such information being collected and stored
automatically. But if this is a Guvnor function, I may have a very
blind spot there.

>
> Also how to setup an AgendaEventListener

It's done as with any other listener in JDK etc. Here are some code
snippets to get you started. This code is not necessarily "best
practice" or anything; it's meant to illustrate the essentials. The
constructor installs the listener.

public class AgendaWatcher implements AgendaEventListener {

   // useful aux. method
   private String ruleNameOfEvent( ActivationEvent actEvent ){
       Activation activation = actEvent.getActivation();
       Rule rule = activation.getRule();
       return rule.getPackageName() + '.' + rule.getName();
   }

   public AgendaWatcher( KnowledgeRuntime knowledgeRuntime ){
       knowledgeRuntime.addEventListener( (AgendaEventListener)this );
   }

   @Override
   public void activationCancelled(ActivationCancelledEvent actEvent) {
        // happens frequently, for various reasons. may not be of interest.
   }

   @Override
   public void activationCreated(ActivationCreatedEvent actEvent) {
       // same thing.
   }

   @Override
   public void beforeActivationFired(BeforeActivationFiredEvent arg0) {
   }

   @Override
   public void afterActivationFired(AfterActivationFiredEvent actEvent) {
       // count firings
       Counts counts = getCountsForName( ruleNameOfEvent( actEvent ) );
       counts.firings++;
   }

   @Override
   public void agendaGroupPopped(AgendaGroupPoppedEvent arg0) {
   }
   @Override
   public void agendaGroupPushed(AgendaGroupPushedEvent arg0) {
   }
}




>
> Really appreciate your knowledge sharing
>
> --- On Tue, 4/24/12, Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
>
>> From: Wolfgang Laun <wolfgang.laun@gmail.com>
>> Subject: Re: [rules-users] How to query rules to create reports to analyze
>> usage
>> To: "Rules Users List" <rules-users@lists.jboss.org>
>> Date: Tuesday, April 24, 2012, 4:30 AM
>> For analyzing "rules usage" an
>> AgendaEventListener should be used to
>> register the information you are interested in. (You
>> wouldn't need to
>> query the rules DB for this anyway.)
>>
>> -W
>>
>> On 24/04/2012, thatz <thomashatz@yahoo.com>
>> wrote:
>> > Am new user to Drools, have 300+ rules, but need to
>> query them using SQL
>> > syntax to create reports and analyze rules usage (if
>> rules are being called,
>> > etc.).  App developer said cannot query the rules
>> db directly because it is
>> > proprietary.  Is there anyway to query rules or
>> what is best way to analyze
>> > rules usage.  Thanks
>> >
>> > --
>> > View this message in context:
>> > http://drools.46999.n3.nabble.com/How-to-query-rules-to-create-reports-to-analyze-usage-tp3934833p3934833.html
>> > Sent from the Drools: User forum mailing list archive
>> at Nabble.com.
>> > _______________________________________________
>> > rules-users mailing list
>> > rules-users@lists.jboss.org
>> > https://lists.jboss.org/mailman/listinfo/rules-users
>> >
>> _______________________________________________
>> rules-users mailing list
>> rules-users@lists.jboss.org
>> https://lists.jboss.org/mailman/listinfo/rules-users
>>
>
> _______________________________________________
> rules-users mailing list
> rules-users@lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users