public Collection detect()

in src/main/java/com/microsoft/dhalion/detectors/AboveThresholdDetector.java [52:77]


  public Collection<Symptom> detect(Collection<Measurement> measurements) {
    if (measurements.isEmpty()) {
      return Collections.emptyList();
    }

    Collection<String> assignments = new ArrayList<>();
    MeasurementsTable measurementsTable = context.measurements().type(metricName).sort(false, SortKey.TIME_STAMP);
    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(highThreshold, Double.MAX_VALUE).size() == noCheckpoints) {
          LOG.fine(String.format("Instance %s has values above the limit (%s) for the last %s checkpoints",
                                 instance, highThreshold, noCheckpoints));
          assignments.add(instance);
        }
      }
    }

    if (assignments.isEmpty()) {
      return Collections.emptyList();
    }

    Symptom s = new Symptom(String.join("_", SYMPTOM_HIGH, metricName), context.checkpoint(), assignments);
    return Collections.singletonList(s);
  }