/** * @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); }
/** * Check that the event concerns the specified metric. * * @param e * @return <code>true</code> iff the event is about the specified metric, <code>false</code> * otherwise. */ boolean isApplicable(final MonitoringEvent e) { return metric == null || e.get(metric) != null; }