/** * @param e the event to check for violation metrics. * @param filterUnits * @return the particular monitored metric violation or <code>null</code>, or <code>null</code>. */ Violation isViolated(final MonitoringEvent e, final List<String> filterUnits) { final double observedValue = (Double) e.get(metric); final boolean res = pred.perform(observedValue, thresholdValue); if (!res) return null; final ArrayList<String> applicable = new ArrayList<String>(filterUnits.size()); for (final String filterUnit : filterUnits) if (ThresholdRulesTraits.join(e).startsWith(filterUnit)) applicable.add(filterUnit); return new Violation(metric, thresholdValue, observedValue, applicable); }
/** * @param events the list of events to check for violation metrics. * @param filterUnits * @return the particular monitored metric violation or <code>null</code>, or <code>null</code>. */ Violation isViolated(final List<MonitoringEvent> events, final List<String> filterUnits) { // FIXME: should check specific filterUnit final double observedValue = performFold(events); final boolean res = pred.perform(observedValue, thresholdValue); if (!res) return null; final ArrayList<String> applicable = new ArrayList<String>(filterUnits.size()); for (final String filterUnit : filterUnits) for (final MonitoringEvent e : events) if (ThresholdRulesTraits.join(e).startsWith(filterUnit)) applicable.add(filterUnit); return new Violation(metric, thresholdValue, observedValue, null); }