Skip to content

Commit

Permalink
v6 startup successful. (apache#1625)
Browse files Browse the repository at this point in the history
* Fixed the startup failure cause by query protocol.

* Fixed the bug of startup failure.
  • Loading branch information
peng-yongsheng authored and wu-sheng committed Sep 4, 2018
1 parent 73679fc commit f75270b
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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};
}
}
44 changes: 44 additions & 0 deletions oap-server/server-starter/src/main/resources/alarm-settings.yml
Original file line number Diff line number Diff line change
@@ -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/

0 comments on commit f75270b

Please sign in to comment.