diff --git a/docker/config/alarm-settings.yml b/docker/config/alarm-settings.yml index 9ea69756b..eab440737 100644 --- a/docker/config/alarm-settings.yml +++ b/docker/config/alarm-settings.yml @@ -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 - threshold: 1000 op: ">" + threshold: 1000 period: 10 - count: 1 + 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: 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/ diff --git a/docs/en/guides/How-to-build.md b/docs/en/guides/How-to-build.md index 25059cedb..3e516bf0b 100644 --- a/docs/en/guides/How-to-build.md +++ b/docs/en/guides/How-to-build.md @@ -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). diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java index b43e18cff..a0a735ca5 100644 --- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java +++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/AlarmCore.java @@ -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()); } } 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 3c228a52a..f536caa0e 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 @@ -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 { diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java index 408f9eedc..b0cb6655b 100644 --- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java +++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/NotifyHandler.java @@ -53,7 +53,6 @@ public class NotifyHandler implements IndicatorNotify { runningRules.forEach(rule -> rule.in(meta, indicator)); } - @Override public void init(AlarmCallback... callbacks) { List allCallbacks = new ArrayList<>(); for (AlarmCallback callback : callbacks) { diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java index b2d0e4114..207ec3e0e 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/AlarmEntrance.java @@ -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(); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/IndicatorNotify.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/IndicatorNotify.java index d146ab2bb..4d05622a0 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/IndicatorNotify.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/IndicatorNotify.java @@ -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); } diff --git a/oap-server/server-receiver-plugin/skywalking-istio-telemetry-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/istio/telemetry/provider/IstioTelemetryGRPCHandler.java b/oap-server/server-receiver-plugin/skywalking-istio-telemetry-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/istio/telemetry/provider/IstioTelemetryGRPCHandler.java index bd65ade96..6951e960d 100644 --- a/oap-server/server-receiver-plugin/skywalking-istio-telemetry-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/istio/telemetry/provider/IstioTelemetryGRPCHandler.java +++ b/oap-server/server-receiver-plugin/skywalking-istio-telemetry-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/istio/telemetry/provider/IstioTelemetryGRPCHandler.java @@ -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 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); 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 9ee76e2fe..eab440737 100644 --- a/oap-server/server-starter/src/main/assembly/alarm-settings.yml +++ b/oap-server/server-starter/src/main/assembly/alarm-settings.yml @@ -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/ diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2SQLExecutor.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2SQLExecutor.java index 8cd217532..6de21ddbc 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2SQLExecutor.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2SQLExecutor.java @@ -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 columns = TableMetaInfo.get(modelName).getColumns(); for (ModelColumn column : columns) { diff --git a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2ServiceInventoryCacheDAO.java b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2ServiceInventoryCacheDAO.java index a9b53a6ea..e5cecdd83 100644 --- a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2ServiceInventoryCacheDAO.java +++ b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/h2/dao/H2ServiceInventoryCacheDAO.java @@ -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); diff --git a/skywalking-ui b/skywalking-ui index f18784eec..9eb894dbb 160000 --- a/skywalking-ui +++ b/skywalking-ui @@ -1 +1 @@ -Subproject commit f18784eecbf2ad29c6836b18e57cc3f5f9ac1d4f +Subproject commit 9eb894dbb1514f80dac57359bc97f4d27beed99a