Search in sources :

Example 6 with Symptom

use of com.microsoft.dhalion.detector.Symptom in project incubator-heron by apache.

the class ProcessingRateSkewDetectorTest method testConfigAndFilter.

@Test
public void testConfigAndFilter() {
    HealthPolicyConfig config = mock(HealthPolicyConfig.class);
    when(config.getConfig(CONF_SKEW_RATIO, 1.5)).thenReturn(2.5);
    ComponentMetrics compMetrics = new ComponentMetrics("bolt");
    compMetrics.addInstanceMetric(new InstanceMetrics("i1", METRIC_EXE_COUNT.text(), 1000));
    compMetrics.addInstanceMetric(new InstanceMetrics("i2", METRIC_EXE_COUNT.text(), 200));
    Map<String, ComponentMetrics> topologyMetrics = new HashMap<>();
    topologyMetrics.put("bolt", compMetrics);
    ExecuteCountSensor sensor = mock(ExecuteCountSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    when(sensor.getMetricName()).thenReturn(METRIC_EXE_COUNT.text());
    ProcessingRateSkewDetector detector = new ProcessingRateSkewDetector(sensor, config);
    List<Symptom> symptoms = detector.detect();
    assertEquals(1, symptoms.size());
    compMetrics = new ComponentMetrics("bolt");
    compMetrics.addInstanceMetric(new InstanceMetrics("i1", METRIC_EXE_COUNT.text(), 1000));
    compMetrics.addInstanceMetric(new InstanceMetrics("i2", METRIC_EXE_COUNT.text(), 500));
    topologyMetrics.put("bolt", compMetrics);
    sensor = mock(ExecuteCountSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    detector = new ProcessingRateSkewDetector(sensor, config);
    symptoms = detector.detect();
    assertEquals(0, symptoms.size());
}
Also used : InstanceMetrics(com.microsoft.dhalion.metrics.InstanceMetrics) HealthPolicyConfig(com.twitter.heron.healthmgr.HealthPolicyConfig) HashMap(java.util.HashMap) ExecuteCountSensor(com.twitter.heron.healthmgr.sensors.ExecuteCountSensor) Symptom(com.microsoft.dhalion.detector.Symptom) ComponentMetrics(com.microsoft.dhalion.metrics.ComponentMetrics) Test(org.junit.Test)

Example 7 with Symptom

use of com.microsoft.dhalion.detector.Symptom in project incubator-heron by apache.

the class ProcessingRateSkewDetectorTest method testReturnsMultipleComponents.

@Test
public void testReturnsMultipleComponents() {
    HealthPolicyConfig config = mock(HealthPolicyConfig.class);
    when(config.getConfig(CONF_SKEW_RATIO, 1.5)).thenReturn(2.5);
    ComponentMetrics compMetrics1 = new ComponentMetrics("bolt-1");
    compMetrics1.addInstanceMetric(new InstanceMetrics("i1", METRIC_EXE_COUNT.text(), 1000));
    compMetrics1.addInstanceMetric(new InstanceMetrics("i2", METRIC_EXE_COUNT.text(), 200));
    ComponentMetrics compMetrics2 = new ComponentMetrics("bolt-2");
    compMetrics2.addInstanceMetric(new InstanceMetrics("i1", METRIC_EXE_COUNT.text(), 1000));
    compMetrics2.addInstanceMetric(new InstanceMetrics("i2", METRIC_EXE_COUNT.text(), 200));
    ComponentMetrics compMetrics3 = new ComponentMetrics("bolt-3");
    compMetrics3.addInstanceMetric(new InstanceMetrics("i1", METRIC_EXE_COUNT.text(), 1000));
    compMetrics3.addInstanceMetric(new InstanceMetrics("i2", METRIC_EXE_COUNT.text(), 500));
    Map<String, ComponentMetrics> topologyMetrics = new HashMap<>();
    topologyMetrics.put("bolt-1", compMetrics1);
    topologyMetrics.put("bolt-2", compMetrics2);
    topologyMetrics.put("bolt-3", compMetrics3);
    ExecuteCountSensor sensor = mock(ExecuteCountSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    when(sensor.getMetricName()).thenReturn(METRIC_EXE_COUNT.text());
    ProcessingRateSkewDetector detector = new ProcessingRateSkewDetector(sensor, config);
    List<Symptom> symptoms = detector.detect();
    assertEquals(2, symptoms.size());
    for (Symptom symptom : symptoms) {
        if (symptom.getComponent().getName().equals("bolt-1")) {
            compMetrics1 = null;
        } else if (symptom.getComponent().getName().equals("bolt-2")) {
            compMetrics2 = null;
        } else if (symptom.getComponent().getName().equals("bolt-3")) {
            compMetrics3 = null;
        }
    }
    assertNull(compMetrics1);
    assertNull(compMetrics2);
    assertNotNull(compMetrics3);
}
Also used : InstanceMetrics(com.microsoft.dhalion.metrics.InstanceMetrics) HealthPolicyConfig(com.twitter.heron.healthmgr.HealthPolicyConfig) HashMap(java.util.HashMap) ExecuteCountSensor(com.twitter.heron.healthmgr.sensors.ExecuteCountSensor) Symptom(com.microsoft.dhalion.detector.Symptom) ComponentMetrics(com.microsoft.dhalion.metrics.ComponentMetrics) Test(org.junit.Test)

Example 8 with Symptom

use of com.microsoft.dhalion.detector.Symptom in project incubator-heron by apache.

the class DataSkewDiagnoserTest method diagnosisNoDataSkewLowBufferSize.

@Test
public void diagnosisNoDataSkewLowBufferSize() {
    List<Symptom> symptoms = TestUtils.createBpSymptomList(123, 0, 0);
    symptoms.add(TestUtils.createExeCountSymptom(5000, 2000, 2000));
    symptoms.add(TestUtils.createWaitQueueDisparitySymptom(1, 500, 500));
    Diagnosis result = new DataSkewDiagnoser().diagnose(symptoms);
    assertNull(result);
}
Also used : Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Symptom(com.microsoft.dhalion.detector.Symptom) Test(org.junit.Test)

Example 9 with Symptom

use of com.microsoft.dhalion.detector.Symptom in project incubator-heron by apache.

the class DataSkewDiagnoserTest method diagnosisNoDataSkewLowRate.

@Test
public void diagnosisNoDataSkewLowRate() {
    List<Symptom> symptoms = TestUtils.createBpSymptomList(123, 0, 0);
    symptoms.add(TestUtils.createExeCountSymptom(100, 2000, 2000));
    symptoms.add(TestUtils.createWaitQueueDisparitySymptom(10000, 500, 500));
    Diagnosis result = new DataSkewDiagnoser().diagnose(symptoms);
    assertNull(result);
}
Also used : Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Symptom(com.microsoft.dhalion.detector.Symptom) Test(org.junit.Test)

Example 10 with Symptom

use of com.microsoft.dhalion.detector.Symptom in project incubator-heron by apache.

the class DataSkewDiagnoserTest method diagnosis1DataSkewInstance.

@Test
public void diagnosis1DataSkewInstance() {
    List<Symptom> symptoms = TestUtils.createBpSymptomList(123, 0, 0);
    symptoms.add(TestUtils.createExeCountSymptom(5000, 2000, 2000));
    symptoms.add(TestUtils.createWaitQueueDisparitySymptom(10000, 500, 500));
    Diagnosis result = new DataSkewDiagnoser().diagnose(symptoms);
    assertNotNull(result);
    assertEquals(DIAGNOSIS_DATA_SKEW.text(), result.getName());
    assertEquals(1, result.getSymptoms().size());
    Symptom symptom = result.getSymptoms().values().iterator().next();
    assertEquals(123, symptom.getComponent().getMetricValueSum("container_1_bolt_0", METRIC_BACK_PRESSURE.text()).intValue());
}
Also used : Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Symptom(com.microsoft.dhalion.detector.Symptom) Test(org.junit.Test)

Aggregations

Symptom (com.microsoft.dhalion.detector.Symptom)25 ComponentMetrics (com.microsoft.dhalion.metrics.ComponentMetrics)16 Test (org.junit.Test)16 Diagnosis (com.microsoft.dhalion.diagnoser.Diagnosis)15 HashMap (java.util.HashMap)8 InstanceMetrics (com.microsoft.dhalion.metrics.InstanceMetrics)7 ComponentMetricsHelper (com.twitter.heron.healthmgr.common.ComponentMetricsHelper)7 ArrayList (java.util.ArrayList)7 HealthPolicyConfig (com.twitter.heron.healthmgr.HealthPolicyConfig)6 MetricsStats (com.twitter.heron.healthmgr.common.MetricsStats)4 Action (com.microsoft.dhalion.resolver.Action)3 BufferSizeSensor (com.twitter.heron.healthmgr.sensors.BufferSizeSensor)3 ExecuteCountSensor (com.twitter.heron.healthmgr.sensors.ExecuteCountSensor)2 PackingPlan (com.twitter.heron.spi.packing.PackingPlan)2 TopologyAPI (com.twitter.heron.api.generated.TopologyAPI)1 ContainerRestart (com.twitter.heron.healthmgr.common.HealthManagerEvents.ContainerRestart)1 TopologyUpdate (com.twitter.heron.healthmgr.common.HealthManagerEvents.TopologyUpdate)1 PackingPlanProvider (com.twitter.heron.healthmgr.common.PackingPlanProvider)1 BackPressureSensor (com.twitter.heron.healthmgr.sensors.BackPressureSensor)1 Scheduler (com.twitter.heron.proto.scheduler.Scheduler)1