wankai123 commented on code in PR #11137:
URL: https://github.com/apache/skywalking/pull/11137#discussion_r1275681114


##########
oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/webhook/WebhookCallback.java:
##########
@@ -39,13 +41,24 @@ public class WebhookCallback extends HttpAlarmCallback {
     private final Gson gson = new Gson();
 
     @Override
-    public void doAlarm(List<AlarmMessage> alarmMessage) throws IOException, 
InterruptedException {
-        if (alarmRulesWatcher.getWebHooks().isEmpty()) {
+    public void doAlarm(List<AlarmMessage> alarmMessages) throws IOException, 
InterruptedException {
+        Map<String, WebhookSettings> settingsMap = 
alarmRulesWatcher.getWebHooks();
+        if (settingsMap == null || settingsMap.isEmpty()) {
             return;
         }
 
-        for (String url : alarmRulesWatcher.getWebHooks()) {
-            post(URI.create(url), gson.toJson(alarmMessage), Map.of());
+        Map<String, List<AlarmMessage>> groupedMessages = 
groupMessagesByHook(alarmMessages);
+        for (Map.Entry<String, List<AlarmMessage>> entry : 
groupedMessages.entrySet()) {
+            var hookName = entry.getKey();
+            var messages = entry.getValue();
+            var setting = settingsMap.get(hookName);

Review Comment:
   The full name is `{hookType}.{hookName}`,  define and get from 
`AlarmHookSettings.java`



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to