Search in sources :

Example 6 with Symptom

use of com.microsoft.dhalion.core.Symptom in project heron by twitter.

the class SlowInstanceDiagnoserTest method failsIfNoBufferSizeDisparity.

@Test
public void failsIfNoBufferSizeDisparity() {
    Symptom symptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), Instant.now(), null);
    Collection<Symptom> symptoms = Collections.singletonList(symptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(0, result.size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 7 with Symptom

use of com.microsoft.dhalion.core.Symptom in project heron by twitter.

the class SlowInstanceDiagnoserTest method diagnosis1of3SlowInstances.

@Test
public void diagnosis1of3SlowInstances() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_WAIT_Q_SIZE, 1000, 20, 20);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(1, result.size());
    Diagnosis diagnoses = result.iterator().next();
    assertEquals(DIAGNOSIS_SLOW_INSTANCE.text(), diagnoses.type());
    assertEquals(1, diagnoses.assignments().size());
    assertEquals("i1", diagnoses.assignments().iterator().next());
// TODO
// assertEquals(1, diagnoses.symptoms().size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 8 with Symptom

use of com.microsoft.dhalion.core.Symptom in project heron by twitter.

the class DataSkewDiagnoserTest method diagnosisNoDataSkewLowRate.

@Test
public void diagnosisNoDataSkewLowRate() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_EXE_COUNT, 100, 2000, 2000);
    addMeasurements(METRIC_WAIT_Q_SIZE, 10000, 500, 500);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom skewSymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, skewSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(0, result.size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 9 with Symptom

use of com.microsoft.dhalion.core.Symptom in project heron by twitter.

the class DataSkewDiagnoserTest method diagnosis1DataSkewInstance.

@Test
public void diagnosis1DataSkewInstance() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_EXE_COUNT, 5000, 2000, 2000);
    addMeasurements(METRIC_WAIT_Q_SIZE, 10000, 500, 500);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom skewSymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, skewSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(1, result.size());
    Diagnosis diagnoses = result.iterator().next();
    assertEquals(DIAGNOSIS_DATA_SKEW.text(), diagnoses.type());
    assertEquals(1, diagnoses.assignments().size());
    assertEquals("i1", diagnoses.assignments().iterator().next());
// TODO
// assertEquals(1, diagnoses.symptoms().size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Example 10 with Symptom

use of com.microsoft.dhalion.core.Symptom in project heron by twitter.

the class DataSkewDiagnoserTest method diagnosisNoDataSkewLowBufferSize.

@Test
public void diagnosisNoDataSkewLowBufferSize() {
    addMeasurements(METRIC_BACK_PRESSURE, 123, 0, 0);
    addMeasurements(METRIC_EXE_COUNT, 5000, 2000, 2000);
    addMeasurements(METRIC_WAIT_Q_SIZE, 1, 500, 500);
    when(context.measurements()).thenReturn(MeasurementsTable.of(measurements));
    Collection<String> assign = Collections.singleton(comp);
    Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
    Symptom skewSymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
    Symptom qDisparitySymptom = new Symptom(SYMPTOM_WAIT_Q_SIZE_SKEW.text(), now, assign);
    Collection<Symptom> symptoms = Arrays.asList(bpSymptom, skewSymptom, qDisparitySymptom);
    Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
    assertEquals(0, result.size());
}
Also used : Diagnosis(com.microsoft.dhalion.core.Diagnosis) Symptom(com.microsoft.dhalion.core.Symptom) Test(org.junit.Test)

Aggregations

Symptom (com.microsoft.dhalion.core.Symptom)20 Test (org.junit.Test)16 Diagnosis (com.microsoft.dhalion.core.Diagnosis)10 ArrayList (java.util.ArrayList)10 Measurement (com.microsoft.dhalion.core.Measurement)6 PoliciesExecutor (com.microsoft.dhalion.policy.PoliciesExecutor)6 HealthPolicyConfig (org.apache.heron.healthmgr.HealthPolicyConfig)6 MeasurementsTable (com.microsoft.dhalion.core.MeasurementsTable)4 SymptomsTable (com.microsoft.dhalion.core.SymptomsTable)4 Instant (java.time.Instant)2 HashSet (java.util.HashSet)2 HealthManagerMetrics (org.apache.heron.healthmgr.HealthManagerMetrics)1