use of com.microsoft.dhalion.core.Symptom in project heron by twitter.
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);
Measurement measurement1 = new Measurement("bolt", "i1", METRIC_EXE_COUNT.text(), Instant.ofEpochSecond(1497892222), 1000);
Measurement measurement2 = new Measurement("bolt", "i2", METRIC_EXE_COUNT.text(), Instant.ofEpochSecond(1497892222), 200.0);
Collection<Measurement> metrics = new ArrayList<>();
metrics.add(measurement1);
metrics.add(measurement2);
ProcessingRateSkewDetector detector = new ProcessingRateSkewDetector(config);
PoliciesExecutor.ExecutionContext context = mock(PoliciesExecutor.ExecutionContext.class);
when(context.checkpoint()).thenReturn(Instant.now());
detector.initialize(context);
Collection<Symptom> symptoms = detector.detect(metrics);
assertEquals(3, symptoms.size());
SymptomsTable symptomsTable = SymptomsTable.of(symptoms);
assertEquals(1, symptomsTable.type("POSITIVE " + BaseDetector.SymptomType.SYMPTOM_PROCESSING_RATE_SKEW).size());
assertEquals(1, symptomsTable.type("NEGATIVE " + BaseDetector.SymptomType.SYMPTOM_PROCESSING_RATE_SKEW).size());
assertEquals(1, symptomsTable.type("POSITIVE " + BaseDetector.SymptomType.SYMPTOM_PROCESSING_RATE_SKEW).assignment("i1").size());
assertEquals(1, symptomsTable.type("NEGATIVE " + BaseDetector.SymptomType.SYMPTOM_PROCESSING_RATE_SKEW).assignment("i2").size());
measurement1 = new Measurement("bolt", "i1", METRIC_EXE_COUNT.text(), Instant.ofEpochSecond(1497892222), 1000);
measurement2 = new Measurement("bolt", "i2", METRIC_EXE_COUNT.text(), Instant.ofEpochSecond(1497892222), 500.0);
metrics = new ArrayList<>();
metrics.add(measurement1);
metrics.add(measurement2);
detector = new ProcessingRateSkewDetector(config);
detector.initialize(context);
symptoms = detector.detect(metrics);
assertEquals(0, symptoms.size());
}
use of com.microsoft.dhalion.core.Symptom in project heron by twitter.
the class DataSkewDiagnoserTest method failsIfNoDataSkewSymptom.
@Test
public void failsIfNoDataSkewSymptom() {
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());
}
use of com.microsoft.dhalion.core.Symptom in project heron by twitter.
the class UnderProvisioningDiagnoserTest method diagnosisFailsNotSimilarQueueSizes.
@Test
public void diagnosisFailsNotSimilarQueueSizes() {
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(0, result.size());
}
use of com.microsoft.dhalion.core.Symptom in project heron by twitter.
the class UnderProvisioningDiagnoserTest method diagnosisWhen1Of1InstanceInBP.
@Test
public void diagnosisWhen1Of1InstanceInBP() {
Collection<String> assign = Collections.singleton(comp);
Symptom symptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
Collection<Symptom> symptoms = Collections.singletonList(symptom);
Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
validateDiagnosis(result);
}
use of com.microsoft.dhalion.core.Symptom in project heron by twitter.
the class UnderProvisioningDiagnoserTest method diagnosisFailsNotSimilarProcessingRates.
@Test
public void diagnosisFailsNotSimilarProcessingRates() {
// TODO BP instance should be same as the one with high processing rate
Collection<String> assign = Collections.singleton(comp);
Symptom bpSymptom = new Symptom(SYMPTOM_COMP_BACK_PRESSURE.text(), now, assign);
Symptom qDisparitySymptom = new Symptom(SYMPTOM_PROCESSING_RATE_SKEW.text(), now, assign);
Collection<Symptom> symptoms = Arrays.asList(bpSymptom, qDisparitySymptom);
Collection<Diagnosis> result = diagnoser.diagnose(symptoms);
assertEquals(0, result.size());
}
Aggregations