in src/main/java/com/microsoft/dhalion/detectors/BelowThresholdDetector.java [53:78]
public Collection<Symptom> detect(Collection<Measurement> measurements) {
if (measurements.isEmpty()) {
return Collections.emptyList();
}
MeasurementsTable measurementsTable = context.measurements().type(metricName).sort(false, SortKey.TIME_STAMP);
Collection<String> assignments = new ArrayList<>();
for (String component : measurementsTable.uniqueComponents()) {
MeasurementsTable componentData = measurementsTable.component(component);
for (String instance : componentData.uniqueInstances()) {
MeasurementsTable instanceData = componentData.instance(instance).last((int) noCheckpoints);
if (instanceData.valueBetween(Double.MIN_VALUE, lowThreshold).size() == noCheckpoints) {
LOG.fine(String.format("Instance %s has values below the limit %s for the last %s checkpoints",
instance, lowThreshold, noCheckpoints));
assignments.add(instance);
}
}
}
if (assignments.isEmpty()) {
return Collections.emptyList();
}
Symptom s = new Symptom(String.join("_", SYMPTOM_LOW, metricName), context.checkpoint(), assignments);
return Collections.singletonList(s);
}