You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2018/10/28 13:13:44 UTC

[incubator-skywalking] 01/01: Set default dist alarm settings and make dist package setting files right.

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch settings
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git

commit 32b5c72ea033f23ba33008c20b38332216ceed99
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Sun Oct 28 21:13:35 2018 +0800

    Set default dist alarm settings and make dist package setting files right.
---
 .../server/core/alarm/provider/RunningRule.java    | 30 ++++++++++++---
 oap-server/server-starter/pom.xml                  |  2 +
 .../src/main/assembly/alarm-settings.yml           | 44 +++++++++++++++-------
 3 files changed, 56 insertions(+), 20 deletions(-)

diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java
index 3f8c6ea..92499a4 100644
--- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java
+++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java
@@ -18,15 +18,25 @@
 
 package org.apache.skywalking.oap.server.core.alarm.provider;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.locks.ReentrantLock;
-import org.apache.skywalking.oap.server.core.alarm.*;
-import org.apache.skywalking.oap.server.core.analysis.indicator.*;
+import org.apache.skywalking.oap.server.core.alarm.AlarmMessage;
+import org.apache.skywalking.oap.server.core.alarm.MetaInAlarm;
+import org.apache.skywalking.oap.server.core.analysis.indicator.DoubleValueHolder;
+import org.apache.skywalking.oap.server.core.analysis.indicator.Indicator;
+import org.apache.skywalking.oap.server.core.analysis.indicator.IntValueHolder;
+import org.apache.skywalking.oap.server.core.analysis.indicator.LongValueHolder;
 import org.apache.skywalking.oap.server.core.source.Scope;
-import org.joda.time.*;
-import org.joda.time.format.*;
-import org.slf4j.*;
+import org.joda.time.LocalDateTime;
+import org.joda.time.Minutes;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * RunningRule represents each rule in running status. Based on the {@link AlarmRule} definition,
@@ -81,6 +91,12 @@ public class RunningRule {
             return;
         }
 
+        if (includeNames != null) {
+            if (!includeNames.contains(meta.getName())) {
+                return;
+            }
+        }
+
         if (valueType == null) {
             if (indicator instanceof LongValueHolder) {
                 valueType = IndicatorValueType.LONG;
@@ -91,6 +107,8 @@ public class RunningRule {
             } else if (indicator instanceof DoubleValueHolder) {
                 valueType = IndicatorValueType.DOUBLE;
                 threshold.setType(IndicatorValueType.DOUBLE);
+            } else {
+                return;
             }
             targetScope = meta.getScope();
         }
diff --git a/oap-server/server-starter/pom.xml b/oap-server/server-starter/pom.xml
index 9bbe894..91bf853 100644
--- a/oap-server/server-starter/pom.xml
+++ b/oap-server/server-starter/pom.xml
@@ -136,6 +136,8 @@
                     <excludes>
                         <exclude>application.yml</exclude>
                         <exclude>log4j2.xml</exclude>
+                        <exclude>alarm-settings.yml</exclude>
+                        <exclude>component-libraries.yml</exclude>
                     </excludes>
                 </configuration>
             </plugin>
diff --git a/oap-server/server-starter/src/main/assembly/alarm-settings.yml b/oap-server/server-starter/src/main/assembly/alarm-settings.yml
index 6c69f89..5b839fb 100644
--- a/oap-server/server-starter/src/main/assembly/alarm-settings.yml
+++ b/oap-server/server-starter/src/main/assembly/alarm-settings.yml
@@ -16,20 +16,36 @@
 
 # Sample alarm rules.
 rules:
-# Sample alarm rules.
-#  # Rule unique name, must be ended with `_rule`.
-#  endpoint_percent_rule:
-#    # Indicator value need to be long, double or int
-#    indicator-name: endpoint_percent
-#    threshold: 75
-#    op: <
-#    # The length of time to evaluate the metric
-#    period: 10
-#    # How many times after the metric match the condition, will trigger alarm
-#    count: 3
-#    # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.
-#    silence-period: 10
-#    message: Successful rate of endpoint {name} is lower than 75%
+  # Rule unique name, must be ended with `_rule`.
+  service_resp_time_rule:
+    indicator-name: service_resp_time
+    op: ">"
+    threshold: 1000
+    period: 10
+    count: 3
+    silence-period: 5
+    message: Response time of service {name} is more than 2000ms.
+  service_sla_rule:
+    # Indicator value need to be long, double or int
+    indicator-name: service_sla
+    op: "<"
+    threshold: 80
+    # The length of time to evaluate the metric
+    period: 10
+    # How many times after the metric match the condition, will trigger alarm
+    count: 2
+    # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.
+    silence-period: 3
+    message: Successful rate of service {name} is lower than 80%
+  service_p90_sla_rule:
+    # Indicator value need to be long, double or int
+    indicator-name: service_sla
+    op: ">"
+    threshold: 1000
+    period: 10
+    count: 3
+    silence-period: 5
+    message: 90% response time of service {name} is lower than 80%
 
 webhooks:
 #  - http://127.0.0.1/notify/