wu-sheng closed pull request #810: Provide the loadAlarmList query.
URL: https://github.com/apache/incubator-skywalking/pull/810
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtils.java
 
b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtils.java
index 9597231b3..3b3d64edb 100644
--- 
a/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtils.java
+++ 
b/apm-collector/apm-collector-core/src/main/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtils.java
@@ -18,8 +18,10 @@
 
 package org.apache.skywalking.apm.collector.core.util;
 
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.Date;
 
 /**
  * @author peng-yongsheng
@@ -59,6 +61,13 @@ public long getDayTimeBucket(long time) {
         return Long.valueOf(timeStr);
     }
 
+    public String formatMinuteTimeBucket(long minuteTimeBucket) throws 
ParseException {
+        SimpleDateFormat minuteDateFormat = new 
SimpleDateFormat("yyyyMMddHHmm");
+        Date date = minuteDateFormat.parse(String.valueOf(minuteTimeBucket));
+        SimpleDateFormat parsedMinuteDateFormat = new 
SimpleDateFormat("yyyy-MM-dd HH:mm");
+        return parsedMinuteDateFormat.format(date);
+    }
+
     public long minuteToHour(long minuteBucket) {
         return minuteBucket / 100;
     }
@@ -86,8 +95,4 @@ public long secondToDay(long secondBucket) {
     public long secondToMonth(long secondBucket) {
         return secondBucket / 100 / 100 / 100 / 100;
     }
-
-    public enum TimeBucketType {
-        SECOND, MINUTE, HOUR, DAY, MONTH
-    }
 }
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java
index daf060ca5..425a71614 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/StorageModule.java
@@ -105,6 +105,7 @@
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceHourMetricPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMonthMetricPersistenceDAO;
+import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationComponentUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMetricUIDAO;
@@ -112,6 +113,7 @@
 import org.apache.skywalking.apm.collector.storage.dao.ui.ICpuMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGCMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGlobalTraceUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IMemoryMetricUIDAO;
@@ -119,6 +121,7 @@
 import org.apache.skywalking.apm.collector.storage.dao.ui.INetworkAddressUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentDurationUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceNameServiceUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceReferenceMetricUIDAO;
@@ -257,6 +260,10 @@ private void addUiDAO(List<Class> classes) {
         classes.add(ISegmentDurationUIDAO.class);
         classes.add(ISegmentUIDAO.class);
         classes.add(IServiceReferenceMetricUIDAO.class);
+
+        classes.add(IApplicationAlarmUIDAO.class);
+        classes.add(IInstanceAlarmUIDAO.class);
+        classes.add(IServiceAlarmUIDAO.class);
     }
 
     private void addAlarmDAO(List<Class> classes) {
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationAlarmUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationAlarmUIDAO.java
new file mode 100644
index 000000000..bd0eaf180
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IApplicationAlarmUIDAO.java
@@ -0,0 +1,31 @@
+/*
+ * 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.apm.collector.storage.dao.ui;
+
+import java.text.ParseException;
+import org.apache.skywalking.apm.collector.storage.base.dao.DAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public interface IApplicationAlarmUIDAO extends DAO {
+
+    Alarm loadAlarmList(String keyword, long start, long end, int limit, int 
from) throws ParseException;
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceAlarmUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceAlarmUIDAO.java
new file mode 100644
index 000000000..9b219001d
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IInstanceAlarmUIDAO.java
@@ -0,0 +1,31 @@
+/*
+ * 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.apm.collector.storage.dao.ui;
+
+import java.text.ParseException;
+import org.apache.skywalking.apm.collector.storage.base.dao.DAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public interface IInstanceAlarmUIDAO extends DAO {
+
+    Alarm loadAlarmList(String keyword, long start, long end, int limit, int 
from) throws ParseException;
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IServiceAlarmUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IServiceAlarmUIDAO.java
new file mode 100644
index 000000000..750b33928
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/ui/IServiceAlarmUIDAO.java
@@ -0,0 +1,31 @@
+/*
+ * 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.apm.collector.storage.dao.ui;
+
+import java.text.ParseException;
+import org.apache.skywalking.apm.collector.storage.base.dao.DAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public interface IServiceAlarmUIDAO extends DAO {
+
+    Alarm loadAlarmList(String keyword, long start, long end, int limit, int 
from) throws ParseException;
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/Alarm.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/Alarm.java
index 001024a27..d85455458 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/Alarm.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/Alarm.java
@@ -18,6 +18,7 @@
 
 package org.apache.skywalking.apm.collector.storage.ui.alarm;
 
+import java.util.LinkedList;
 import java.util.List;
 
 /**
@@ -27,6 +28,10 @@
     private List<AlarmItem> items;
     private int total;
 
+    public Alarm() {
+        this.items = new LinkedList<>();
+    }
+
     public List<AlarmItem> getItems() {
         return items;
     }
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmItem.java
 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmItem.java
index bdd9f6ff9..073a466c6 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmItem.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmItem.java
@@ -28,4 +28,52 @@
     private String startTime;
     private AlarmType alarmType;
     private CauseType causeType;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(String startTime) {
+        this.startTime = startTime;
+    }
+
+    public AlarmType getAlarmType() {
+        return alarmType;
+    }
+
+    public void setAlarmType(AlarmType alarmType) {
+        this.alarmType = alarmType;
+    }
+
+    public CauseType getCauseType() {
+        return causeType;
+    }
+
+    public void setCauseType(CauseType causeType) {
+        this.causeType = causeType;
+    }
 }
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java
 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java
index c3dcd91f0..419069e8f 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/StorageModuleEsProvider.java
@@ -114,6 +114,7 @@
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceHourMetricPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMonthMetricPersistenceDAO;
+import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationComponentUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMetricUIDAO;
@@ -121,6 +122,7 @@
 import org.apache.skywalking.apm.collector.storage.dao.ui.ICpuMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGCMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGlobalTraceUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IMemoryMetricUIDAO;
@@ -128,6 +130,7 @@
 import org.apache.skywalking.apm.collector.storage.dao.ui.INetworkAddressUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentDurationUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceNameServiceUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceReferenceMetricUIDAO;
@@ -216,6 +219,7 @@
 import 
org.apache.skywalking.apm.collector.storage.es.dao.srmp.ServiceReferenceHourMetricEsPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.srmp.ServiceReferenceMinuteMetricEsPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.srmp.ServiceReferenceMonthMetricEsPersistenceDAO;
+import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ApplicationAlarmEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ApplicationComponentEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ApplicationMappingEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ApplicationMetricEsUIDAO;
@@ -223,6 +227,7 @@
 import org.apache.skywalking.apm.collector.storage.es.dao.ui.CpuMetricEsUIDAO;
 import org.apache.skywalking.apm.collector.storage.es.dao.ui.GCMetricEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.GlobalTraceEsUIDAO;
+import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.InstanceAlarmEsUIDAO;
 import org.apache.skywalking.apm.collector.storage.es.dao.ui.InstanceEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.InstanceMetricEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.MemoryMetricEsUIDAO;
@@ -230,6 +235,7 @@
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.NetworkAddressEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.SegmentDurationEsUIDAO;
 import org.apache.skywalking.apm.collector.storage.es.dao.ui.SegmentEsUIDAO;
+import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ServiceAlarmEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ServiceMetricEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ServiceNameServiceEsUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.es.dao.ui.ServiceReferenceEsMetricUIDAO;
@@ -420,6 +426,10 @@ private void registerUiDAO() throws 
ServiceNotProvidedException {
         this.registerServiceImplementation(ISegmentDurationUIDAO.class, new 
SegmentDurationEsUIDAO(elasticSearchClient));
         this.registerServiceImplementation(ISegmentUIDAO.class, new 
SegmentEsUIDAO(elasticSearchClient));
         this.registerServiceImplementation(IServiceReferenceMetricUIDAO.class, 
new ServiceReferenceEsMetricUIDAO(elasticSearchClient));
+
+        this.registerServiceImplementation(IApplicationAlarmUIDAO.class, new 
ApplicationAlarmEsUIDAO(elasticSearchClient));
+        this.registerServiceImplementation(IInstanceAlarmUIDAO.class, new 
InstanceAlarmEsUIDAO(elasticSearchClient));
+        this.registerServiceImplementation(IServiceAlarmUIDAO.class, new 
ServiceAlarmEsUIDAO(elasticSearchClient));
     }
 
     private void registerAlarmDAO() throws ServiceNotProvidedException {
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationAlarmEsUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationAlarmEsUIDAO.java
new file mode 100644
index 000000000..907105bf5
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ApplicationAlarmEsUIDAO.java
@@ -0,0 +1,90 @@
+/*
+ * 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.apm.collector.storage.es.dao.ui;
+
+import java.text.ParseException;
+import 
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
+import org.apache.skywalking.apm.collector.core.util.StringUtils;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
+import 
org.apache.skywalking.apm.collector.storage.table.alarm.ApplicationAlarmTable;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmItem;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmType;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.CauseType;
+import org.elasticsearch.action.search.SearchRequestBuilder;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.action.search.SearchType;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHit;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationAlarmEsUIDAO extends EsDAO implements 
IApplicationAlarmUIDAO {
+
+    public ApplicationAlarmEsUIDAO(ElasticSearchClient client) {
+        super(client);
+    }
+
+    @Override
+    public Alarm loadAlarmList(String keyword, long start, long end, int 
limit, int from) throws ParseException {
+        SearchRequestBuilder searchRequestBuilder = 
getClient().prepareSearch(ApplicationAlarmTable.TABLE);
+        searchRequestBuilder.setTypes(ApplicationAlarmTable.TABLE_TYPE);
+        searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
+
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        
boolQueryBuilder.must().add(QueryBuilders.rangeQuery(ApplicationAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(start).lte(end));
+        if (StringUtils.isNotEmpty(keyword)) {
+            
boolQueryBuilder.must().add(QueryBuilders.matchQuery(ApplicationAlarmTable.COLUMN_ALARM_CONTENT,
 keyword));
+        }
+
+        searchRequestBuilder.setQuery(boolQueryBuilder);
+        searchRequestBuilder.setSize(limit);
+        searchRequestBuilder.setFrom(from);
+
+        SearchResponse searchResponse = 
searchRequestBuilder.execute().actionGet();
+        SearchHit[] searchHits = searchResponse.getHits().getHits();
+
+        Alarm alarm = new Alarm();
+        alarm.setTotal((int)searchResponse.getHits().getTotalHits());
+        for (SearchHit searchHit : searchHits) {
+            AlarmItem alarmItem = new AlarmItem();
+            alarmItem.setId(searchHit.getId());
+            
alarmItem.setTitle((String)searchHit.getSource().get(ApplicationAlarmTable.COLUMN_ALARM_CONTENT));
+            
alarmItem.setContent((String)searchHit.getSource().get(ApplicationAlarmTable.COLUMN_ALARM_CONTENT));
+
+            long lastTimeBucket = 
((Number)searchHit.getSource().get(ApplicationAlarmTable.COLUMN_LAST_TIME_BUCKET)).longValue();
+            
alarmItem.setStartTime(TimeBucketUtils.INSTANCE.formatMinuteTimeBucket(lastTimeBucket));
+            alarmItem.setAlarmType(AlarmType.APPLICATION);
+
+            int alarmType = 
((Number)searchHit.getSource().get(ApplicationAlarmTable.COLUMN_ALARM_TYPE)).intValue();
+            if 
(org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType.SLOW_RTT.getValue()
 == alarmType) {
+                alarmItem.setCauseType(CauseType.SLOW_RESPONSE);
+            } else if 
(org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType.ERROR_RATE.getValue()
 == alarmType) {
+                alarmItem.setCauseType(CauseType.LOW_SUCCESS_RATE);
+            }
+
+            alarm.getItems().add(alarmItem);
+        }
+        return alarm;
+    }
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceAlarmEsUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceAlarmEsUIDAO.java
new file mode 100644
index 000000000..91fe1f797
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/InstanceAlarmEsUIDAO.java
@@ -0,0 +1,90 @@
+/*
+ * 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.apm.collector.storage.es.dao.ui;
+
+import java.text.ParseException;
+import 
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
+import org.apache.skywalking.apm.collector.core.util.StringUtils;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
+import 
org.apache.skywalking.apm.collector.storage.table.alarm.InstanceAlarmTable;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmItem;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmType;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.CauseType;
+import org.elasticsearch.action.search.SearchRequestBuilder;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.action.search.SearchType;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHit;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceAlarmEsUIDAO extends EsDAO implements IInstanceAlarmUIDAO 
{
+
+    public InstanceAlarmEsUIDAO(ElasticSearchClient client) {
+        super(client);
+    }
+
+    @Override
+    public Alarm loadAlarmList(String keyword, long start, long end, int 
limit, int from) throws ParseException {
+        SearchRequestBuilder searchRequestBuilder = 
getClient().prepareSearch(InstanceAlarmTable.TABLE);
+        searchRequestBuilder.setTypes(InstanceAlarmTable.TABLE_TYPE);
+        searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
+
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        
boolQueryBuilder.must().add(QueryBuilders.rangeQuery(InstanceAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(start).lte(end));
+        if (StringUtils.isNotEmpty(keyword)) {
+            
boolQueryBuilder.must().add(QueryBuilders.matchQuery(InstanceAlarmTable.COLUMN_ALARM_CONTENT,
 keyword));
+        }
+
+        searchRequestBuilder.setQuery(boolQueryBuilder);
+        searchRequestBuilder.setSize(limit);
+        searchRequestBuilder.setFrom(from);
+
+        SearchResponse searchResponse = 
searchRequestBuilder.execute().actionGet();
+        SearchHit[] searchHits = searchResponse.getHits().getHits();
+
+        Alarm alarm = new Alarm();
+        alarm.setTotal((int)searchResponse.getHits().getTotalHits());
+        for (SearchHit searchHit : searchHits) {
+            AlarmItem alarmItem = new AlarmItem();
+            alarmItem.setId(searchHit.getId());
+            
alarmItem.setTitle((String)searchHit.getSource().get(InstanceAlarmTable.COLUMN_ALARM_CONTENT));
+            
alarmItem.setContent((String)searchHit.getSource().get(InstanceAlarmTable.COLUMN_ALARM_CONTENT));
+
+            long lastTimeBucket = 
((Number)searchHit.getSource().get(InstanceAlarmTable.COLUMN_LAST_TIME_BUCKET)).longValue();
+            
alarmItem.setStartTime(TimeBucketUtils.INSTANCE.formatMinuteTimeBucket(lastTimeBucket));
+            alarmItem.setAlarmType(AlarmType.SERVER);
+
+            int alarmType = 
((Number)searchHit.getSource().get(InstanceAlarmTable.COLUMN_ALARM_TYPE)).intValue();
+            if 
(org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType.SLOW_RTT.getValue()
 == alarmType) {
+                alarmItem.setCauseType(CauseType.SLOW_RESPONSE);
+            } else if 
(org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType.ERROR_RATE.getValue()
 == alarmType) {
+                alarmItem.setCauseType(CauseType.LOW_SUCCESS_RATE);
+            }
+
+            alarm.getItems().add(alarmItem);
+        }
+        return alarm;
+    }
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ServiceAlarmEsUIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ServiceAlarmEsUIDAO.java
new file mode 100644
index 000000000..b1f85651b
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/ui/ServiceAlarmEsUIDAO.java
@@ -0,0 +1,90 @@
+/*
+ * 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.apm.collector.storage.es.dao.ui;
+
+import java.text.ParseException;
+import 
org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient;
+import org.apache.skywalking.apm.collector.core.util.StringUtils;
+import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO;
+import 
org.apache.skywalking.apm.collector.storage.table.alarm.ServiceAlarmTable;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmItem;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmType;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.CauseType;
+import org.elasticsearch.action.search.SearchRequestBuilder;
+import org.elasticsearch.action.search.SearchResponse;
+import org.elasticsearch.action.search.SearchType;
+import org.elasticsearch.index.query.BoolQueryBuilder;
+import org.elasticsearch.index.query.QueryBuilders;
+import org.elasticsearch.search.SearchHit;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceAlarmEsUIDAO extends EsDAO implements IServiceAlarmUIDAO {
+
+    public ServiceAlarmEsUIDAO(ElasticSearchClient client) {
+        super(client);
+    }
+
+    @Override
+    public Alarm loadAlarmList(String keyword, long start, long end, int 
limit, int from) throws ParseException {
+        SearchRequestBuilder searchRequestBuilder = 
getClient().prepareSearch(ServiceAlarmTable.TABLE);
+        searchRequestBuilder.setTypes(ServiceAlarmTable.TABLE_TYPE);
+        searchRequestBuilder.setSearchType(SearchType.DFS_QUERY_THEN_FETCH);
+
+        BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
+        
boolQueryBuilder.must().add(QueryBuilders.rangeQuery(ServiceAlarmTable.COLUMN_LAST_TIME_BUCKET).gte(start).lte(end));
+        if (StringUtils.isNotEmpty(keyword)) {
+            
boolQueryBuilder.must().add(QueryBuilders.matchQuery(ServiceAlarmTable.COLUMN_ALARM_CONTENT,
 keyword));
+        }
+
+        searchRequestBuilder.setQuery(boolQueryBuilder);
+        searchRequestBuilder.setSize(limit);
+        searchRequestBuilder.setFrom(from);
+
+        SearchResponse searchResponse = 
searchRequestBuilder.execute().actionGet();
+        SearchHit[] searchHits = searchResponse.getHits().getHits();
+
+        Alarm alarm = new Alarm();
+        alarm.setTotal((int)searchResponse.getHits().getTotalHits());
+        for (SearchHit searchHit : searchHits) {
+            AlarmItem alarmItem = new AlarmItem();
+            alarmItem.setId(searchHit.getId());
+            
alarmItem.setTitle((String)searchHit.getSource().get(ServiceAlarmTable.COLUMN_ALARM_CONTENT));
+            
alarmItem.setContent((String)searchHit.getSource().get(ServiceAlarmTable.COLUMN_ALARM_CONTENT));
+
+            long lastTimeBucket = 
((Number)searchHit.getSource().get(ServiceAlarmTable.COLUMN_LAST_TIME_BUCKET)).longValue();
+            
alarmItem.setStartTime(TimeBucketUtils.INSTANCE.formatMinuteTimeBucket(lastTimeBucket));
+            alarmItem.setAlarmType(AlarmType.SERVICE);
+
+            int alarmType = 
((Number)searchHit.getSource().get(ServiceAlarmTable.COLUMN_ALARM_TYPE)).intValue();
+            if 
(org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType.SLOW_RTT.getValue()
 == alarmType) {
+                alarmItem.setCauseType(CauseType.SLOW_RESPONSE);
+            } else if 
(org.apache.skywalking.apm.collector.storage.table.alarm.AlarmType.ERROR_RATE.getValue()
 == alarmType) {
+                alarmItem.setCauseType(CauseType.LOW_SUCCESS_RATE);
+            }
+
+            alarm.getItems().add(alarmItem);
+        }
+        return alarm;
+    }
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java
 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java
index da443c106..49124cdaf 100644
--- 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java
+++ 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/StorageModuleH2Provider.java
@@ -110,6 +110,7 @@
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceHourMetricPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMinuteMetricPersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.srmp.IServiceReferenceMonthMetricPersistenceDAO;
+import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationComponentUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMappingUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationMetricUIDAO;
@@ -117,6 +118,7 @@
 import org.apache.skywalking.apm.collector.storage.dao.ui.ICpuMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGCMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IGlobalTraceUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceMetricUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IMemoryMetricUIDAO;
@@ -124,6 +126,7 @@
 import org.apache.skywalking.apm.collector.storage.dao.ui.INetworkAddressUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentDurationUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.ISegmentUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO;
 import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceMetricUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceNameServiceUIDAO;
 import 
org.apache.skywalking.apm.collector.storage.dao.ui.IServiceReferenceMetricUIDAO;
@@ -212,6 +215,7 @@
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceHourMetricH2PersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceMinuteMetricH2PersistenceDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.srmp.ServiceReferenceMonthMetricH2PersistenceDAO;
+import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ApplicationAlarmH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ApplicationComponentH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ApplicationMappingH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ApplicationMetricH2UIDAO;
@@ -219,6 +223,7 @@
 import org.apache.skywalking.apm.collector.storage.h2.dao.ui.CpuMetricH2UIDAO;
 import org.apache.skywalking.apm.collector.storage.h2.dao.ui.GCMetricH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.GlobalTraceH2UIDAO;
+import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.InstanceAlarmH2UIDAO;
 import org.apache.skywalking.apm.collector.storage.h2.dao.ui.InstanceH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.InstanceMetricH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.MemoryMetricH2UIDAO;
@@ -226,6 +231,7 @@
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.NetworkAddressH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.SegmentDurationH2UIDAO;
 import org.apache.skywalking.apm.collector.storage.h2.dao.ui.SegmentH2UIDAO;
+import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ServiceAlarmH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ServiceMetricH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ServiceNameServiceH2UIDAO;
 import 
org.apache.skywalking.apm.collector.storage.h2.dao.ui.ServiceReferenceH2MetricUIDAO;
@@ -396,6 +402,10 @@ private void registerUiDAO() throws 
ServiceNotProvidedException {
         this.registerServiceImplementation(ISegmentDurationUIDAO.class, new 
SegmentDurationH2UIDAO(h2Client));
         this.registerServiceImplementation(ISegmentUIDAO.class, new 
SegmentH2UIDAO(h2Client));
         this.registerServiceImplementation(IServiceReferenceMetricUIDAO.class, 
new ServiceReferenceH2MetricUIDAO(h2Client));
+
+        this.registerServiceImplementation(IApplicationAlarmUIDAO.class, new 
ApplicationAlarmH2UIDAO(h2Client));
+        this.registerServiceImplementation(IInstanceAlarmUIDAO.class, new 
InstanceAlarmH2UIDAO(h2Client));
+        this.registerServiceImplementation(IServiceAlarmUIDAO.class, new 
ServiceAlarmH2UIDAO(h2Client));
     }
 
     private void registerAlarmDAO() throws ServiceNotProvidedException {
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationAlarmH2UIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationAlarmH2UIDAO.java
new file mode 100644
index 000000000..f224fbd0c
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ApplicationAlarmH2UIDAO.java
@@ -0,0 +1,40 @@
+/*
+ * 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.apm.collector.storage.h2.dao.ui;
+
+import java.text.ParseException;
+import org.apache.skywalking.apm.collector.client.h2.H2Client;
+import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ApplicationAlarmH2UIDAO extends H2DAO implements 
IApplicationAlarmUIDAO {
+
+    public ApplicationAlarmH2UIDAO(H2Client client) {
+        super(client);
+    }
+
+    @Override
+    public Alarm loadAlarmList(String keyword, long start, long end, int 
limit, int from) throws ParseException {
+        return null;
+    }
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceAlarmH2UIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceAlarmH2UIDAO.java
new file mode 100644
index 000000000..7f3b71baa
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/InstanceAlarmH2UIDAO.java
@@ -0,0 +1,38 @@
+/*
+ * 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.apm.collector.storage.h2.dao.ui;
+
+import org.apache.skywalking.apm.collector.client.h2.H2Client;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class InstanceAlarmH2UIDAO extends H2DAO implements IInstanceAlarmUIDAO 
{
+
+    public InstanceAlarmH2UIDAO(H2Client client) {
+        super(client);
+    }
+
+    @Override public Alarm loadAlarmList(String keyword, long start, long end, 
int limit, int from) {
+        return null;
+    }
+}
diff --git 
a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ServiceAlarmH2UIDAO.java
 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ServiceAlarmH2UIDAO.java
new file mode 100644
index 000000000..251e753d3
--- /dev/null
+++ 
b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/ui/ServiceAlarmH2UIDAO.java
@@ -0,0 +1,38 @@
+/*
+ * 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.apm.collector.storage.h2.dao.ui;
+
+import org.apache.skywalking.apm.collector.client.h2.H2Client;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
+
+/**
+ * @author peng-yongsheng
+ */
+public class ServiceAlarmH2UIDAO extends H2DAO implements IServiceAlarmUIDAO {
+
+    public ServiceAlarmH2UIDAO(H2Client client) {
+        super(client);
+    }
+
+    @Override public Alarm loadAlarmList(String keyword, long start, long end, 
int limit, int from) {
+        return null;
+    }
+}
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/GraphQLHandler.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/GraphQLHandler.java
index c845edd65..9f29df2f0 100644
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/GraphQLHandler.java
+++ 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/GraphQLHandler.java
@@ -82,7 +82,7 @@ public GraphQLHandler(ModuleManager moduleManager) {
             .file("ui-graphql/server-layer.graphqls")
             .file("ui-graphql/service-layer.graphqls")
             .file("ui-graphql/trace.graphqls")
-            .resolvers(new VersionQuery(), new VersionMutation(), new 
AlarmQuery(), new ApplicationQuery(moduleManager))
+            .resolvers(new VersionQuery(), new VersionMutation(), new 
AlarmQuery(moduleManager), new ApplicationQuery(moduleManager))
             .resolvers(new OverViewLayerQuery(moduleManager), new 
ServerQuery(moduleManager), new ServiceQuery(moduleManager), new 
TraceQuery(moduleManager))
             .resolvers(new ConfigQuery(), new ConfigMutation())
             .dictionary(ConjecturalNode.class, VisualUserNode.class, 
ApplicationNode.class, ServiceNode.class)
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java
index 3b377d213..6b1df8d77 100644
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java
+++ 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java
@@ -18,23 +18,53 @@
 
 package org.apache.skywalking.apm.collector.ui.query;
 
-import org.apache.skywalking.apm.collector.ui.graphql.Query;
+import java.text.ParseException;
+import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.core.util.ObjectUtils;
 import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
 import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmType;
 import org.apache.skywalking.apm.collector.storage.ui.common.Duration;
 import org.apache.skywalking.apm.collector.storage.ui.common.Pagination;
-
-import java.util.Collections;
+import org.apache.skywalking.apm.collector.ui.graphql.Query;
+import org.apache.skywalking.apm.collector.ui.service.AlarmService;
+import org.apache.skywalking.apm.collector.ui.utils.DurationUtils;
 
 /**
  * @author peng-yongsheng
  */
 public class AlarmQuery implements Query {
 
-    public Alarm loadAlarmList(String keyword, AlarmType alarmType, Duration 
duration, Pagination paging) {
-        Alarm alarm = new Alarm();
-        alarm.setTotal(0);
-        alarm.setItems(Collections.emptyList());
-        return alarm;
+    private final ModuleManager moduleManager;
+    private AlarmService alarmService;
+
+    public AlarmQuery(ModuleManager moduleManager) {
+        this.moduleManager = moduleManager;
+    }
+
+    private AlarmService getAlarmService() {
+        if (ObjectUtils.isEmpty(alarmService)) {
+            this.alarmService = new AlarmService(moduleManager);
+        }
+        return alarmService;
+    }
+
+    public Alarm loadAlarmList(String keyword, AlarmType alarmType, Duration 
duration,
+        Pagination paging) throws ParseException {
+        long start = 
DurationUtils.INSTANCE.durationToSecondTimeBucket(duration.getStep(), 
duration.getStart()) / 100;
+        long end = 
DurationUtils.INSTANCE.durationToSecondTimeBucket(duration.getStep(), 
duration.getEnd()) / 100;
+
+        int limit = paging.getPageSize();
+        int from = paging.getPageSize() * paging.getPageNum();
+
+        switch (alarmType) {
+            case APPLICATION:
+                return getAlarmService().loadApplicationAlarmList(keyword, 
start, end, limit, from);
+            case SERVER:
+                return getAlarmService().loadInstanceAlarmList(keyword, start, 
end, limit, from);
+            case SERVICE:
+                return getAlarmService().loadServiceAlarmList(keyword, start, 
end, limit, from);
+            default:
+                return new Alarm();
+        }
     }
 }
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/AlarmService.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/AlarmService.java
index e364088f8..066d71c68 100644
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/AlarmService.java
+++ 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/AlarmService.java
@@ -21,18 +21,51 @@
 import java.text.ParseException;
 import java.util.List;
 import org.apache.skywalking.apm.collector.core.module.ModuleManager;
+import org.apache.skywalking.apm.collector.storage.StorageModule;
+import 
org.apache.skywalking.apm.collector.storage.dao.ui.IApplicationAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.dao.ui.IServiceAlarmUIDAO;
+import org.apache.skywalking.apm.collector.storage.ui.alarm.Alarm;
 import org.apache.skywalking.apm.collector.storage.ui.common.Step;
 import org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend;
 import org.apache.skywalking.apm.collector.storage.utils.DurationPoint;
 import org.apache.skywalking.apm.collector.ui.utils.DurationUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * @author peng-yongsheng
  */
 public class AlarmService {
 
+    private final Logger logger = LoggerFactory.getLogger(AlarmService.class);
+
+    private final IApplicationAlarmUIDAO applicationAlarmUIDAO;
+    private final IInstanceAlarmUIDAO instanceAlarmUIDAO;
+    private final IServiceAlarmUIDAO serviceAlarmUIDAO;
+
     public AlarmService(ModuleManager moduleManager) {
+        this.applicationAlarmUIDAO = 
moduleManager.find(StorageModule.NAME).getService(IApplicationAlarmUIDAO.class);
+        this.instanceAlarmUIDAO = 
moduleManager.find(StorageModule.NAME).getService(IInstanceAlarmUIDAO.class);
+        this.serviceAlarmUIDAO = 
moduleManager.find(StorageModule.NAME).getService(IServiceAlarmUIDAO.class);
+    }
+
+    public Alarm loadApplicationAlarmList(String keyword, long start, long end,
+        int limit, int from) throws ParseException {
+        logger.debug("keyword: {}, start: {}, end: {}, limit: {}, from: {}", 
keyword, start, end, limit, from);
+        return applicationAlarmUIDAO.loadAlarmList(keyword, start, end, limit, 
from);
+    }
+
+    public Alarm loadInstanceAlarmList(String keyword, long start, long end,
+        int limit, int from) throws ParseException {
+        logger.debug("keyword: {}, start: {}, end: {}, limit: {}, from: {}", 
keyword, start, end, limit, from);
+        return instanceAlarmUIDAO.loadAlarmList(keyword, start, end, limit, 
from);
+    }
 
+    public Alarm loadServiceAlarmList(String keyword, long start, long end,
+        int limit, int from) throws ParseException {
+        logger.debug("keyword: {}, start: {}, end: {}, limit: {}, from: {}", 
keyword, start, end, limit, from);
+        return serviceAlarmUIDAO.loadAlarmList(keyword, start, end, limit, 
from);
     }
 
     public AlarmTrend getApplicationAlarmTrend(Step step, long start, long 
end) throws ParseException {
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceHealthService.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceHealthService.java
deleted file mode 100644
index 5b1048b4c..000000000
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceHealthService.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * 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.apm.collector.ui.service;
-
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import org.apache.skywalking.apm.collector.cache.CacheModule;
-import 
org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService;
-import org.apache.skywalking.apm.collector.core.module.ModuleManager;
-import org.apache.skywalking.apm.collector.storage.StorageModule;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IGCMetricUIDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceMetricUIDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceUIDAO;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author peng-yongsheng
- */
-public class InstanceHealthService {
-
-    private final Logger logger = 
LoggerFactory.getLogger(InstanceHealthService.class);
-
-    private final IGCMetricUIDAO gcMetricDAO;
-    private final IInstanceUIDAO instanceDAO;
-    private final IInstanceMetricUIDAO instanceMetricUIDAO;
-    private final ApplicationCacheService applicationCacheService;
-
-    public InstanceHealthService(ModuleManager moduleManager) {
-        this.gcMetricDAO = 
moduleManager.find(StorageModule.NAME).getService(IGCMetricUIDAO.class);
-        this.instanceDAO = 
moduleManager.find(StorageModule.NAME).getService(IInstanceUIDAO.class);
-        this.instanceMetricUIDAO = 
moduleManager.find(StorageModule.NAME).getService(IInstanceMetricUIDAO.class);
-        this.applicationCacheService = 
moduleManager.find(CacheModule.NAME).getService(ApplicationCacheService.class);
-    }
-
-    public JsonObject getInstances(long timeBucket, int applicationId) {
-        JsonObject response = new JsonObject();
-
-//        long[] timeBuckets = 
TimeBucketUtils.INSTANCE.getFiveSecondTimeBuckets(timeBucket);
-//        long halfHourBeforeTimeBucket = 
TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND,
 timeBucket, -60 * 30);
-//        List<Instance> instanceList = 
instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket);
-
-        JsonArray instances = new JsonArray();
-        response.add("instances", instances);
-
-//        instanceList.forEach(instance -> {
-//            response.addProperty("applicationCode", 
applicationCacheService.getApplicationById(applicationId));
-//            response.addProperty("applicationId", applicationId);
-//
-//            IInstanceMetricUIDAO.InstanceMetric performance = 
instanceMetricUIDAO.get(timeBuckets, instance.getInstanceId());
-//
-//            JsonObject instanceJson = new JsonObject();
-//            instanceJson.addProperty("id", instance.getInstanceId());
-//            if (performance != null) {
-//                instanceJson.addProperty("tps", performance.getCalls());
-//            } else {
-//                instanceJson.addProperty("tps", 0);
-//            }
-//
-//            int avg = 0;
-//            if (performance != null && performance.getCalls() != 0) {
-//                avg = (int)(performance.getDurationSum() / 
performance.getCalls());
-//            }
-//            instanceJson.addProperty("avg", avg);
-//
-//            if (avg > 5000) {
-//                instanceJson.addProperty("healthLevel", 0);
-//            } else if (avg > 3000 && avg <= 5000) {
-//                instanceJson.addProperty("healthLevel", 1);
-//            } else if (avg > 1000 && avg <= 3000) {
-//                instanceJson.addProperty("healthLevel", 2);
-//            } else {
-//                instanceJson.addProperty("healthLevel", 3);
-//            }
-
-//            long heartBeatTime = 
TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND,
 instance.getHeartBeatTime());
-//            long currentTime = 
TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND,
 timeBucket);
