Justice-love opened a new issue #3003: is it Ok for alarm structure in cluster mode URL: https://github.com/apache/skywalking/issues/3003 Please answer these questions before submitting your issue. - Why do you submit this issue? - [x] Question or discussion - [ ] Bug - [ ] Requirement - [ ] Feature or performance improvement ___ ### Question - What do you want to know? use java schedule to design alarm plugin whether face some problem in cluster mode? or I don't understand the whole architecture ```java public void start(List<AlarmCallback> allCallbacks) { LocalDateTime now = LocalDateTime.now(); lastExecuteTime = now; Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> { try { List<AlarmMessage> alarmMessageList = new ArrayList<>(30); LocalDateTime checkTime = LocalDateTime.now(); int minutes = Minutes.minutesBetween(lastExecuteTime, checkTime).getMinutes(); boolean[] hasExecute = new boolean[] {false}; runningContext.values().forEach(ruleList -> ruleList.forEach(runningRule -> { if (minutes > 0) { runningRule.moveTo(checkTime); /** * Don't run in the first quarter per min, avoid to trigger false alarm. */ if (checkTime.getSecondOfMinute() > 15) { hasExecute[0] = true; alarmMessageList.addAll(runningRule.check()); } } })); // Set the last execute time, and make sure the second is `00`, such as: 18:30:00 if (hasExecute[0]) { lastExecuteTime = checkTime.minusSeconds(checkTime.getSecondOfMinute()); } if (alarmMessageList.size() > 0) { allCallbacks.forEach(callback -> callback.doAlarm(alarmMessageList)); } } catch (Exception e) { logger.error(e.getMessage(), e); } }, 10, 10, TimeUnit.SECONDS); } ``` ___ ### Bug - Which version of SkyWalking, OS and JRE? - Which company or project? - What happen? If possible, provide a way for reproducing the error. e.g. demo application, component version. ___ ### Requirement or improvement - Please describe about your requirements or improvement suggestions.
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
