Search in sources :

Example 1 with Diagnosis

use of com.microsoft.dhalion.diagnoser.Diagnosis in project incubator-heron by apache.

the class SlowInstanceDiagnoserTest method failIfInstanceWithBpHasSmallBuffer.

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

Example 2 with Diagnosis

use of com.microsoft.dhalion.diagnoser.Diagnosis in project incubator-heron by apache.

the class SlowInstanceDiagnoserTest method diagnosis1of3SlowInstances.

@Test
public void diagnosis1of3SlowInstances() {
    List<Symptom> symptoms = TestUtils.createBpSymptomList(123, 0, 0);
    symptoms.add(TestUtils.createWaitQueueDisparitySymptom(1000, 20, 20));
    Diagnosis result = new SlowInstanceDiagnoser().diagnose(symptoms);
    assertEquals(1, result.getSymptoms().size());
    ComponentMetrics data = result.getSymptoms().values().iterator().next().getComponent();
    assertEquals(123, data.getMetricValueSum("container_1_bolt_0", METRIC_BACK_PRESSURE.text()).intValue());
}
Also used : Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Symptom(com.microsoft.dhalion.detector.Symptom) ComponentMetrics(com.microsoft.dhalion.metrics.ComponentMetrics) Test(org.junit.Test)

Example 3 with Diagnosis

use of com.microsoft.dhalion.diagnoser.Diagnosis in project incubator-heron by apache.

the class SlowInstanceDiagnoserTest method failsIfNoBufferSizeDiaparity.

@Test
public void failsIfNoBufferSizeDiaparity() {
    SlowInstanceDiagnoser diagnoser = new SlowInstanceDiagnoser();
    Diagnosis result = diagnoser.diagnose(TestUtils.createBpSymptomList(123));
    assertNull(result);
}
Also used : Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Test(org.junit.Test)

Example 4 with Diagnosis

use of com.microsoft.dhalion.diagnoser.Diagnosis in project incubator-heron by apache.

the class ScaleUpResolverTest method testResolve.

@Test
public void testResolve() {
    TopologyAPI.Topology topology = createTestTopology();
    Config config = createConfig(topology);
    PackingPlan currentPlan = createPacking(topology, config);
    PackingPlanProvider packingPlanProvider = mock(PackingPlanProvider.class);
    when(packingPlanProvider.get()).thenReturn(currentPlan);
    ISchedulerClient scheduler = mock(ISchedulerClient.class);
    when(scheduler.updateTopology(any(UpdateTopologyRequest.class))).thenReturn(true);
    ComponentMetrics metrics = new ComponentMetrics("bolt", "i1", METRIC_BACK_PRESSURE.text(), 123);
    Symptom symptom = new Symptom(SYMPTOM_UNDER_PROVISIONING.text(), metrics);
    List<Diagnosis> diagnosis = new ArrayList<>();
    diagnosis.add(new Diagnosis("test", symptom));
    ScaleUpResolver resolver = new ScaleUpResolver(null, packingPlanProvider, scheduler, eventManager, null);
    ScaleUpResolver spyResolver = spy(resolver);
    doReturn(2).when(spyResolver).computeScaleUpFactor(metrics);
    doReturn(currentPlan).when(spyResolver).buildNewPackingPlan(any(HashMap.class), eq(currentPlan));
    List<Action> result = spyResolver.resolve(diagnosis);
    verify(scheduler, times(1)).updateTopology(any(UpdateTopologyRequest.class));
    assertEquals(1, result.size());
}
Also used : Action(com.microsoft.dhalion.resolver.Action) HashMap(java.util.HashMap) Config(com.twitter.heron.spi.common.Config) PackingPlan(com.twitter.heron.spi.packing.PackingPlan) ArrayList(java.util.ArrayList) PackingPlanProvider(com.twitter.heron.healthmgr.common.PackingPlanProvider) TopologyAPI(com.twitter.heron.api.generated.TopologyAPI) UpdateTopologyRequest(com.twitter.heron.proto.scheduler.Scheduler.UpdateTopologyRequest) ISchedulerClient(com.twitter.heron.scheduler.client.ISchedulerClient) Diagnosis(com.microsoft.dhalion.diagnoser.Diagnosis) Symptom(com.microsoft.dhalion.detector.Symptom) ComponentMetrics(com.microsoft.dhalion.metrics.ComponentMetrics) Test(org.junit.Test)

Example 5 with Diagnosis

use of com.microsoft.dhalion.diagnoser.Diagnosis 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)

Aggregations

Diagnosis (com.microsoft.dhalion.diagnoser.Diagnosis)16 Symptom (com.microsoft.dhalion.detector.Symptom)15 Test (org.junit.Test)11 ComponentMetrics (com.microsoft.dhalion.metrics.ComponentMetrics)6 InstanceMetrics (com.microsoft.dhalion.metrics.InstanceMetrics)3 Action (com.microsoft.dhalion.resolver.Action)3 ComponentMetricsHelper (com.twitter.heron.healthmgr.common.ComponentMetricsHelper)3 ArrayList (java.util.ArrayList)3 MetricsStats (com.twitter.heron.healthmgr.common.MetricsStats)2 PackingPlan (com.twitter.heron.spi.packing.PackingPlan)2 HashMap (java.util.HashMap)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 Scheduler (com.twitter.heron.proto.scheduler.Scheduler)1 UpdateTopologyRequest (com.twitter.heron.proto.scheduler.Scheduler.UpdateTopologyRequest)1 ISchedulerClient (com.twitter.heron.scheduler.client.ISchedulerClient)1 Config (com.twitter.heron.spi.common.Config)1