|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.caucho.health.predicate.AbstractHealthPredicate
com.caucho.health.predicate.AbstractScheduledHealthPredicate
com.caucho.health.predicate.AbstractHealthCheckPredicate
com.caucho.health.predicate.IfFlapping
@Configurable public class IfFlapping
Qualifies an action to match only when the health check status is flapping.
Flapping occurs when a health check changes state too frequently. This can serve as convenient filter for nuisance actions, as well as a useful indicator of real issues that would otherwise be hard to detect.
IfFlapping scans recent historical data for state changes to calculate a weighted percent change. By default, recent state changes are weighted more than older changes. This predicate matches if the overall weighted percent change exceeds a threshold.
Note: Use <health:Not> predicate for filtering.
<health:HttpStatusHealthCheck ee:Named="httpStatusCheck">
<url>http://localhost:8080/test-ping.jsp</url>
</health:HttpStatusHealthCheck>
<health:Restart>
<health:IfHealthCritical healthCheck="${httpStatusCheck}"/>
<health:Not>
<health:IfFlapping healthCheck="${httpStatusHealthCheck}"/>
</health:Not>
</health:Restart>
| Constructor Summary | |
|---|---|
IfFlapping()
|
|
IfFlapping(HealthCheck healthCheck)
|
|
| Method Summary | |
|---|---|
static double |
calculatePercentChange(StatServiceValue[] data,
double lowWeight,
double highWeight)
|
double |
getHighWeight()
Returns the high weight (most recent) |
double |
getLowWeight()
Returns the low weight (least recent) |
int |
getSampleSize()
Returns the minimum sample size before attempting to detect flapping. |
double |
getThreshold()
Returns the weighted percent change that must be exceeded to detect flapping, as a floating point number between 0 and 1. |
void |
init()
|
protected boolean |
isFlapping(HealthService healthService,
HealthCheck healthCheck,
long sampleId)
|
boolean |
isMatch(HealthEvent healthEvent)
Match if calculated weighted percent change exceeds the threshold |
void |
setHighWeight(double highWeight)
Newer state changes can be weighted more than older changes. |
void |
setLowWeight(double lowWeight)
Older state changes can be weighted less than more recent changes. |
void |
setSampleSize(int sampleSize)
The minimum number of samples required before attempting to detect flapping. |
void |
setThreshold(double threshold)
Flapping is detected when the calculated weighted percent change exceeds this threshold, |
| Methods inherited from class com.caucho.health.predicate.AbstractHealthCheckPredicate |
|---|
getHealthCheck, getLastResult, setHealthCheck, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IfFlapping()
public IfFlapping(HealthCheck healthCheck)
| Method Detail |
|---|
@PostConstruct public void init()
public int getSampleSize()
@Configurable public void setSampleSize(int sampleSize)
sampleSize - minimum number of samples, default 21public double getThreshold()
@Configurable public void setThreshold(double threshold)
threshold - percent change threshold as a floating point number
between 0 and 1, default 0.5
(approximate 50% of samples, adjusted depending on weight)public double getLowWeight()
@Configurable public void setLowWeight(double lowWeight)
lowWeight - The starting weight (least recent), default .75public double getHighWeight()
@Configurable public void setHighWeight(double highWeight)
highWeight - The ending weight, default 1.25public boolean isMatch(HealthEvent healthEvent)
isMatch in interface HealthPredicateisMatch in class AbstractScheduledHealthPredicate
protected boolean isFlapping(HealthService healthService,
HealthCheck healthCheck,
long sampleId)
public static double calculatePercentChange(StatServiceValue[] data,
double lowWeight,
double highWeight)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||