Skip to content

Commit

Permalink
Improve some debug logging in the engine.
Browse files Browse the repository at this point in the history
  • Loading branch information
jshaughn committed Jul 29, 2015
1 parent 79de264 commit 4619881
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,8 @@ public int hashCode() {

@Override
public String toString() {
return "AvailabilityConditionEval [evalTimestamp=" + evalTimestamp + ", " +
"dataTimestamp=" + dataTimestamp + ", " +
"condition=" + condition + ", " +
"value=" + value + "]";
return "AvailabilityConditionEval [condition=" + condition + ", value=" + value + ", match=" + match
+ ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,8 @@ public int hashCode() {

@Override
public String toString() {
return "CompareConditionEval [evalTimestamp=" + evalTimestamp + ", " +
"dataTimestamp=" + dataTimestamp + ", " +
"condition=" + condition + ", " +
"value1=" + value1 + ", " +
"value2=" + value2 + "]";
return "CompareConditionEval [condition=" + condition + ", value1=" + value1 + ", value2=" + value2
+ ", match=" + match + ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ public int hashCode() {

@Override
public String toString() {
return "StringConditionEval [evalTimestamp=" + evalTimestamp + ", " +
"dataTimestamp=" + dataTimestamp + ", " +
"condition=" + condition + ", " +
"value=" + value + "]";
return "StringConditionEval [condition=" + condition + ", value=" + value + ", match=" + match
+ ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,8 @@ public int hashCode() {

@Override
public String toString() {
return "ThresholdConditionEval [evalTimestamp=" + evalTimestamp + ", " +
"dataTimestamp=" + dataTimestamp + ", " +
"condition=" + condition + ", " +
"value=" + value + "]";
return "ThresholdConditionEval [condition=" + condition + ", value=" + value + ", match=" + match
+ ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,8 @@ public int hashCode() {

@Override
public String toString() {
return "ThresholdRangeConditionEval [evalTimestamp=" + evalTimestamp + ", " +
"dataTimestamp=" + dataTimestamp + ", " +
"condition=" + condition + ", " +
"value=" + value + "]";
return "ThresholdRangeConditionEval [condition=" + condition + ", value=" + value + ", match=" + match
+ ", evalTimestamp=" + evalTimestamp + ", dataTimestamp=" + dataTimestamp + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -427,11 +427,11 @@ public boolean equals(Object obj) {

@Override
public String toString() {
return "Dampening [triggerId=" + triggerId + ", triggerMode=" + triggerMode + ", type=" + type
return "Dampening [satisfied=" + satisfied + ", triggerId=" + triggerId + ", triggerMode=" + triggerMode
+ ", type=" + type
+ ", evalTrueSetting=" + evalTrueSetting + ", evalTotalSetting=" + evalTotalSetting
+ ", evalTimeSetting=" + evalTimeSetting + ", numTrueEvals="
+ numTrueEvals + ", numEvals=" + numEvals + ", trueEvalsStartTime=" + trueEvalsStartTime
+ ", satisfied=" + satisfied + ", satisfyingEvals=" + satisfyingEvals + "]";
+ numTrueEvals + ", numEvals=" + numEvals + ", trueEvalsStartTime=" + trueEvalsStartTime + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -246,10 +246,10 @@ rule RetractObsoleteConditionEval
$ce1 : ConditionEval( $tid : triggerId, ( conditionSetSize > 1 ), $csi : conditionSetIndex, $t1 : evalTimestamp )
$ce2 : ConditionEval( $tid == triggerId, $csi == conditionSetIndex, $t1 > evalTimestamp )
then
retract( $ce2 );
if (log != null && log.isDebugEnabled()) {
log.debug( "Retracting obsolete multi-condition eval " + $ce2 + " (due to " + $ce1 + ")");
log.debugf( "Retracted obsolete multi-condition eval %s (due to %s)", $ce2, $ce1);
}
retract( $ce2 );
end


Expand Down Expand Up @@ -278,18 +278,16 @@ rule DampenTriggerAny
$d : Dampening( triggerId == $tid, triggerMode == $tmode, satisfied == false )
$ce : ConditionEval ( triggerId == $tid )
then
if (log != null && log.isDebugEnabled()) {
log.debug( "Updating dampening (ANY) for: " + $ce );
}
retract( $d );
retract ( $ce );

$d.perform( $ce );

insert( $d );

if (log != null && log.isDebugEnabled()) {
log.debug("Retracting multi-condition ANY trigger eval: " + $ce);
log.debugf( "Updated (ANY) %s and retracted %s", $d, $ce);
}

end

rule DampenOneConditionTrigger
Expand All @@ -298,18 +296,16 @@ rule DampenOneConditionTrigger
$d : Dampening( triggerId == $tid, triggerMode == $tmode, satisfied == false )
$ce : ConditionEval ( triggerId == $tid, conditionSetSize == 1, conditionSetIndex == 1 )
then
if (log != null && log.isDebugEnabled()) {
log.debug("Updating dampening for: " + $ce);
}
retract( $d );
retract ( $ce );

$d.perform( $ce );

insert( $d );

if (log != null && log.isDebugEnabled()) {
log.debug("Retracting single-condition trigger eval: " + $ce);
log.debugf( "Updated %s and retracted %s", $d, $ce);
}

end

rule DampenTwoConditionTrigger
Expand All @@ -320,12 +316,15 @@ rule DampenTwoConditionTrigger
$ce2 : ConditionEval ( triggerId == $tid, conditionSetSize == 2, conditionSetIndex == 2 )
exists ConditionEval ( triggerId == $tid, used == false )
then
if (log != null && log.isDebugEnabled()) {
log.debug("Updating dampening for: " + $ce1 + $ce2);
}
retract( $d );

$d.perform( $ce1, $ce2 );
if (log != null && log.isDebugEnabled()) {
log.debugf( "Updated %s with %s, %s", $d, $ce1, $ce2);
}

insert( $d );

for( ConditionEval ce : new ConditionEval[] { $ce1, $ce2 } ) {
if ( ! ce.isUsed() ) {
retract( ce );
Expand All @@ -344,12 +343,15 @@ rule DampenThreeConditionTrigger
$ce3 : ConditionEval ( triggerId == $tid, conditionSetSize == 3, conditionSetIndex == 3 )
exists ConditionEval ( triggerId == $tid, used == false )
then
if (log != null && log.isDebugEnabled()) {
log.debug("Updating dampening for: " + $ce1 + $ce2 + $ce3);
}
retract( $d )

$d.perform( $ce1, $ce2, $ce3 );
if (log != null && log.isDebugEnabled()) {
log.debugf( "Updated %s with %s, %s, %s", $d, $ce1, $ce2, $ce3);
}

insert( $d );

for( ConditionEval ce : new ConditionEval[] { $ce1, $ce2, $ce3 } ) {
if ( ! ce.isUsed() ) {
retract( ce );
Expand All @@ -369,12 +371,15 @@ rule DampenFourConditionTrigger
$ce4 : ConditionEval ( triggerId == $tid, conditionSetSize == 4, conditionSetIndex == 4 )
exists ConditionEval ( triggerId == $tid, used == false )
then
if (log != null && log.isDebugEnabled()) {
log.debug("Updating dampening for: " + $ce1 + $ce2 + $ce3 + $ce4);
}
retract( $d )

$d.perform( $ce1, $ce2, $ce3, $ce4 );
if (log != null && log.isDebugEnabled()) {
log.debugf( "Updated %s with %s, %s, %s, %s", $d, $ce1, $ce2, $ce3, $ce4);
}

insert( $d );

for( ConditionEval ce : new ConditionEval[] { $ce1, $ce2, $ce3, $ce4 } ) {
if ( ! ce.isUsed() ) {
retract( ce );
Expand Down Expand Up @@ -435,7 +440,6 @@ rule AlertOnSatisfiedDampening
}
}

//insert( newAlert );
retract( $d );
$d.reset();
insert( $d );
Expand Down

0 comments on commit 4619881

Please sign in to comment.