use of com.linkedin.cruisecontrol.detector.AnomalyType in project cruise-control by linkedin.
the class AnomalyDetectorState method refreshMetrics.
/**
* Refresh the anomaly metrics.
*
* @param selfHealingEnabledRatio The ratio
* @param balancednessScore A metric to quantify how well the load distribution on a cluster satisfies the anomaly
* detection goals.
*/
synchronized void refreshMetrics(Map<AnomalyType, Float> selfHealingEnabledRatio, double balancednessScore) {
if (selfHealingEnabledRatio == null) {
throw new IllegalArgumentException("Attempt to set selfHealingEnabledRatio with null.");
}
// Retrieve mean time between anomalies, record the time in ms.
Map<AnomalyType, Double> meanTimeBetweenAnomaliesMs = new HashMap<>();
for (AnomalyType anomalyType : KafkaAnomalyType.cachedValues()) {
meanTimeBetweenAnomaliesMs.put(anomalyType, _anomalyRateByType.get(anomalyType).getMeanRate() * SEC_TO_MS);
}
_metrics = new AnomalyMetrics(meanTimeBetweenAnomaliesMs, meanTimeToStartFixMs(), numSelfHealingStarted(), numSelfHealingFailedToStart(), ongoingAnomalyDurationMs());
_selfHealingEnabledRatio = new SelfHealingEnabledRatio(selfHealingEnabledRatio.size());
selfHealingEnabledRatio.forEach((key, value) -> _selfHealingEnabledRatio.put(key, value));
_balancednessScore = balancednessScore;
}
Aggregations