未验证 提交 2c1d28f4 编写于 作者: J Jared Tan 提交者: GitHub

Merge branch 'master' into len

......@@ -17,28 +17,54 @@
# Sample alarm rules.
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%
service_resp_time_rule:
indicator-name: service_resp_time
# [Optional] Default, match all services in this indicator
include-names:
- dubbox-provider
- dubbox-consumer
op: ">"
threshold: 1000
period: 10
count: 3
silence-period: 5
message: Response time of service {name} is more than 1000ms in last 3 minutes.
service_sla_rule:
# Indicator value need to be long, double or int
indicator-name: service_sla
op: "<"
threshold: 8000
# 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% in last 2 minutes.
service_p90_sla_rule:
# Indicator value need to be long, double or int
indicator-name: service_p90
op: ">"
threshold: 1000
period: 10
count: 3
silence-period: 5
message: 90% response time of service {name} is lower than 1000ms in last 3 minutes
service_instance_resp_time_rule:
indicator-name: service_instance_resp_time
op: ">"
threshold: 1000
period: 10
count: 1
count: 2
silence-period: 5
message: Response time of service instance {name} is more than 1000ms in last 2 minutes.
# Active endpoint related metric alarm will cost more memory than service and service instance metric alarm.
# Because the number of endpoint is much more than service and instance.
#
# endpoint_avg_rule:
# indicator-name: endpoint_avg
# op: ">"
# threshold: 1000
# period: 10
# count: 2
# silence-period: 5
# message: Response time of endpoint {name} is more than 1000ms in last 2 minutes.
webhooks:
# - http://127.0.0.1/notify/
......
......@@ -14,7 +14,11 @@ This document helps people to compile and build the project in your maven and se
1. Run `./mvnw clean package -DskipTests`
1. All packages are in `/dist`.(.tar.gz for Linux and .zip for Windows).
### Build from Apache source codes
### Build from Apache source code release
- What is `Apache source code release`?
For each official Apache release, there is a complete and independent source code tar, which is including all source codes. You could download it from [SkyWalking Apache download page](http://skywalking.apache.org/downloads/). No git related stuff required when compiling this. Just follow these steps.
1. Prepare JDK8 and maven3
1. Run `./mvnw clean package -DskipTests`
1. All packages are in `/dist`.(.tar.gz for Linux and .zip for Windows).
......
......@@ -74,12 +74,12 @@ public class AlarmCore {
boolean[] hasExecute = new boolean[] {false};
runningContext.values().forEach(ruleList -> ruleList.forEach(runningRule -> {
if (minutes > 0) {
hasExecute[0] = true;
runningRule.moveTo(checkTime);
/**
* Don't run in the first quarter per min, avoid to trigger false alarm.
*/
if (checkTime.getSecondOfMinute() > 15) {
hasExecute[0] = true;
alarmMessageList.addAll(runningRule.check());
}
}
......
......@@ -46,7 +46,9 @@ public class AlarmModuleProvider extends ModuleProvider {
}
RulesReader reader = new RulesReader(applicationReader);
Rules rules = reader.readRules();
this.registerServiceImplementation(IndicatorNotify.class, new NotifyHandler(rules));
NotifyHandler notifyHandler = new NotifyHandler(rules);
notifyHandler.init(new AlarmStandardPersistence());
this.registerServiceImplementation(IndicatorNotify.class, notifyHandler);
}
@Override public void start() throws ServiceNotProvidedException, ModuleStartException {
......
......@@ -53,7 +53,6 @@ public class NotifyHandler implements IndicatorNotify {
runningRules.forEach(rule -> rule.in(meta, indicator));
}
@Override
public void init(AlarmCallback... callbacks) {
List<AlarmCallback> allCallbacks = new ArrayList<>();
for (AlarmCallback callback : callbacks) {
......
......@@ -105,7 +105,6 @@ public class AlarmEntrance {
serviceInstanceInventoryCache = moduleManager.find(CoreModule.NAME).provider().getService(ServiceInstanceInventoryCache.class);
endpointInventoryCache = moduleManager.find(CoreModule.NAME).provider().getService(EndpointInventoryCache.class);
indicatorNotify = moduleManager.find(AlarmModule.NAME).provider().getService(IndicatorNotify.class);
indicatorNotify.init(new AlarmStandardPersistence());
}
} finally {
initLock.unlock();
......
......@@ -33,6 +33,4 @@ import org.apache.skywalking.oap.server.library.module.Service;
*/
public interface IndicatorNotify extends Service {
void notify(MetaInAlarm indicatorName, Indicator indicator);
void init(AlarmCallback... callbacks);
}
......@@ -18,6 +18,7 @@
package org.apache.skywalking.oap.server.receiver.istio.telemetry.provider;
import com.google.common.base.Joiner;
import com.google.protobuf.Timestamp;
import io.grpc.stub.StreamObserver;
import io.istio.HandleMetricServiceGrpc;
......@@ -43,6 +44,8 @@ public class IstioTelemetryGRPCHandler extends HandleMetricServiceGrpc.HandleMet
private static final Logger logger = LoggerFactory.getLogger(IstioTelemetryGRPCHandler.class);
private static final Joiner JOINER = Joiner.on(".");
@Override public void handleMetric(IstioMetricProto.HandleMetricRequest request,
StreamObserver<ReportProto.ReportResult> responseObserver) {
if (logger.isDebugEnabled()) {
......@@ -79,8 +82,8 @@ public class IstioTelemetryGRPCHandler extends HandleMetricServiceGrpc.HandleMet
detectPoint = DetectPoint.server;
}
ServiceMeshMetric metric = ServiceMeshMetric.newBuilder().setStartTime(requestTime.toEpochMilli())
.setEndTime(responseTime.toEpochMilli()).setSourceServiceName(string(i, "sourceService"))
.setSourceServiceInstance(string(i, "sourceUID")).setDestServiceName(string(i, "destinationService"))
.setEndTime(responseTime.toEpochMilli()).setSourceServiceName(JOINER.join(string(i, "sourceService"), string(i, "sourceNamespace")))
.setSourceServiceInstance(string(i, "sourceUID")).setDestServiceName(JOINER.join(string(i, "destinationService"), string(i, "destinationNamespace")))
.setDestServiceInstance(string(i, "destinationUID")).setEndpoint(endpoint).setLatency(latency)
.setResponseCode(Math.toIntExact(responseCode)).setStatus(status).setProtocol(netProtocol).setDetectPoint(detectPoint).build();
logger.debug("Transformed metric {}", metric);
......
......@@ -54,14 +54,17 @@ rules:
count: 2
silence-period: 5
message: Response time of service instance {name} is more than 1000ms in last 2 minutes.
endpoint_avg_rule:
indicator-name: endpoint_avg
op: ">"
threshold: 1000
period: 10
count: 2
silence-period: 5
message: Response time of endpoint {name} is more than 1000ms in last 2 minutes.
# Active endpoint related metric alarm will cost more memory than service and service instance metric alarm.
# Because the number of endpoint is much more than service and instance.
#
# endpoint_avg_rule:
# indicator-name: endpoint_avg
# op: ">"
# threshold: 1000
# period: 10
# count: 2
# silence-period: 5
# message: Response time of endpoint {name} is more than 1000ms in last 2 minutes.
webhooks:
# - http://127.0.0.1/notify/
......
......@@ -74,7 +74,7 @@ public class H2SQLExecutor {
protected StorageData toStorageData(ResultSet rs, String modelName,
StorageBuilder storageBuilder) throws SQLException {
while (rs.next()) {
if (rs.next()) {
Map data = new HashMap();
List<ModelColumn> columns = TableMetaInfo.get(modelName).getColumns();
for (ModelColumn column : columns) {
......
......@@ -19,13 +19,17 @@
package org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao;
import java.io.IOException;
import java.sql.*;
import java.util.*;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import org.apache.skywalking.oap.server.core.register.ServiceInventory;
import org.apache.skywalking.oap.server.core.storage.cache.IServiceInventoryCacheDAO;
import org.apache.skywalking.oap.server.library.client.jdbc.hikaricp.JDBCHikariCPClient;
import org.apache.skywalking.oap.server.library.util.BooleanUtils;
import org.slf4j.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @author wusheng
......@@ -68,12 +72,14 @@ public class H2ServiceInventoryCacheDAO extends H2SQLExecutor implements IServic
try (Connection connection = h2Client.getConnection()) {
try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), BooleanUtils.TRUE, System.currentTimeMillis() - 30 * 60 * 1000)) {
while (resultSet.next()) {
ServiceInventory serviceInventory = (ServiceInventory)toStorageData(resultSet, ServiceInventory.MODEL_NAME, new ServiceInventory.Builder());
ServiceInventory serviceInventory;
do {
serviceInventory = (ServiceInventory)toStorageData(resultSet, ServiceInventory.MODEL_NAME, new ServiceInventory.Builder());
if (serviceInventory != null) {
serviceInventories.add(serviceInventory);
}
}
while (serviceInventory != null);
}
} catch (SQLException e) {
throw new IOException(e);
......
Subproject commit f18784eecbf2ad29c6836b18e57cc3f5f9ac1d4f
Subproject commit 9eb894dbb1514f80dac57359bc97f4d27beed99a
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册