Search in sources :

Example 1 with MetricAssessment

use of com.thinkbiganalytics.metadata.sla.api.MetricAssessment in project kylo by Teradata.

the class ServiceLevelAssessmentAlertUtil method getDescription.

public static String getDescription(ServiceLevelAssessment slaAssmt, String newlineChar) {
    StringBuilder descrBldr = new StringBuilder();
    // of the assessment components: sla assessment->obligation assessments->metric assessments
    if (slaAssmt.getObligationAssessments() != null) {
        for (ObligationAssessment obAssmnt : slaAssmt.getObligationAssessments()) {
            if (obAssmnt.getMetricAssessments() != null) {
                for (MetricAssessment metricAssmnt : obAssmnt.getMetricAssessments()) {
                    descrBldr.append("Requirement: ").append(metricAssmnt.getMetricDescription()).append(newlineChar).append("Result: ").append(metricAssmnt.getMessage()).append(newlineChar);
                }
            }
        }
    }
    descrBldr.append("\nAssessed on ").append(slaAssmt.getTime());
    return descrBldr.toString();
}
Also used : ObligationAssessment(com.thinkbiganalytics.metadata.sla.api.ObligationAssessment) MetricAssessment(com.thinkbiganalytics.metadata.sla.api.MetricAssessment)

Example 2 with MetricAssessment

use of com.thinkbiganalytics.metadata.sla.api.MetricAssessment in project kylo by Teradata.

the class TestObligatinAssessor method assess.

@Override
@SuppressWarnings("unchecked")
public void assess(Obligation obligation, ObligationAssessmentBuilder builder) {
    AssessmentResult result = AssessmentResult.SUCCESS;
    for (Metric metric : obligation.getMetrics()) {
        MetricAssessment assessment = builder.assess(metric);
        result = result.max(assessment.getResult());
    }
    if (this.expectedDescription != null) {
        builder.compareWith(this.expectedDescription);
        if (!obligation.getDescription().equals(this.expectedDescription)) {
            builder.message("The expected description does not match: " + this.expectedDescription);
            result = AssessmentResult.FAILURE;
        }
    }
    builder.result(result);
}
Also used : MetricAssessment(com.thinkbiganalytics.metadata.sla.api.MetricAssessment) Metric(com.thinkbiganalytics.metadata.sla.api.Metric) AssessmentResult(com.thinkbiganalytics.metadata.sla.api.AssessmentResult)

Aggregations

MetricAssessment (com.thinkbiganalytics.metadata.sla.api.MetricAssessment)2 AssessmentResult (com.thinkbiganalytics.metadata.sla.api.AssessmentResult)1 Metric (com.thinkbiganalytics.metadata.sla.api.Metric)1 ObligationAssessment (com.thinkbiganalytics.metadata.sla.api.ObligationAssessment)1