Alerting : Small fixes.
Fix the constructor for the AlertResult. Original commit: elastic/x-pack-elasticsearch@0820edaa6a
This commit is contained in:
parent
019cdb37d4
commit
d1af9f15fe
|
@ -13,6 +13,17 @@ import java.util.Arrays;
|
|||
public class AlertResult {
|
||||
public SearchResponse searchResponse;
|
||||
public AlertTrigger trigger;
|
||||
public String alertName;
|
||||
|
||||
public AlertResult(String alertName, SearchResponse searchResponse, AlertTrigger trigger, boolean isTriggered, XContentBuilder query, String[] indices) {
|
||||
this.searchResponse = searchResponse;
|
||||
this.trigger = trigger;
|
||||
this.isTriggered = isTriggered;
|
||||
this.query = query;
|
||||
this.indices = indices;
|
||||
this.alertName = alertName;
|
||||
}
|
||||
|
||||
public boolean isTriggered;
|
||||
public XContentBuilder query;
|
||||
public String[] indices;
|
||||
|
|
|
@ -14,7 +14,6 @@ import org.elasticsearch.common.inject.Inject;
|
|||
import org.elasticsearch.common.joda.time.DateTime;
|
||||
import org.elasticsearch.common.settings.Settings;
|
||||
import org.elasticsearch.common.xcontent.*;
|
||||
import org.elasticsearch.script.ScriptService;
|
||||
import org.quartz.*;
|
||||
import org.quartz.impl.StdSchedulerFactory;
|
||||
import org.quartz.simpl.SimpleJobFactory;
|
||||
|
@ -81,13 +80,7 @@ public class AlertScheduler extends AbstractLifecycleComponent {
|
|||
}
|
||||
SearchResponse sr = srb.execute().get();
|
||||
logger.warn("Got search response hits : [{}]", sr.getHits().getTotalHits() );
|
||||
AlertResult result = new AlertResult();
|
||||
//TODO: move these to ctr
|
||||
result.isTriggered = triggerManager.isTriggered(alertName,sr);
|
||||
result.searchResponse = sr;
|
||||
result.trigger = alert.trigger();
|
||||
result.query = builder;
|
||||
result.indices = indices;
|
||||
AlertResult result = new AlertResult(alertName, sr, alert.trigger(), triggerManager.isTriggered(alertName,sr), builder, indices);
|
||||
|
||||
if (result.isTriggered) {
|
||||
logger.warn("We have triggered");
|
||||
|
|
Loading…
Reference in New Issue