-//
-//            if (currentTime - heartBeatTime < 1000 * 60 * 2) {
-//                instanceJson.addProperty("status", 0);
-//            } else {
-//                instanceJson.addProperty("status", 1);
-//            }
-//
-//            IGCMetricUIDAO.GCCount gcCount = 
gcMetricDAO.getGCCount(timeBuckets, instance.getInstanceId());
-//            instanceJson.addProperty("ygc", gcCount.getYoung());
-//            instanceJson.addProperty("ogc", gcCount.getOld());
-//
-//            instances.add(instanceJson);
-//        });
-
-        return response;
-    }
-}
diff --git 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceJVMService.java
 
b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceJVMService.java
deleted file mode 100644
index 61af75d2e..000000000
--- 
a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/InstanceJVMService.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * 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.apm.collector.ui.service;
-
-import com.google.gson.Gson;
-import com.google.gson.JsonObject;
-import java.util.Set;
-import org.apache.skywalking.apm.collector.core.UnexpectedException;
-import org.apache.skywalking.apm.collector.core.module.ModuleManager;
-import org.apache.skywalking.apm.collector.core.util.ObjectUtils;
-import org.apache.skywalking.apm.collector.storage.StorageModule;
-import org.apache.skywalking.apm.collector.storage.dao.ui.ICpuMetricUIDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IGCMetricUIDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceMetricUIDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IInstanceUIDAO;
-import org.apache.skywalking.apm.collector.storage.dao.ui.IMemoryMetricUIDAO;
-import 
org.apache.skywalking.apm.collector.storage.dao.ui.IMemoryPoolMetricUIDAO;
-import org.apache.skywalking.apm.collector.storage.table.register.Instance;
-import org.apache.skywalking.apm.network.proto.PoolType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * @author peng-yongsheng
- */
-public class InstanceJVMService {
-
-    private final Logger logger = 
LoggerFactory.getLogger(InstanceJVMService.class);
-
-    private final Gson gson = new Gson();
-
-    private final IInstanceUIDAO instanceDAO;
-    private final ICpuMetricUIDAO cpuMetricDAO;
-    private final IGCMetricUIDAO gcMetricDAO;
-    private final IMemoryMetricUIDAO memoryMetricDAO;
-    private final IMemoryPoolMetricUIDAO memoryPoolMetricDAO;
-    private final IInstanceMetricUIDAO instanceMetricUIDAO;
-
-    public InstanceJVMService(ModuleManager moduleManager) {
-        this.instanceDAO = 
moduleManager.find(StorageModule.NAME).getService(IInstanceUIDAO.class);
-        this.cpuMetricDAO = 
moduleManager.find(StorageModule.NAME).getService(ICpuMetricUIDAO.class);
-        this.gcMetricDAO = 
moduleManager.find(StorageModule.NAME).getService(IGCMetricUIDAO.class);
-        this.memoryMetricDAO = 
moduleManager.find(StorageModule.NAME).getService(IMemoryMetricUIDAO.class);
-        this.memoryPoolMetricDAO = 
moduleManager.find(StorageModule.NAME).getService(IMemoryPoolMetricUIDAO.class);
-        this.instanceMetricUIDAO = 
moduleManager.find(StorageModule.NAME).getService(IInstanceMetricUIDAO.class);
-    }
-
-    public JsonObject getInstanceOsInfo(int instanceId) {
-        Instance instance = instanceDAO.getInstance(instanceId);
-        if (ObjectUtils.isEmpty(instance)) {
-            throw new UnexpectedException("instance id: " + instanceId + " not 
exist.");
-        }
-
-        return gson.fromJson(instance.getOsInfo(), JsonObject.class);
-    }
-
-    public JsonObject getInstanceJvmMetric(int instanceId, Set<String> 
metricTypes, long timeBucket) {
-        JsonObject metrics = new JsonObject();
-        for (String metricType : metricTypes) {
-            if (metricType.toLowerCase().equals(MetricType.cpu.name())) {
-            } else if (metricType.toLowerCase().equals(MetricType.gc.name())) {
-            } else if (metricType.toLowerCase().equals(MetricType.tps.name())) 
{
-            } else if 
(metricType.toLowerCase().equals(MetricType.resptime.name())) {
-            } else if 
(metricType.toLowerCase().equals(MetricType.heapmemory.name())) {
-            } else if 
(metricType.toLowerCase().equals(MetricType.nonheapmemory.name())) {
-            } else if 
(metricType.toLowerCase().equals(MetricType.permgen.name())) {
-                metrics.add(MetricType.permgen.name(), 
memoryPoolMetricDAO.getMetric(instanceId, timeBucket, 
PoolType.PERMGEN_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.metaspace.name())) {
-                metrics.add(MetricType.metaspace.name(), 
memoryPoolMetricDAO.getMetric(instanceId, timeBucket, 
PoolType.METASPACE_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.newgen.name())) {
-                metrics.add(MetricType.newgen.name(), 
memoryPoolMetricDAO.getMetric(instanceId, timeBucket, 
PoolType.NEWGEN_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.oldgen.name())) {
-                metrics.add(MetricType.oldgen.name(), 
memoryPoolMetricDAO.getMetric(instanceId, timeBucket, 
PoolType.OLDGEN_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.survivor.name())) {
-                metrics.add(MetricType.survivor.name(), 
memoryPoolMetricDAO.getMetric(instanceId, timeBucket, 
PoolType.SURVIVOR_USAGE_VALUE));
-            } else {
-                throw new UnexpectedException("unexpected metric type");
-            }
-        }
-        return metrics;
-    }
-
-    public JsonObject getInstanceJvmMetrics(int instanceId, Set<String> 
metricTypes, long startTimeBucket,
-        long endTimeBucket) {
-        JsonObject metrics = new JsonObject();
-        for (String metricType : metricTypes) {
-            if (metricType.toLowerCase().equals(MetricType.cpu.name())) {
-            } else if (metricType.toLowerCase().equals(MetricType.gc.name())) {
-            } else if (metricType.toLowerCase().equals(MetricType.tps.name())) 
{
-            } else if 
(metricType.toLowerCase().equals(MetricType.resptime.name())) {
-            } else if 
(metricType.toLowerCase().equals(MetricType.heapmemory.name())) {
-            } else if 
(metricType.toLowerCase().equals(MetricType.nonheapmemory.name())) {
-            } else if 
(metricType.toLowerCase().equals(MetricType.permgen.name())) {
-                metrics.add(MetricType.permgen.name(), 
memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, 
PoolType.PERMGEN_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.metaspace.name())) {
-                metrics.add(MetricType.metaspace.name(), 
memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, 
PoolType.METASPACE_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.newgen.name())) {
-                metrics.add(MetricType.newgen.name(), 
memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, 
PoolType.NEWGEN_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.oldgen.name())) {
-                metrics.add(MetricType.oldgen.name(), 
memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, 
PoolType.OLDGEN_USAGE_VALUE));
-            } else if 
(metricType.toLowerCase().equals(MetricType.survivor.name())) {
-                metrics.add(MetricType.survivor.name(), 
memoryPoolMetricDAO.getMetric(instanceId, startTimeBucket, endTimeBucket, 
PoolType.SURVIVOR_USAGE_VALUE));
-            } else {
-                throw new UnexpectedException("unexpected metric type");
-            }
-        }
-
-        return metrics;
-    }
-
-    public enum MetricType {
-        cpu, gc, tps, resptime, heapmemory, nonheapmemory, permgen, metaspace, 
newgen,
-        oldgen, survivor
-    }
-}


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to