diff --git a/README.md b/README.md index d9874c01f..c24f90806 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ The core features are following. - Alarm - + SkyWalking supports to collect telemetry (traces and metrics) data from multiple sources and multiple formats, @@ -94,10 +94,20 @@ Follow this [document](docs/en/guides/How-to-build.md). A wide variety of companies and organizations use SkyWalking for research, production and commercial product. Here is the **User Wall** of SkyWalking. - + Users are encouraged to add themselves to the [PoweredBy](docs/powered-by.md) page. +# Landscapes + +

+

+   +

+SkyWalking enriches the CNCF CLOUD NATIVE Landscape. + +

+


Our project enriches the OpenAPM Landscape! diff --git a/docs/en/guides/storage-extention.md b/docs/en/guides/storage-extention.md index a88e34b3d..d52100cd0 100644 --- a/docs/en/guides/storage-extention.md +++ b/docs/en/guides/storage-extention.md @@ -34,4 +34,8 @@ In `public void prepare()`, use `this#registerServiceImplementation` method to d ## Example Take `org.apache.skywalking.oap.server.storage.plugin.elasticsearch.StorageModuleElasticsearchProvider` -or `org.apache.skywalking.oap.server.storage.plugin.jdbc.mysql.MySQLStorageProvider` as a good example. \ No newline at end of file +or `org.apache.skywalking.oap.server.storage.plugin.jdbc.mysql.MySQLStorageProvider` as a good example. + +## Redistribution with new storage implementation. +You don't have to clone the main repo just for implementing the storage. You could just easy depend our Apache releases. +Take a look at [OpenSkywalking/SkyWalking-With-Es5x-Storage](https://github.com/OpenSkywalking/SkyWalking-With-Es5x-Storage) repo, SkyWalking v6 redistribution with ElasticSearch 5 TCP connection storage implemention. \ No newline at end of file diff --git a/docs/en/setup/backend/backend-alarm.md b/docs/en/setup/backend/backend-alarm.md index c4ff6f57c..aa22b9f6f 100644 --- a/docs/en/setup/backend/backend-alarm.md +++ b/docs/en/setup/backend/backend-alarm.md @@ -49,9 +49,18 @@ rules: count: 4 ``` +## Default alarm rules +We provided a default `alarm-setting.yml` in our distribution only for convenience, which including following rules +1. Service average response time over 1s in last 3 minutes. +1. Service success rate lower than 80% in last 2 minutes. +1. Service 90% response time is lower than 1000ms in last 3 minutes +1. Service Instance average response time over 1s in last 2 minutes. +1. Endpoint average response time over 1s in last 2 minutes. + + ## List of all potential metric name The metric names are defined in official [OAL scripts](../../guides/backend-oal-scripts.md), right now -only metric from **Service** scope could be used in Alarm, we will extend in further versions. +metric from **Service**, **Service Instance**, **Endpoint** scopes could be used in Alarm, we will extend in further versions. Submit issue or pull request if you want to support any other scope in alarm. diff --git a/docs/en/setup/backend/backend-storage.md b/docs/en/setup/backend/backend-storage.md index fd07e202f..cad061354 100644 --- a/docs/en/setup/backend/backend-storage.md +++ b/docs/en/setup/backend/backend-storage.md @@ -2,10 +2,15 @@ SkyWalking storage is pluggable, we have provided the following storage solutions, you could easily use is by changing the `application.yml` -- [**H2**](#h2) -- [**ElasticSearch 6**](#elasticsearch-6) -- [**MySQL**](#mysql) -- [**TiDB**](#tidb) +Native supported storage +- H2 +- ElasticSearch 6 +- MySQL +- TiDB + +Redistribution version with supported storage. +- ElasticSearch 5 + ## H2 Active H2 as storage, set storage provider to **H2** In-Memory Databases. Default in distribution package. @@ -24,7 +29,7 @@ storage: ## ElasticSearch 6 Active ElasticSearch 6 as storage, set storage provider to **elasticsearch**. -> Required ElasticSearch 6.3.0 or higher. +**Required ElasticSearch 6.3.0 or higher. HTTP RestHighLevelClient is used to connect server.** Setting fragment example @@ -71,6 +76,10 @@ storage: All connection related settings including link url, username and password are in `datasource-settings.properties`. And these settings can refer to the configuration of *MySQL* above. +## ElasticSearch 5 +ElasticSearch 5 is incompatible with ElasticSearch 6 Java client jar, so it could not be included in native distribution. +[OpenSkywalking/SkyWalking-With-Es5x-Storage](https://github.com/OpenSkywalking/SkyWalking-With-Es5x-Storage) repo includes the distribution version. + ## More storage solution extension Follow [Storage extension development guide](../../guides/storage-extention.md) in [Project Extensions document](../../guides/README.md#project-extensions) in development guide. 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 e76591db5..b43e18cff 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 @@ -69,21 +69,25 @@ public class AlarmCore { Executors.newSingleThreadScheduledExecutor().scheduleAtFixedRate(() -> { try { List alarmMessageList = new ArrayList<>(30); + LocalDateTime checkTime = LocalDateTime.now(); + int minutes = Minutes.minutesBetween(lastExecuteTime, checkTime).getMinutes(); + boolean[] hasExecute = new boolean[] {false}; runningContext.values().forEach(ruleList -> ruleList.forEach(runningRule -> { - LocalDateTime checkTime = LocalDateTime.now(); - int minutes = Minutes.minutesBetween(lastExecuteTime, checkTime).getMinutes(); 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) { alarmMessageList.addAll(runningRule.check()); - // Set the last execute time, and make sure the second is `00`, such as: 18:30:00 - lastExecuteTime = checkTime.minusSeconds(checkTime.getSecondOfMinute()); } } })); + // Set the last execute time, and make sure the second is `00`, such as: 18:30:00 + if (hasExecute[0]) { + lastExecuteTime = checkTime.minusSeconds(checkTime.getSecondOfMinute()); + } if (alarmMessageList.size() > 0) { allCallbacks.forEach(callback -> callback.doAlarm(alarmMessageList)); 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 1d4aacc51..408f9eedc 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 @@ -38,6 +38,10 @@ public class NotifyHandler implements IndicatorNotify { switch (meta.getScope()) { case Service: break; + case ServiceInstance: + break; + case Endpoint: + break; default: return; } diff --git a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java index a010392fa..dd0659d5b 100644 --- a/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java +++ b/oap-server/server-alarm-plugin/src/main/java/org/apache/skywalking/oap/server/core/alarm/provider/RunningRule.java @@ -118,14 +118,9 @@ public class RunningRule { Window window = windows.get(meta); if (window == null) { window = new Window(period); - Window ifAbsent = windows.putIfAbsent(meta, window); - if (ifAbsent == null) { - LocalDateTime timebucket = TIME_BUCKET_FORMATTER.parseLocalDateTime(indicator.getTimeBucket() + ""); - window.moveTo(timebucket); - } else { - window = windows.get(meta); - } - + LocalDateTime timebucket = TIME_BUCKET_FORMATTER.parseLocalDateTime(indicator.getTimeBucket() + ""); + window.moveTo(timebucket); + windows.put(meta, window); } window.add(indicator); 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 3992841d7..b2d0e4114 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 @@ -21,7 +21,11 @@ package org.apache.skywalking.oap.server.core.alarm; import java.util.concurrent.locks.ReentrantLock; import org.apache.skywalking.oap.server.core.CoreModule; import org.apache.skywalking.oap.server.core.analysis.indicator.Indicator; +import org.apache.skywalking.oap.server.core.cache.EndpointInventoryCache; +import org.apache.skywalking.oap.server.core.cache.ServiceInstanceInventoryCache; import org.apache.skywalking.oap.server.core.cache.ServiceInventoryCache; +import org.apache.skywalking.oap.server.core.register.EndpointInventory; +import org.apache.skywalking.oap.server.core.register.ServiceInstanceInventory; import org.apache.skywalking.oap.server.core.register.ServiceInventory; import org.apache.skywalking.oap.server.library.module.ModuleManager; @@ -31,6 +35,8 @@ import org.apache.skywalking.oap.server.library.module.ModuleManager; public class AlarmEntrance { private ModuleManager moduleManager; private ServiceInventoryCache serviceInventoryCache; + private ServiceInstanceInventoryCache serviceInstanceInventoryCache; + private EndpointInventoryCache endpointInventoryCache; private IndicatorNotify indicatorNotify; private ReentrantLock initLock; @@ -48,7 +54,7 @@ public class AlarmEntrance { AlarmMeta alarmMeta = ((AlarmSupported)indicator).getAlarmMeta(); - MetaInAlarm metaInAlarm = null; + MetaInAlarm metaInAlarm; switch (alarmMeta.getScope()) { case Service: int serviceId = Integer.parseInt(alarmMeta.getId()); @@ -59,6 +65,30 @@ public class AlarmEntrance { serviceMetaInAlarm.setName(serviceInventory.getName()); metaInAlarm = serviceMetaInAlarm; break; + case ServiceInstance: + int serviceInstanceId = Integer.parseInt(alarmMeta.getId()); + ServiceInstanceInventory serviceInstanceInventory = serviceInstanceInventoryCache.get(serviceInstanceId); + ServiceInstanceMetaInAlarm instanceMetaInAlarm = new ServiceInstanceMetaInAlarm(); + instanceMetaInAlarm.setIndicatorName(alarmMeta.getIndicatorName()); + instanceMetaInAlarm.setId(serviceInstanceId); + instanceMetaInAlarm.setName(serviceInstanceInventory.getName()); + metaInAlarm = instanceMetaInAlarm; + break; + case Endpoint: + int endpointId = Integer.parseInt(alarmMeta.getId()); + EndpointInventory endpointInventory = endpointInventoryCache.get(endpointId); + EndpointMetaInAlarm endpointMetaInAlarm = new EndpointMetaInAlarm(); + endpointMetaInAlarm.setIndicatorName(alarmMeta.getIndicatorName()); + endpointMetaInAlarm.setId(endpointId); + + serviceId = endpointInventory.getServiceId(); + serviceInventory = serviceInventoryCache.get(serviceId); + + String textName = endpointInventory.getName() + " in " + serviceInventory.getName(); + + endpointMetaInAlarm.setName(textName); + metaInAlarm = endpointMetaInAlarm; + break; default: return; } @@ -72,6 +102,8 @@ public class AlarmEntrance { try { if (serviceInventoryCache == null) { serviceInventoryCache = moduleManager.find(CoreModule.NAME).provider().getService(ServiceInventoryCache.class); + 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()); } diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java new file mode 100644 index 000000000..10b859fdc --- /dev/null +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/EndpointMetaInAlarm.java @@ -0,0 +1,47 @@ +/* + * 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. + * + */ + +package org.apache.skywalking.oap.server.core.alarm; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; +import org.apache.skywalking.oap.server.core.source.Scope; + +@Getter(AccessLevel.PUBLIC) +@Setter(AccessLevel.PUBLIC) +public class EndpointMetaInAlarm extends MetaInAlarm { + private String indicatorName; + + private int id; + private String name; + private String[] tags; + private String[] properties; + + @Override public Scope getScope() { + return Scope.Endpoint; + } + + @Override public int getId0() { + return id; + } + + @Override public int getId1() { + return 0; + } +} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java new file mode 100644 index 000000000..4c8862ae0 --- /dev/null +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/alarm/ServiceInstanceMetaInAlarm.java @@ -0,0 +1,47 @@ +/* + * 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. + * + */ + +package org.apache.skywalking.oap.server.core.alarm; + +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; +import org.apache.skywalking.oap.server.core.source.Scope; + +@Getter(AccessLevel.PUBLIC) +@Setter(AccessLevel.PUBLIC) +public class ServiceInstanceMetaInAlarm extends MetaInAlarm { + private String indicatorName; + + private int id; + private String name; + private String[] tags; + private String[] properties; + + @Override public Scope getScope() { + return Scope.ServiceInstance; + } + + @Override public int getId0() { + return id; + } + + @Override public int getId1() { + return 0; + } +} diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceDispatcher.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceDispatcher.java index 91b32f533..00d8ab8c3 100644 --- a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceDispatcher.java +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceDispatcher.java @@ -30,10 +30,21 @@ import org.apache.skywalking.oap.server.core.source.*; public class ServiceInstanceDispatcher implements SourceDispatcher { @Override public void dispatch(ServiceInstance source) { + doServiceInstanceSla(source); doServiceInstanceRespTime(source); doServiceInstanceCpm(source); } + private void doServiceInstanceSla(ServiceInstance source) { + ServiceInstanceSlaIndicator indicator = new ServiceInstanceSlaIndicator(); + + + indicator.setTimeBucket(source.getTimeBucket()); + indicator.setEntityId(source.getEntityId()); + indicator.setServiceId(source.getServiceId()); + indicator.combine(new org.apache.skywalking.oap.server.core.analysis.indicator.expression.EqualMatch(), source.isStatus(), true); + IndicatorProcess.INSTANCE.in(indicator); + } private void doServiceInstanceRespTime(ServiceInstance source) { ServiceInstanceRespTimeIndicator indicator = new ServiceInstanceRespTimeIndicator(); diff --git a/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceSlaIndicator.java b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceSlaIndicator.java new file mode 100644 index 000000000..4f0e6f944 --- /dev/null +++ b/oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/analysis/generated/serviceinstance/ServiceInstanceSlaIndicator.java @@ -0,0 +1,177 @@ +/* + * 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. + * + */ + +package org.apache.skywalking.oap.server.core.analysis.generated.serviceinstance; + +import java.util.*; +import lombok.*; +import org.apache.skywalking.oap.server.core.Const; +import org.apache.skywalking.oap.server.core.alarm.AlarmMeta; +import org.apache.skywalking.oap.server.core.alarm.AlarmSupported; +import org.apache.skywalking.oap.server.core.analysis.indicator.*; +import org.apache.skywalking.oap.server.core.analysis.indicator.annotation.IndicatorType; +import org.apache.skywalking.oap.server.core.remote.annotation.StreamData; +import org.apache.skywalking.oap.server.core.remote.grpc.proto.RemoteData; +import org.apache.skywalking.oap.server.core.storage.annotation.*; +import org.apache.skywalking.oap.server.core.storage.StorageBuilder; +import org.apache.skywalking.oap.server.core.source.Scope; + +/** + * This class is auto generated. Please don't change this class manually. + * + * @author Observability Analysis Language code generator + */ +@IndicatorType +@StreamData +@StorageEntity(name = "service_instance_sla", builder = ServiceInstanceSlaIndicator.Builder.class, source = Scope.ServiceInstance) +public class ServiceInstanceSlaIndicator extends PercentIndicator implements AlarmSupported { + + @Setter @Getter @Column(columnName = "entity_id") @IDColumn private java.lang.String entityId; + @Setter @Getter @Column(columnName = "service_id") private int serviceId; + + @Override public String id() { + String splitJointId = String.valueOf(getTimeBucket()); + splitJointId += Const.ID_SPLIT + entityId; + return splitJointId; + } + + @Override public int hashCode() { + int result = 17; + result = 31 * result + entityId.hashCode(); + result = 31 * result + (int)getTimeBucket(); + return result; + } + + @Override public int remoteHashCode() { + int result = 17; + result = 31 * result + entityId.hashCode(); + return result; + } + + @Override public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + ServiceInstanceSlaIndicator indicator = (ServiceInstanceSlaIndicator)obj; + if (!entityId.equals(indicator.entityId)) + return false; + + if (getTimeBucket() != indicator.getTimeBucket()) + return false; + + return true; + } + + @Override public RemoteData.Builder serialize() { + RemoteData.Builder remoteBuilder = RemoteData.newBuilder(); + remoteBuilder.addDataStrings(getEntityId()); + + remoteBuilder.addDataLongs(getTotal()); + remoteBuilder.addDataLongs(getMatch()); + remoteBuilder.addDataLongs(getTimeBucket()); + + + remoteBuilder.addDataIntegers(getServiceId()); + remoteBuilder.addDataIntegers(getPercentage()); + + return remoteBuilder; + } + + @Override public void deserialize(RemoteData remoteData) { + setEntityId(remoteData.getDataStrings(0)); + + setTotal(remoteData.getDataLongs(0)); + setMatch(remoteData.getDataLongs(1)); + setTimeBucket(remoteData.getDataLongs(2)); + + + setServiceId(remoteData.getDataIntegers(0)); + setPercentage(remoteData.getDataIntegers(1)); + + + } + + @Override public AlarmMeta getAlarmMeta() { + return new AlarmMeta("service_instance_sla", Scope.ServiceInstance, entityId); + } + + @Override + public Indicator toHour() { + ServiceInstanceSlaIndicator indicator = new ServiceInstanceSlaIndicator(); + indicator.setEntityId(this.getEntityId()); + indicator.setServiceId(this.getServiceId()); + indicator.setTotal(this.getTotal()); + indicator.setPercentage(this.getPercentage()); + indicator.setMatch(this.getMatch()); + indicator.setTimeBucket(toTimeBucketInHour()); + return indicator; + } + + @Override + public Indicator toDay() { + ServiceInstanceSlaIndicator indicator = new ServiceInstanceSlaIndicator(); + indicator.setEntityId(this.getEntityId()); + indicator.setServiceId(this.getServiceId()); + indicator.setTotal(this.getTotal()); + indicator.setPercentage(this.getPercentage()); + indicator.setMatch(this.getMatch()); + indicator.setTimeBucket(toTimeBucketInDay()); + return indicator; + } + + @Override + public Indicator toMonth() { + ServiceInstanceSlaIndicator indicator = new ServiceInstanceSlaIndicator(); + indicator.setEntityId(this.getEntityId()); + indicator.setServiceId(this.getServiceId()); + indicator.setTotal(this.getTotal()); + indicator.setPercentage(this.getPercentage()); + indicator.setMatch(this.getMatch()); + indicator.setTimeBucket(toTimeBucketInMonth()); + return indicator; + } + + public static class Builder implements StorageBuilder { + + @Override public Map data2Map(ServiceInstanceSlaIndicator storageData) { + Map map = new HashMap<>(); + map.put("entity_id", storageData.getEntityId()); + map.put("service_id", storageData.getServiceId()); + map.put("total", storageData.getTotal()); + map.put("percentage", storageData.getPercentage()); + map.put("match", storageData.getMatch()); + map.put("time_bucket", storageData.getTimeBucket()); + return map; + } + + @Override public ServiceInstanceSlaIndicator map2Data(Map dbMap) { + ServiceInstanceSlaIndicator indicator = new ServiceInstanceSlaIndicator(); + indicator.setEntityId((String)dbMap.get("entity_id")); + indicator.setServiceId(((Number)dbMap.get("service_id")).intValue()); + indicator.setTotal(((Number)dbMap.get("total")).longValue()); + indicator.setPercentage(((Number)dbMap.get("percentage")).intValue()); + indicator.setMatch(((Number)dbMap.get("match")).longValue()); + indicator.setTimeBucket(((Number)dbMap.get("time_bucket")).longValue()); + return indicator; + } + } +} diff --git a/oap-server/server-core/src/main/resources/official_analysis.oal b/oap-server/server-core/src/main/resources/official_analysis.oal index be86d50fc..c38865bf4 100644 --- a/oap-server/server-core/src/main/resources/official_analysis.oal +++ b/oap-server/server-core/src/main/resources/official_analysis.oal @@ -43,6 +43,7 @@ service_relation_client_resp_time = from(ServiceRelation.latency).filter(detectP service_relation_server_resp_time = from(ServiceRelation.latency).filter(detectPoint == DetectPoint.SERVER).longAvg(); // Service Instance Scope metric +service_instance_sla = from(ServiceInstance.*).percent(status == true); service_instance_resp_time= from(ServiceInstance.latency).longAvg(); service_instance_cpm = from(ServiceInstance.*).cpm(); 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 5b839fb67..9ee76e2fe 100644 --- a/oap-server/server-starter/src/main/assembly/alarm-settings.yml +++ b/oap-server/server-starter/src/main/assembly/alarm-settings.yml @@ -24,28 +24,44 @@ rules: period: 10 count: 3 silence-period: 5 - message: Response time of service {name} is more than 2000ms. + 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: 80 + 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% + 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_sla + indicator-name: service_p90 op: ">" threshold: 1000 period: 10 count: 3 silence-period: 5 - message: 90% response time of service {name} is lower than 80% + 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. + 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-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java index ebec15fa1..3057dcf92 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/NetworkAddressInventoryCacheEsDAO.java @@ -19,7 +19,7 @@ package org.apache.skywalking.oap.server.storage.plugin.elasticsearch.cache; import org.apache.skywalking.oap.server.core.Const; -import org.apache.skywalking.oap.server.core.register.*; +import org.apache.skywalking.oap.server.core.register.NetworkAddressInventory; import org.apache.skywalking.oap.server.core.storage.cache.INetworkAddressInventoryCacheDAO; import org.apache.skywalking.oap.server.library.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.oap.server.storage.plugin.elasticsearch.base.EsDAO; @@ -52,8 +52,8 @@ public class NetworkAddressInventoryCacheEsDAO extends EsDAO implements INetwork } else { return Const.NONE; } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); return Const.NONE; } } @@ -71,8 +71,8 @@ public class NetworkAddressInventoryCacheEsDAO extends EsDAO implements INetwork } else { return null; } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); return null; } } diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java index 3abc5fbe8..fa1ae8782 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInstanceInventoryCacheDAO.java @@ -56,8 +56,8 @@ public class ServiceInstanceInventoryCacheDAO extends EsDAO implements IServiceI } else { return null; } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); return null; } } @@ -80,8 +80,8 @@ public class ServiceInstanceInventoryCacheDAO extends EsDAO implements IServiceI } else { return Const.NONE; } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); return Const.NONE; } } diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java index e7e1ada27..50427a345 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/cache/ServiceInventoryCacheEsDAO.java @@ -63,8 +63,8 @@ public class ServiceInventoryCacheEsDAO extends EsDAO implements IServiceInvento } else { return Const.NONE; } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); return Const.NONE; } } @@ -82,8 +82,8 @@ public class ServiceInventoryCacheEsDAO extends EsDAO implements IServiceInvento } else { return null; } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); return null; } } @@ -96,7 +96,7 @@ public class ServiceInventoryCacheEsDAO extends EsDAO implements IServiceInvento BoolQueryBuilder boolQuery = QueryBuilders.boolQuery(); boolQuery.must().add(QueryBuilders.termQuery(ServiceInventory.IS_ADDRESS, BooleanUtils.TRUE)); - boolQuery.must().add(QueryBuilders.rangeQuery(ServiceInventory.MAPPING_LAST_UPDATE_TIME).gte(System.currentTimeMillis() - 10000)); + boolQuery.must().add(QueryBuilders.rangeQuery(ServiceInventory.MAPPING_LAST_UPDATE_TIME).gte(System.currentTimeMillis() - 30 * 60 * 1000)); searchSourceBuilder.query(boolQuery); searchSourceBuilder.size(50); @@ -106,8 +106,8 @@ public class ServiceInventoryCacheEsDAO extends EsDAO implements IServiceInvento for (SearchHit searchHit : response.getHits().getHits()) { serviceInventories.add(this.builder.map2Data(searchHit.getSourceAsMap())); } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); } return serviceInventories; diff --git a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockDAOImpl.java b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockDAOImpl.java index cf59d0010..d76c650b0 100644 --- a/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockDAOImpl.java +++ b/oap-server/server-storage-plugin/storage-elasticsearch-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/elasticsearch/lock/RegisterLockDAOImpl.java @@ -89,7 +89,7 @@ public class RegisterLockDAOImpl extends EsDAO implements IRegisterLockDAO { getClient().forceUpdate(RegisterLockIndex.NAME, id, source); } catch (Throwable t) { - logger.error("Release lock failure."); + logger.error("Release lock failure.", t); } } } 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 20da50056..a9b53a6ea 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,17 +19,13 @@ package org.apache.skywalking.oap.server.storage.plugin.jdbc.h2.dao; import java.io.IOException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.List; +import java.sql.*; +import java.util.*; 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.Logger; -import org.slf4j.LoggerFactory; +import org.slf4j.*; /** * @author wusheng @@ -71,7 +67,7 @@ public class H2ServiceInventoryCacheDAO extends H2SQLExecutor implements IServic sql.append(" and ").append(ServiceInventory.MAPPING_LAST_UPDATE_TIME).append(">?"); try (Connection connection = h2Client.getConnection()) { - try (ResultSet resultSet = h2Client.executeQuery(connection, sql.toString(), BooleanUtils.TRUE, System.currentTimeMillis() - 10000)) { + 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()); if (serviceInventory != null) { @@ -82,8 +78,8 @@ public class H2ServiceInventoryCacheDAO extends H2SQLExecutor implements IServic } catch (SQLException e) { throw new IOException(e); } - } catch (Throwable e) { - logger.error(e.getMessage()); + } catch (Throwable t) { + logger.error(t.getMessage(), t); } return serviceInventories; } diff --git a/skywalking-ui b/skywalking-ui index 26f2c3b7b..f18784eec 160000 --- a/skywalking-ui +++ b/skywalking-ui @@ -1 +1 @@ -Subproject commit 26f2c3b7bd93aa71897e842d90d272ee4cb618dc +Subproject commit f18784eecbf2ad29c6836b18e57cc3f5f9ac1d4f