You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by wu...@apache.org on 2018/09/04 13:41:18 UTC

[incubator-skywalking] branch master updated: v6 startup successful. (#1625)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new f75270b  v6 startup successful. (#1625)
f75270b is described below

commit f75270b43a69760280bdfdc091c7eb65818c4d91
Author: 彭勇升 pengys <80...@qq.com>
AuthorDate: Tue Sep 4 21:41:13 2018 +0800

    v6 startup successful. (#1625)
    
    * Fixed the startup failure cause by query protocol.
    
    * Fixed the bug of startup failure.
---
 .../core/alarm/provider/AlarmModuleProvider.java   | 24 +++++-------
 .../src/main/resources/alarm-settings.yml          | 44 ++++++++++++++++++++++
 2 files changed, 53 insertions(+), 15 deletions(-)

diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java
index b7533bc..3c228a5 100644
--- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java
+++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmModuleProvider.java
@@ -18,15 +18,10 @@
 
 package org.apache.skywalking.oap.server.core.alarm.provider;
 
-import java.io.FileNotFoundException;
-import java.io.Reader;
-import org.apache.skywalking.oap.server.core.alarm.AlarmModule;
-import org.apache.skywalking.oap.server.core.alarm.IndicatorNotify;
-import org.apache.skywalking.oap.server.library.module.ModuleConfig;
-import org.apache.skywalking.oap.server.library.module.ModuleDefine;
-import org.apache.skywalking.oap.server.library.module.ModuleProvider;
-import org.apache.skywalking.oap.server.library.module.ModuleStartException;
-import org.apache.skywalking.oap.server.library.module.ServiceNotProvidedException;
+import java.io.*;
+import org.apache.skywalking.oap.server.core.CoreModule;
+import org.apache.skywalking.oap.server.core.alarm.*;
+import org.apache.skywalking.oap.server.library.module.*;
 import org.apache.skywalking.oap.server.library.util.ResourceUtils;
 
 public class AlarmModuleProvider extends ModuleProvider {
@@ -43,26 +38,25 @@ public class AlarmModuleProvider extends ModuleProvider {
     }
 
     @Override public void prepare() throws ServiceNotProvidedException, ModuleStartException {
-
-    }
-
-    @Override public void start() throws ServiceNotProvidedException, ModuleStartException {
         Reader applicationReader;
         try {
             applicationReader = ResourceUtils.read("alarm-settings.yml");
         } catch (FileNotFoundException e) {
-            throw new ModuleStartException("can't load alarm-settings.yml",e);
+            throw new ModuleStartException("can't load alarm-settings.yml", e);
         }
         RulesReader reader = new RulesReader(applicationReader);
         Rules rules = reader.readRules();
         this.registerServiceImplementation(IndicatorNotify.class, new NotifyHandler(rules));
     }
 
+    @Override public void start() throws ServiceNotProvidedException, ModuleStartException {
+    }
+
     @Override public void notifyAfterCompleted() throws ServiceNotProvidedException, ModuleStartException {
 
     }
 
     @Override public String[] requiredModules() {
-        return new String[0];
+        return new String[] {CoreModule.NAME};
     }
 }
diff --git a/oap-server/server-starter/src/main/resources/alarm-settings.yml b/oap-server/server-starter/src/main/resources/alarm-settings.yml
new file mode 100644
index 0000000..5ea4ff5
--- /dev/null
+++ b/oap-server/server-starter/src/main/resources/alarm-settings.yml
@@ -0,0 +1,44 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+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
+  service_percent_rule:
+    indicator-name: service_percent
+    # [Optional] Default, match all services in this indicator
+    include-names:
+      - service_a
+      - service_b
+    threshold: 85
+    op: <
+    period: 10
+    count: 4
+
+#webhooks:
+#  - http://127.0.0.1/notify/
+#  - http://127.0.0.1/go-wechat/
+