Search in sources :

Example 1 with MetricAnomalyType

use of com.linkedin.cruisecontrol.detector.metricanomaly.MetricAnomalyType in project cruise-control by linkedin.

the class AnomalyDetectorManager method registerGaugeSensors.

/**
 * Register gauge sensors.
 * @param dropwizardMetricRegistry The metric registry that holds all the metrics for monitoring Cruise Control.
 */
private void registerGaugeSensors(MetricRegistry dropwizardMetricRegistry) {
    dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, "balancedness-score"), (Gauge<Double>) _goalViolationDetector::balancednessScore);
    // Self-Healing is turned on/off. 1/0 metric for each of the self-healing options.
    for (KafkaAnomalyType anomalyType : KafkaAnomalyType.cachedValues()) {
        dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, String.format("%s-self-healing-enabled", anomalyType.toString().toLowerCase())), (Gauge<Integer>) () -> _anomalyNotifier.selfHealingEnabled().get(anomalyType) ? 1 : 0);
    }
    // The cluster is identified as under-provisioned, over-provisioned, or right-sized (undecided not reported).
    dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, "under-provisioned"), (Gauge<Integer>) () -> (_goalViolationDetector.provisionStatus() == ProvisionStatus.UNDER_PROVISIONED) ? 1 : 0);
    dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, "over-provisioned"), (Gauge<Integer>) () -> (_goalViolationDetector.provisionStatus() == ProvisionStatus.OVER_PROVISIONED) ? 1 : 0);
    dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, "right-sized"), (Gauge<Integer>) () -> (_goalViolationDetector.provisionStatus() == ProvisionStatus.RIGHT_SIZED) ? 1 : 0);
    // The number of metric anomalies corresponding to each metric anomaly type.
    for (MetricAnomalyType type : MetricAnomalyType.cachedValues()) {
        dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, String.format("num-%s-metric-anomalies", type.toString().toLowerCase())), (Gauge<Integer>) () -> _metricAnomalyDetector.numAnomaliesOfType(type));
    }
    // The cluster has partitions with RF > the number of eligible racks (0: No such partitions, 1: Has such partitions)
    dropwizardMetricRegistry.register(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, "has-partitions-with-replication-factor-greater-than-num-racks"), (Gauge<Integer>) () -> _goalViolationDetector.hasPartitionsWithRFGreaterThanNumRacks() ? 1 : 0);
    // The time taken to generate a fix for self-healing for each anomaly type
    for (KafkaAnomalyType anomalyType : KafkaAnomalyType.cachedValues()) {
        Timer timer = dropwizardMetricRegistry.timer(MetricRegistry.name(ANOMALY_DETECTOR_SENSOR, String.format("%s-self-healing-fix-generation-timer", anomalyType.toString().toLowerCase())));
        _selfHealingFixGenerationTimer.put(anomalyType, timer);
    }
}
Also used : KafkaAnomalyType(com.linkedin.kafka.cruisecontrol.detector.notifier.KafkaAnomalyType) Timer(com.codahale.metrics.Timer) MetricAnomalyType(com.linkedin.cruisecontrol.detector.metricanomaly.MetricAnomalyType)

Aggregations

Timer (com.codahale.metrics.Timer)1 MetricAnomalyType (com.linkedin.cruisecontrol.detector.metricanomaly.MetricAnomalyType)1 KafkaAnomalyType (com.linkedin.kafka.cruisecontrol.detector.notifier.KafkaAnomalyType)1