Search in sources :

Example 16 with Diagnosis

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

the class UnderProvisioningDiagnoser method diagnose.

@Override
public Collection<Diagnosis> diagnose(Collection<Symptom> symptoms) {
    Collection<Diagnosis> diagnoses = new ArrayList<>();
    SymptomsTable symptomsTable = SymptomsTable.of(symptoms);
    SymptomsTable bp = symptomsTable.type(SYMPTOM_COMP_BACK_PRESSURE.text());
    if (bp.size() > 1) {
        // TODO handle cases where multiple detectors create back pressure symptom
        throw new IllegalStateException("Multiple back-pressure symptoms case");
    }
    if (bp.size() == 0) {
        return diagnoses;
    }
    String bpComponent = bp.first().assignments().iterator().next();
    SymptomsTable processingRateSkew = symptomsTable.type(SYMPTOM_PROCESSING_RATE_SKEW.text());
    SymptomsTable waitQSkew = symptomsTable.type(SYMPTOM_WAIT_Q_SIZE_SKEW.text());
    if (waitQSkew.assignment(bpComponent).size() != 0 || processingRateSkew.assignment(bpComponent).size() != 0) {
        return diagnoses;
    }
    Collection<String> assignments = Collections.singletonList(bpComponent);
    LOG.info(String.format("UNDER_PROVISIONING: %s back-pressure and similar processing rates " + "and wait queue sizes", bpComponent));
    diagnoses.add(new Diagnosis(DIAGNOSIS_UNDER_PROVISIONING.text(), context.checkpoint(), assignments));
    return diagnoses;
}
Also used : ArrayList(java.util.ArrayList) Diagnosis(com.microsoft.dhalion.core.Diagnosis) SymptomsTable(com.microsoft.dhalion.core.SymptomsTable)

Aggregations

Diagnosis (com.microsoft.dhalion.core.Diagnosis)16 Test (org.junit.Test)11 Symptom (com.microsoft.dhalion.core.Symptom)10 ArrayList (java.util.ArrayList)4 SymptomsTable (com.microsoft.dhalion.core.SymptomsTable)3 Instant (java.time.Instant)3 Action (com.microsoft.dhalion.core.Action)2 MeasurementsTable (com.microsoft.dhalion.core.MeasurementsTable)2 HashMap (java.util.HashMap)2 PackingPlan (org.apache.heron.spi.packing.PackingPlan)2 DiagnosisTable (com.microsoft.dhalion.core.DiagnosisTable)1 Measurement (com.microsoft.dhalion.core.Measurement)1 ExecutionContext (com.microsoft.dhalion.policy.PoliciesExecutor.ExecutionContext)1 TopologyAPI (org.apache.heron.api.generated.TopologyAPI)1 TopologyUpdate (org.apache.heron.healthmgr.common.HealthManagerEvents.TopologyUpdate)1 PackingPlanProvider (org.apache.heron.healthmgr.common.PackingPlanProvider)1 Scheduler (org.apache.heron.proto.scheduler.Scheduler)1 UpdateTopologyRequest (org.apache.heron.proto.scheduler.Scheduler.UpdateTopologyRequest)1 ISchedulerClient (org.apache.heron.scheduler.client.ISchedulerClient)1 Config (org.apache.heron.spi.common.Config)1