Skip to content

Commit

Permalink
apply filter earlier to let in just 500 responses
Browse files Browse the repository at this point in the history
Signed-off-by: Lida He <[email protected]>
  • Loading branch information
hldnova committed May 18, 2018
1 parent 75c4815 commit 27e0792
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void flatMap(AccessLog value, Collector<ResponseCount> out) throws Except
out.collect(new ResponseCount(value.getStatus(), 1));
}
}).filter((FilterFunction<ResponseCount>) count -> {
return !count.response.isEmpty();
return !count.response.equals("500");
}).keyBy("response")
.timeWindow(Time.seconds(Constants.ALERT_WINDOW), Time.seconds(Constants.ALERT_INTERVAL))
.sum("count");
Expand All @@ -107,8 +107,7 @@ public void flatMap(AccessLog value, Collector<ResponseCount> out) throws Except
.where(new SimpleCondition<ResponseCount>() {
@Override
public boolean filter(ResponseCount value) throws Exception {
return value.count >= Constants.ALERT_THRESHOLD &&
value.response.equals("500");
return value.count >= Constants.ALERT_THRESHOLD;
}
});

Expand Down

0 comments on commit 27e0792

Please sign in to comment.