[rules-users] Expiry of events not occurring for sliding window

Mauricio Salatino salaboy at gmail.com
Fri Sep 23 12:54:02 EDT 2011


Looking pretty quickly to the rules it looks like:
$mih:InstanceHealth($id:id, $luid:name, $stat:stat )
               from entry-point "stat-stream"
Will match for every InstanceHealth without any time restriction, causing
that your events will be never evicted .

Cheers

On Fri, Sep 23, 2011 at 1:48 PM, cfuser <cfuser at yahoo.com> wrote:

> I'll preface this by saying this may not be the correct way to do this, so
> suggestions welcome...
>
> For this example, the name can be something like 'collector1',
> 'collector2'.
> For each collector, there are normalized stats, like 'CPU', 'IO', etc.
>
> <pre>
>        // Imports and other stuff
>
>        declare InstanceHealth
>           @role(event)
>           @expires(10s)
>           @timestamp(timeStamp)
>        end
>
>        rule "Iostats above 90 over 5 seconds"
>        when
>            $mih:InstanceHealth($id:id, $luid:name, $stat:stat )
>                from entry-point "stat-stream"
>            $measure : Number( doubleValue > 90 )
>                from accumulate(
>                    InstanceHealth( $inst:name==$luid, $value:value,
> stat==$stat)
>                    over window:time( 5s ) from entry-point "stat-stream",
>                    average($value))
>        then
>            logger.warn( "--------Average--------------" );
>            logger.warn( $mih.hashCode() + " // "+$stat +" // "+$id+" :
> "+$luid +" == "+$measure );
>
>            // doStuff based upon the name and stat
>        end
>
>        rule "Log instance"
>        when
>            $m:InstanceHealth($id:id, $stat:stat, $inst:name, $v:value )
>                from entry-point "stat-stream"
>        then
>            logger.warn( "------------Instance--------------" );
>            logger.warn( "--"+$inst+" == "+$stat +" value = "+$v );
>
>        end
> </pre>
>
> So the 'Iostats above 90 over 5 seconds' rule is trying to match up stats
> with collectors so there are no cross-products  (stats aren't accumulated
> across collectors and each stat type gets it's own evaluation).  This
> actually seems to be working, except the InstanceHealth objects don't seem
> to be being evicted and I'm apparently getting multiple activations (?).
> Note when I remove the line w/ the $mih binding, things get evicted fine
> but
> I don't have access to the name, stat, etc.  TIA.
>
>
> A snippet of a log (I can confirm that three different iostats were
> inserted
> for collector2)
>
> ==>[ObjectInsertedEventImpl:
> getFactHandle()=1:19:1003982845:1003982845:19:stat-stream,
> getObject()=com.poc.mediator.domain.InstanceHealth : null,
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl at 30a2268a
> ,
> getPropagationContext()=PropagationContextImpl [activeActivations=0,
> dormantActivations=15, entryPoint=EntryPoint::stat-stream,
> factHandle=1:19:1003982845:1003982845:19:stat-stream, leftTuple=null,
> originOffset=-1, propagationNumber=13, rule=null, type=0]]
> 2011-09-23 11:35:16,004 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --------Average--------------
> 2011-09-23 11:35:16,004 [Rule-Execution-Thread] WARN  WorkingMemory  -
> 1302111244 // iostats // null : collector2 == 91.0
> 2011-09-23 11:35:16,004 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --------Average--------------
> 2011-09-23 11:35:16,004 [Rule-Execution-Thread] WARN  WorkingMemory  -
> 158787804 // iostats // null : collector2 == 91.0
> 2011-09-23 11:35:16,004 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --------Average--------------
> 2011-09-23 11:35:16,004 [Rule-Execution-Thread] WARN  WorkingMemory  -
> 1785305512 // iostats // null : collector2 == 91.0
> ==>[ObjectInsertedEventImpl:
> getFactHandle()=1:21:1340153218:1340153218:21:stat-stream,
> getObject()=com.poc.mediator.domain.InstanceHealth : null,
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl at 30a2268a
> ,
> getPropagationContext()=PropagationContextImpl [activeActivations=0,
> dormantActivations=20, entryPoint=EntryPoint::stat-stream,
> factHandle=1:21:1340153218:1340153218:21:stat-stream, leftTuple=null,
> originOffset=-1, propagationNumber=16, rule=null, type=0]]
> 2011-09-23 11:35:16,100 [Insertion Thread] INFO
> mediator.RulesExecutionService  - inserting
> com.poc.mediator.domain.InstanceHealth : null...
> 2011-09-23 11:35:16,101 [Insertion Thread] WARN
> mediator.RulesExecutionService  -
> >>><org.drools.event.rule.impl.ObjectInsertedEventImpl at 1dddec9e
> factHandle=1:21:1340153218:1340153218:21:stat-stream
> object=com.poc.mediator.domain.InstanceHealth : null
> kruntime=org.drools.impl.StatefulKnowledgeSessionImpl at 30a2268a
> propagationContext=PropagationContextImpl [activeActivations=0,
> dormantActivations=20, entryPoint=EntryPoint::stat-stream,
> factHandle=1:21:1340153218:1340153218:21:stat-stream, leftTuple=null,
> originOffset=-1, propagationNumber=16, rule=null, type=0]>
> 2011-09-23 11:35:16,101 [Insertion Thread] INFO
> mediator.RulesExecutionService  - ...done inserting
> <com.poc.mediator.domain.InstanceHealth at 4fe11d82 timeStamp=Fri Sep 23
> 11:35:16 CDT 2011 stat=cpu value=88.0 id=null version=null
> Instance=com.poc.mediator.domain.Instance : null>
> 2011-09-23 11:35:16,108 [Insertion Thread] INFO
> mediator.RulesExecutionService  - inserting
> com.poc.mediator.domain.InstanceHealth : null...
> 2011-09-23 11:35:16,109 [Insertion Thread] WARN
> mediator.RulesExecutionService  -
> >>><org.drools.event.rule.impl.ObjectInsertedEventImpl at 56300388
> factHandle=1:23:1092542236:1092542236:23:stat-stream
> object=com.poc.mediator.domain.InstanceHealth : null
> kruntime=org.drools.impl.StatefulKnowledgeSessionImpl at 30a2268a
> propagationContext=PropagationContextImpl [activeActivations=2,
> dormantActivations=19, entryPoint=EntryPoint::stat-stream,
> factHandle=1:23:1092542236:1092542236:23:stat-stream, leftTuple=null,
> originOffset=-1, propagationNumber=17, rule=null, type=0]>
> 2011-09-23 11:35:16,109 [Insertion Thread] INFO
> mediator.RulesExecutionService  - ...done inserting
> <com.poc.mediator.domain.InstanceHealth at 411edf1c timeStamp=Fri Sep 23
> 11:35:16 CDT 2011 stat=iostats value=85.0 id=null version=null
> Instance=com.poc.mediator.domain.Instance : null>
> ==>[ObjectInsertedEventImpl:
> getFactHandle()=1:23:1092542236:1092542236:23:stat-stream,
> getObject()=com.poc.mediator.domain.InstanceHealth : null,
> getKnowledgeRuntime()=org.drools.impl.StatefulKnowledgeSessionImpl at 30a2268a
> ,
> getPropagationContext()=PropagationContextImpl [activeActivations=2,
> dormantActivations=19, entryPoint=EntryPoint::stat-stream,
> factHandle=1:23:1092542236:1092542236:23:stat-stream, leftTuple=null,
> originOffset=-1, propagationNumber=17, rule=null, type=0]]
> 2011-09-23 11:35:16,160 [Rule-Execution-Thread] WARN  WorkingMemory  -
> ------------Instance--------------
> 2011-09-23 11:35:16,161 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --collector1 == iostats value = 85.0
> 2011-09-23 11:35:16,161 [Rule-Execution-Thread] WARN  WorkingMemory  -
> ------------Instance--------------
> 2011-09-23 11:35:16,161 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --collector2 == cpu value = 88.0
> 2011-09-23 11:35:17,013 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --------Average--------------
> 2011-09-23 11:35:17,014 [Rule-Execution-Thread] WARN  WorkingMemory  -
> 1302111244 // iostats // null : collector2 == 92.0
> 2011-09-23 11:35:17,014 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --------Average--------------
> 2011-09-23 11:35:17,014 [Rule-Execution-Thread] WARN  WorkingMemory  -
> 158787804 // iostats // null : collector2 == 92.0
> 2011-09-23 11:35:17,014 [Rule-Execution-Thread] WARN  WorkingMemory  -
> --------Average--------------
> 2011-09-23 11:35:17,014 [Rule-Execution-Thread] WARN  WorkingMemory  -
> 1785305512 // iostats // null : collector2 == 92.0
>
> --
> View this message in context:
> http://drools.46999.n3.nabble.com/Expiry-of-events-not-occurring-for-sliding-window-tp3362402p3362402.html
> Sent from the Drools: User forum mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>



-- 
 - CTO @ http://www.plugtree.com
 - MyJourney @ http://salaboy.wordpress.com
- Co-Founder @ http://www.jugargentina.org
 - Co-Founder @ http://www.jbug.com.ar

 - Salatino "Salaboy" Mauricio -
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20110923/0b52c5e5/attachment.html 


More information about the rules-users mailing list