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);
}
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);
}
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);
}
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());
}
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());
}
Aggregations