Search in sources :

Example 6 with AnomalyType

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;
}
Also used : HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) KafkaAnomalyType(com.linkedin.kafka.cruisecontrol.detector.notifier.KafkaAnomalyType) AnomalyType(com.linkedin.cruisecontrol.detector.AnomalyType)

Aggregations

AnomalyType (com.linkedin.cruisecontrol.detector.AnomalyType)6 KafkaAnomalyType (com.linkedin.kafka.cruisecontrol.detector.notifier.KafkaAnomalyType)3 HashMap (java.util.HashMap)2 CruiseControlUtils (com.linkedin.cruisecontrol.CruiseControlUtils)1 CruiseControlUtils.utcDateFor (com.linkedin.cruisecontrol.CruiseControlUtils.utcDateFor)1 Anomaly (com.linkedin.cruisecontrol.detector.Anomaly)1 BrokerFailures (com.linkedin.kafka.cruisecontrol.detector.BrokerFailures)1 DiskFailures (com.linkedin.kafka.cruisecontrol.detector.DiskFailures)1 GoalViolations (com.linkedin.kafka.cruisecontrol.detector.GoalViolations)1 KafkaMetricAnomaly (com.linkedin.kafka.cruisecontrol.detector.KafkaMetricAnomaly)1 MaintenanceEvent (com.linkedin.kafka.cruisecontrol.detector.MaintenanceEvent)1 TopicAnomaly (com.linkedin.kafka.cruisecontrol.detector.TopicAnomaly)1 TopicPartitionSizeAnomaly (com.linkedin.kafka.cruisecontrol.detector.TopicPartitionSizeAnomaly)1 TopicReplicationFactorAnomaly (com.linkedin.kafka.cruisecontrol.detector.TopicReplicationFactorAnomaly)1 TopicReplicationFactorAnomalyEntry (com.linkedin.kafka.cruisecontrol.detector.TopicReplicationFactorAnomaly.TopicReplicationFactorAnomalyEntry)1 BrokerEntity (com.linkedin.kafka.cruisecontrol.monitor.sampling.holder.BrokerEntity)1 UserRequestException (com.linkedin.kafka.cruisecontrol.servlet.UserRequestException)1 UpdateSelfHealingParameters (com.linkedin.kafka.cruisecontrol.servlet.parameters.UpdateSelfHealingParameters)1 IOException (java.io.IOException)1 InetAddress (java.net.InetAddress)1