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