Search in sources :

Example 21 with Symptom

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

the class DataSkewDiagnoserTest method failsIfNoDataSkewSymptom.

@Test
public void failsIfNoDataSkewSymptom() {
    List<Symptom> symptoms = TestUtils.createBpSymptomList(123);
    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 22 with Symptom

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

the class UnderProvisioningDiagnoserTest method diagnosisWhen1Of1InstanceInBP.

@Test
public void diagnosisWhen1Of1InstanceInBP() {
    List<Symptom> symptoms = TestUtils.createBpSymptomList(123, 0);
    // symptoms.add(TestUtils.createLargeWaitQSymptom(5000));
    Diagnosis result = new UnderProvisioningDiagnoser().diagnose(symptoms);
    validateDiagnosis(result);
}
Also used : Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Symptom(com.microsoft.dhalion.detector.Symptom) Test(org.junit.Test)

Example 23 with Symptom

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

the class UnderProvisioningDiagnoserTest method diagnosisFailsNotSimilarQueueSizes.

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

Example 24 with Symptom

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

the class LargeWaitQueueDetectorTest method testConfigAndFilter.

@Test
public void testConfigAndFilter() {
    HealthPolicyConfig config = mock(HealthPolicyConfig.class);
    when(config.getConfig(CONF_SIZE_LIMIT, 1000)).thenReturn(20);
    ComponentMetrics compMetrics = new ComponentMetrics("bolt", "i1", METRIC_BUFFER_SIZE.text(), 21);
    Map<String, ComponentMetrics> topologyMetrics = new HashMap<>();
    topologyMetrics.put("bolt", compMetrics);
    BufferSizeSensor sensor = mock(BufferSizeSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    LargeWaitQueueDetector detector = new LargeWaitQueueDetector(sensor, config);
    List<Symptom> symptoms = detector.detect();
    assertEquals(1, symptoms.size());
    compMetrics = new ComponentMetrics("bolt", "i1", METRIC_BUFFER_SIZE.text(), 19);
    topologyMetrics.put("bolt", compMetrics);
    sensor = mock(BufferSizeSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    detector = new LargeWaitQueueDetector(sensor, config);
    symptoms = detector.detect();
    assertEquals(0, symptoms.size());
}
Also used : HealthPolicyConfig(com.twitter.heron.healthmgr.HealthPolicyConfig) HashMap(java.util.HashMap) BufferSizeSensor(com.twitter.heron.healthmgr.sensors.BufferSizeSensor) Symptom(com.microsoft.dhalion.detector.Symptom) ComponentMetrics(com.microsoft.dhalion.metrics.ComponentMetrics) Test(org.junit.Test)

Example 25 with Symptom

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

the class WaitQueueDisparityDetectorTest method testConfigAndFilter.

@Test
public void testConfigAndFilter() {
    HealthPolicyConfig config = mock(HealthPolicyConfig.class);
    when(config.getConfig(CONF_DISPARITY_RATIO, 20.0)).thenReturn(15.0);
    ComponentMetrics compMetrics = new ComponentMetrics("bolt");
    compMetrics.addInstanceMetric(new InstanceMetrics("i1", METRIC_BUFFER_SIZE.text(), 1501));
    compMetrics.addInstanceMetric(new InstanceMetrics("i2", METRIC_BUFFER_SIZE.text(), 100));
    Map<String, ComponentMetrics> topologyMetrics = new HashMap<>();
    topologyMetrics.put("bolt", compMetrics);
    BufferSizeSensor sensor = mock(BufferSizeSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    when(sensor.getMetricName()).thenReturn(METRIC_BUFFER_SIZE.text());
    WaitQueueDisparityDetector detector = new WaitQueueDisparityDetector(sensor, config);
    List<Symptom> symptoms = detector.detect();
    assertEquals(1, symptoms.size());
    compMetrics = new ComponentMetrics("bolt");
    compMetrics.addInstanceMetric(new InstanceMetrics("i1", METRIC_BUFFER_SIZE.text(), 1500));
    compMetrics.addInstanceMetric(new InstanceMetrics("i2", METRIC_BUFFER_SIZE.text(), 110));
    topologyMetrics.put("bolt", compMetrics);
    sensor = mock(BufferSizeSensor.class);
    when(sensor.get()).thenReturn(topologyMetrics);
    detector = new WaitQueueDisparityDetector(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) BufferSizeSensor(com.twitter.heron.healthmgr.sensors.BufferSizeSensor) Symptom(com.microsoft.dhalion.detector.Symptom) ComponentMetrics(com.microsoft.dhalion.metrics.ComponentMetrics) 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