提交 f75270b4 编写于 作者: 彭勇升 pengys 提交者: wu-sheng

v6 startup successful. (#1625)

* Fixed the startup failure cause by query protocol.

* Fixed the bug of startup failure.
上级 73679fc0
......@@ -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};
}
}
# 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/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册