protected boolean isTriggerCountExceeded() { return getExceededCount() >= getThresholdConfig().getTrigger(); }
/** {@inheritDoc} */ @Override public boolean equals(final Object obj) { if ( this == obj ) { return true; } if (obj instanceof BaseThresholdDefConfigWrapper) { final BaseThresholdDefConfigWrapper that = (BaseThresholdDefConfigWrapper)obj; return Objects.equals(this.getType(), that.getType()) && Objects.equals(this.getDsType(), that.getDsType()) && Objects.equals(this.getDatasourceExpression(), that.getDatasourceExpression()) && Objects.equals(this.getDsLabel(), that.getDsLabel()) && Objects.equals(this.getTriggeredUEI(), that.getTriggeredUEI()) && Objects.equals(this.getRearmedUEI(), that.getRearmedUEI()) && Objects.equals(this.getValue(), that.getValue()) && Objects.equals(this.getRearm(), that.getRearm()) && Objects.equals(this.getTrigger(), that.getTrigger()) && Objects.equals(this.getBasethresholddef().getFilterOperator(), that.getBasethresholddef().getFilterOperator()) && Objects.equals(this.getBasethresholddef().getRelaxed(), that.getBasethresholddef().getRelaxed()) && Objects.equals(this.getBasethresholddef().getResourceFilters(), that.getBasethresholddef().getResourceFilters()); } return false; }
private Event createBasicEvent(String uei, Date date, double dsValue, CollectionResourceWrapper resource) { Map<String,String> params = new HashMap<String,String>(); params.put("previousValue", formatValue(getPreviousTriggeringSample())); params.put("changeThreshold", Double.toString(getThresholdConfig().getValue())); params.put("trigger", Integer.toString(getThresholdConfig().getTrigger())); return createBasicEvent(uei, date, dsValue, resource, params); }
private Event createBasicEvent(String uei, Date date, double dsValue, CollectionResourceWrapper resource) { Map<String,String> params = new HashMap<String,String>(); params.put("threshold", Double.toString(getThresholdConfig().getValue())); params.put("trigger", Integer.toString(getThresholdConfig().getTrigger())); params.put("rearm", Double.toString(getThresholdConfig().getRearm())); return createBasicEvent(uei, date, dsValue, resource, params); }
private Event createBasicEvent(String uei, Date date, double dsValue, CollectionResourceWrapper resource) { Map<String,String> params = new HashMap<String,String>(); params.put("previousValue", formatValue(getPreviousTriggeringSample())); params.put("threshold", Double.toString(getThresholdConfig().getValue())); params.put("trigger", Integer.toString(getThresholdConfig().getTrigger())); // params.put("rearm", Double.toString(getThresholdConfig().getRearm())); return createBasicEvent(uei, date, dsValue, resource, params); }
/** * This method is responsible for returning a String object which represents * the content of this ThresholdEntity. Primarily used for debugging * purposes. * * @return String which represents the content of this ThresholdEntity */ @Override public String toString() { if (!hasThresholds()) { return ""; } final StringBuilder buffer = new StringBuilder("{"); buffer.append("evaluator=").append(this.getThresholdConfig().getType()); buffer.append(", dsName=").append(this.getDataSourceExpression()); buffer.append(", dsType=").append(this.getDatasourceType()); buffer.append(", evaluators=["); for (ThresholdEvaluatorState item : getThresholdEvaluatorStates(null)) { buffer.append("{ds=").append(item.getThresholdConfig().getDatasourceExpression()); buffer.append(", value=").append(item.getThresholdConfig().getValue()); buffer.append(", rearm=").append(item.getThresholdConfig().getRearm()); buffer.append(", trigger=").append(item.getThresholdConfig().getTrigger()); buffer.append("}"); } buffer.append("]}"); return buffer.toString(); }
@Override public Status evaluate(double dsValue) { // log().debug(TYPE + " threshold evaluating, sample value="+dsValue); try { if(!Double.valueOf(getPreviousTriggeringSample()).isNaN()) { ++m_triggerCount; if(!wasTriggered(dsValue) && (m_triggerCount >= getThresholdConfig().getTrigger())) { setPreviousTriggeringSample(Double.NaN); m_triggerCount = 0; LOG.debug("{} threshold rearmed, sample value={}", TYPE, dsValue); return Status.RE_ARMED; } } else if (wasTriggered(dsValue)) { setPreviousTriggeringSample(getLastSample()); m_triggerCount = 0; LOG.debug("{} threshold triggered, sample value={}", TYPE, dsValue); return Status.TRIGGERED; } } finally { setLastSample(dsValue); } return Status.NO_CHANGE; }