Skip to content

Commit

Permalink
Renaming method back to sustain plugin api backwards compatibility.
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisoelkers committed May 6, 2015
1 parent bc83b85 commit 516f522
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Expand Up @@ -45,7 +45,7 @@ public interface AlertCondition {


Map<String, Object> getParameters(); Map<String, Object> getParameters();


Integer getBacklogSize(); Integer getBacklog();


int getGrace(); int getGrace();


Expand Down
Expand Up @@ -62,7 +62,7 @@ public void call(Stream stream, AlertCondition.CheckResult result) {
AlertCondition alertCondition = result.getTriggeredCondition(); AlertCondition alertCondition = result.getTriggeredCondition();
if (stream.getAlertReceivers().size() > 0) { if (stream.getAlertReceivers().size() > 0) {
try { try {
if (alertCondition.getBacklogSize() > 0 && result.getMatchingMessages() != null) { if (alertCondition.getBacklog() > 0 && result.getMatchingMessages() != null) {
alertSender.sendEmails(stream, result, getAlarmBacklog(result)); alertSender.sendEmails(stream, result, getAlarmBacklog(result));
} else { } else {
alertSender.sendEmails(stream, result); alertSender.sendEmails(stream, result);
Expand Down Expand Up @@ -98,7 +98,7 @@ public void call(Stream stream, AlertCondition.CheckResult result) {
protected List<Message> getAlarmBacklog(AlertCondition.CheckResult result) { protected List<Message> getAlarmBacklog(AlertCondition.CheckResult result) {
final AlertCondition alertCondition = result.getTriggeredCondition(); final AlertCondition alertCondition = result.getTriggeredCondition();
final List<MessageSummary> backlogSummaries = result.getMatchingMessages() final List<MessageSummary> backlogSummaries = result.getMatchingMessages()
.subList(0, Math.min(alertCondition.getBacklogSize(), result.getMatchingMessages().size())); .subList(0, Math.min(alertCondition.getBacklog(), result.getMatchingMessages().size()));
final List<Message> backlog = Lists.newArrayList(); final List<Message> backlog = Lists.newArrayList();


for (MessageSummary messageSummary : backlogSummaries) { for (MessageSummary messageSummary : backlogSummaries) {
Expand Down
Expand Up @@ -106,7 +106,7 @@ public Map<String, Object> getParameters() {
} }


@Override @Override
public Integer getBacklogSize() { public Integer getBacklog() {
final Object rawParameter = getParameters().get("backlog"); final Object rawParameter = getParameters().get("backlog");
if (rawParameter != null && rawParameter instanceof Number) { if (rawParameter != null && rawParameter instanceof Number) {
return (Integer) rawParameter; return (Integer) rawParameter;
Expand Down
Expand Up @@ -146,7 +146,7 @@ protected CheckResult runCheck() {
+ thresholdType + " than " + decimalFormat.format(threshold) + ". " + thresholdType + " than " + decimalFormat.format(threshold) + ". "
+ "(Current grace time: " + grace + " minutes)"; + "(Current grace time: " + grace + " minutes)";


if (getBacklogSize() > 0) { if (getBacklog() > 0) {
for (ResultMessage resultMessage : fieldStatsResult.getSearchHits()) { for (ResultMessage resultMessage : fieldStatsResult.getSearchHits()) {
final Message msg = new Message(resultMessage.getMessage()); final Message msg = new Message(resultMessage.getMessage());
summaries.add(new MessageSummary(resultMessage.getIndex(), msg)); summaries.add(new MessageSummary(resultMessage.getIndex(), msg));
Expand Down
Expand Up @@ -99,8 +99,8 @@ protected CheckResult runCheck() {


if (triggered) { if (triggered) {
final List<MessageSummary> summaries = Lists.newArrayList(); final List<MessageSummary> summaries = Lists.newArrayList();
if (getBacklogSize() > 0) { if (getBacklog() > 0) {
final SearchResult backlogResult = searches.search("*", filter, new RelativeRange(time * 60), getBacklogSize(), 0, new Sorting("timestamp", Sorting.Direction.DESC)); final SearchResult backlogResult = searches.search("*", filter, new RelativeRange(time * 60), getBacklog(), 0, new Sorting("timestamp", Sorting.Direction.DESC));
for (ResultMessage resultMessage : backlogResult.getResults()) { for (ResultMessage resultMessage : backlogResult.getResults()) {
final Message msg = new Message(resultMessage.getMessage()); final Message msg = new Message(resultMessage.getMessage());
summaries.add(new MessageSummary(resultMessage.getIndex(), msg)); summaries.add(new MessageSummary(resultMessage.getIndex(), msg));
Expand Down

0 comments on commit 516f522

Please sign in to comment.