diff --git a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java index 682b6c410..cde3e4c69 100644 --- a/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java +++ b/apm-collector/apm-collector-agent/agent-grpc/agent-grpc-provider/src/main/java/org/apache/skywalking/apm/collector/agent/grpc/provider/handler/InstanceDiscoveryServiceHandler.java @@ -26,7 +26,6 @@ import org.apache.skywalking.apm.collector.analysis.metric.define.service.IInsta import org.apache.skywalking.apm.collector.analysis.register.define.AnalysisRegisterModule; import org.apache.skywalking.apm.collector.analysis.register.define.service.IInstanceIDService; import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.server.grpc.GRPCHandler; import org.apache.skywalking.apm.network.proto.ApplicationInstance; import org.apache.skywalking.apm.network.proto.ApplicationInstanceHeartbeat; @@ -55,8 +54,7 @@ public class InstanceDiscoveryServiceHandler extends InstanceDiscoveryServiceGrp @Override public void registerInstance(ApplicationInstance request, StreamObserver responseObserver) { - long timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(request.getRegisterTime()); - int instanceId = instanceIDService.getOrCreateByAgentUUID(request.getApplicationId(), request.getAgentUUID(), timeBucket, buildOsInfo(request.getOsinfo())); + int instanceId = instanceIDService.getOrCreateByAgentUUID(request.getApplicationId(), request.getAgentUUID(), request.getRegisterTime(), buildOsInfo(request.getOsinfo())); ApplicationInstanceMapping.Builder builder = ApplicationInstanceMapping.newBuilder(); builder.setApplicationId(request.getApplicationId()); builder.setApplicationInstanceId(instanceId); diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json index 4c80222bd..02f3ef8b0 100644 --- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json +++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-consumer.json @@ -1,43 +1,33 @@ [ { - "gt": [ - [ - 230150, - 185809, - 24040000 - ] - ], + "gt": [[230150, 185809, 24040000]], //trace_id 链路编码 "sg": { - "ts": [ - 230150, - 185809, - 24040000 - ], - "ai": -1, - "ii": 2, - "rs": [], - "ss": [ + "ts": [230150, 185809, 24040000], //segment_id 一个应用中的一个实例在链路中产生的编号 + "ai": -1, //应用ID,应用启动注册时产生 + "ii": 2, //实例ID,应用启动注册时产生 + "rs": [], //链路的上下文信息,头节点,所以为空 + "ss": [ //一个埋点(手动埋点或者自动埋点) { - "si": 1, - "tv": 1, - "lv": 1, - "ps": 0, - "st": 1501858094526, - "et": 1501858097004, - "ci": 3, - "cn": "", - "oi": 0, - "on": "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", - "pi": 0, - "pn": "172.25.0.4:20880", - "ie": false, - "to": [ + "si": 1, //埋点编号 + "tv": 1, //埋点类型(手动、入口、出口) + "lv": 1, //层(RPCFramework,Database,Http) + "ps": 0, //上级埋点编号 + "st": 1501858094526, //开始时间 + "et": 1501858097004, //结束时间 + "ci": 3, //组件编号(Tomcat、Mysql、Dubbo...) + "cn": "", //组件名称 + "oi": 0, //埋点的服务ID + "on": "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", //埋点的服务名 + "pi": 0, //地址注册的ID,调用抓取后注册 + "pn": "172.25.0.4:20880", //地址 + "ie": false, //是否发生错误,是否有Exception + "to": [ //与链路分析关系较小的TAG,SQL也在其中 { "k": "url", "v": "rest://172.25.0.4:20880/org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()" } ], - "lo": [] + "lo": [] //日志,与链路分析完全无关,只作为展示使用,手动埋点时可以任意追加,kv的形式,例如收集一些业务相关的信息 }, { "si": 0, diff --git a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json index e446706f2..5add6e2f1 100644 --- a/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json +++ b/apm-collector/apm-collector-agent/agent-jetty/agent-jetty-provider/src/test/resources/json/dubbox-provider.json @@ -1,18 +1,8 @@ [ { - "gt": [ - [ - 230150, - 185809, - 24040000 - ] - ], + "gt": [[230150, 185809, 24040000]], //trace_id 链路编码,与调用方相同 "sg": { - "ts": [ - 137150, - 185809, - 48780000 - ], + "ts": [137150, 185809, 48780000], //segment_id,新产生 "ai": 2, "ii": 3, "ss": [ @@ -32,21 +22,17 @@ "ie": false, "rs": [ { - "pts": [ - 230150, - 185809, - 24040000 - ], - "pii": 2, - "psp": 0, - "psi": 0, - "psn": "/dubbox-case/case/dubbox-rest", - "ni": 0, - "nn": "172.25.0.4:20880", - "eii": 2, - "esi": 0, - "esn": "/dubbox-case/case/dubbox-rest", - "rn": 0 + "pts": [230150, 185809, 24040000], //上级的segment_id 一个应用中的一个实例在链路中产生的编号 + "pii": 2, //上级的实例编号 + "psp": 0, //上级的埋点编号span_id + "psi": 0, //上级的服务编号(org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()注册后的ID) + "psn": "org.skywaking.apm.testcase.dubbo.services.GreetService.doBusiness()", //上级的服务名 + "ni": 0, //上级调用时使用的地址注册后的ID + "nn": "172.25.0.4:20880", //上级的地址 + "eii": 2, //入口的实例编号 + "esi": 0, //入口的服务编号 + "esn": "/dubbox-case/case/dubbox-rest", //入口的服务名词 + "rn": 0 //调用方式(CrossProcess,CrossThread) } ], "to": [ 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 e7f8501cf..a3cf5b2ef 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 @@ -20,8 +20,6 @@ package org.apache.skywalking.apm.collector.core.util; import java.text.SimpleDateFormat; import java.util.Calendar; -import java.util.TimeZone; -import org.apache.skywalking.apm.collector.core.UnexpectedException; /** * @author peng-yongsheng @@ -29,6 +27,7 @@ import org.apache.skywalking.apm.collector.core.UnexpectedException; public enum TimeBucketUtils { INSTANCE; + private final SimpleDateFormat monthDateFormat = new SimpleDateFormat("yyyyMM"); private final SimpleDateFormat dayDateFormat = new SimpleDateFormat("yyyyMMdd"); private final SimpleDateFormat hourDateFormat = new SimpleDateFormat("yyyyMMddHH"); private final SimpleDateFormat minuteDateFormat = new SimpleDateFormat("yyyyMMddHHmm"); @@ -90,65 +89,7 @@ public enum TimeBucketUtils { return secondBucket / 100 / 100 / 100 / 100; } - public long changeTimeBucket2TimeStamp(String timeBucketType, long timeBucket) { - if (TimeBucketType.SECOND.name().toLowerCase().equals(timeBucketType.toLowerCase())) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.YEAR, Integer.valueOf(String.valueOf(timeBucket).substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(4, 6)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(6, 8))); - calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(String.valueOf(timeBucket).substring(8, 10))); - calendar.set(Calendar.MINUTE, Integer.valueOf(String.valueOf(timeBucket).substring(10, 12))); - calendar.set(Calendar.SECOND, Integer.valueOf(String.valueOf(timeBucket).substring(12, 14))); - return calendar.getTimeInMillis(); - } else if (TimeBucketType.MINUTE.name().toLowerCase().equals(timeBucketType.toLowerCase())) { - Calendar calendar = Calendar.getInstance(); - calendar.set(Calendar.YEAR, Integer.valueOf(String.valueOf(timeBucket).substring(0, 4))); - calendar.set(Calendar.MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(4, 6)) - 1); - calendar.set(Calendar.DAY_OF_MONTH, Integer.valueOf(String.valueOf(timeBucket).substring(6, 8))); - calendar.set(Calendar.HOUR_OF_DAY, Integer.valueOf(String.valueOf(timeBucket).substring(8, 10))); - calendar.set(Calendar.MINUTE, Integer.valueOf(String.valueOf(timeBucket).substring(10, 12))); - return calendar.getTimeInMillis(); - } else { - throw new UnexpectedException("time bucket type must be second or minute"); - } - } - - public long[] getFiveSecondTimeBuckets(long secondTimeBucket) { - long timeStamp = changeTimeBucket2TimeStamp(TimeBucketType.SECOND.name(), secondTimeBucket); - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(timeStamp); - - long[] timeBuckets = new long[5]; - timeBuckets[0] = secondTimeBucket; - for (int i = 0; i < 4; i++) { - calendar.add(Calendar.SECOND, -1); - timeBuckets[i + 1] = getSecondTimeBucket(calendar.getTimeInMillis()); - } - return timeBuckets; - } - - public long changeToUTCTimeBucket(long timeBucket) { - String timeBucketStr = String.valueOf(timeBucket); - - if (TimeZone.getDefault().getID().equals("GMT+08:00") || timeBucketStr.endsWith("0000")) { - return timeBucket; - } else { - return timeBucket - 800; - } - } - - public long addSecondForSecondTimeBucket(String timeBucketType, long timeBucket, int second) { - if (!TimeBucketType.SECOND.name().equals(timeBucketType)) { - throw new UnexpectedException("time bucket type must be second "); - } - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(changeTimeBucket2TimeStamp(timeBucketType, timeBucket)); - calendar.add(Calendar.SECOND, second); - - return getSecondTimeBucket(calendar.getTimeInMillis()); - } - public enum TimeBucketType { - SECOND, MINUTE, HOUR, DAY + SECOND, MINUTE, HOUR, DAY, MONTH } } diff --git a/apm-collector/apm-collector-core/src/test/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtilsTest.java b/apm-collector/apm-collector-core/src/test/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtilsTest.java index 35f8d2276..dcc659980 100644 --- a/apm-collector/apm-collector-core/src/test/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtilsTest.java +++ b/apm-collector/apm-collector-core/src/test/java/org/apache/skywalking/apm/collector/core/util/TimeBucketUtilsTest.java @@ -16,14 +16,10 @@ * */ - package org.apache.skywalking.apm.collector.core.util; import java.util.TimeZone; -import org.junit.After; -import org.junit.Assert; import org.junit.Before; -import org.junit.Test; /** * @author wu-sheng @@ -33,25 +29,4 @@ public class TimeBucketUtilsTest { public void setup() { TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai")); } - - @After - public void teardown() { - - } - - @Test - public void testGetInfoFromATimestamp() { - long timeMillis = 1509521745220L; - Assert.assertArrayEquals(new long[] { - 20171101153545L, - 20171101153544L, - 20171101153543L, - 20171101153542L, - 20171101153541L - }, TimeBucketUtils.INSTANCE.getFiveSecondTimeBuckets(TimeBucketUtils.INSTANCE.getSecondTimeBucket(timeMillis))); - Assert.assertEquals(20171101153545L, TimeBucketUtils.INSTANCE.getSecondTimeBucket(timeMillis)); - Assert.assertEquals(201711011535L, TimeBucketUtils.INSTANCE.getMinuteTimeBucket(timeMillis)); - Assert.assertEquals(201711011500L, TimeBucketUtils.INSTANCE.getHourTimeBucket(timeMillis)); - Assert.assertEquals(201711010000L, TimeBucketUtils.INSTANCE.getDayTimeBucket(timeMillis)); - } } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceUIDAO.java index be7fe7e14..a2173bd53 100644 --- a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/dao/IInstanceUIDAO.java @@ -18,10 +18,10 @@ package org.apache.skywalking.apm.collector.storage.dao; -import com.google.gson.JsonArray; import java.util.List; import org.apache.skywalking.apm.collector.storage.base.dao.DAO; import org.apache.skywalking.apm.collector.storage.table.register.Instance; +import org.apache.skywalking.apm.collector.storage.ui.application.Application; /** * @author peng-yongsheng @@ -31,27 +31,9 @@ public interface IInstanceUIDAO extends DAO { Long instanceLastHeartBeatTime(long applicationInstanceId); - JsonArray getApplications(long startTime, long endTime); + List getApplications(long startTime, long endTime); Instance getInstance(int instanceId); List getInstances(int applicationId, long timeBucket); - - class Application { - private final int applicationId; - private final long count; - - public Application(int applicationId, long count) { - this.applicationId = applicationId; - this.count = count; - } - - public int getApplicationId() { - return applicationId; - } - - public long getCount() { - return count; - } - } } 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 new file mode 100644 index 000000000..62c3dc102 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/Alarm.java @@ -0,0 +1,45 @@ +/* + * 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.ui.alarm; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class Alarm { + private List items; + private Integer count; + + public List getItems() { + return items; + } + + public void setItems(List items) { + this.items = items; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } +} 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 new file mode 100644 index 000000000..1523ec931 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmItem.java @@ -0,0 +1,30 @@ +/* + * 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.ui.alarm; + +/** + * @author peng-yongsheng + */ +public class AlarmItem { + private String title; + private String content; + private String startTime; + private AlarmType alertType; + private CauseType causeType; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmType.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmType.java new file mode 100644 index 000000000..75986a5da --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/AlarmType.java @@ -0,0 +1,28 @@ +/* + * 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.ui.alarm; + +/** + * @author peng-yongsheng + */ +public enum AlarmType { + APPLICATION, + SERVER, + SERVICE +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/CauseType.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/CauseType.java new file mode 100644 index 000000000..908ff6482 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/alarm/CauseType.java @@ -0,0 +1,27 @@ +/* + * 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.ui.alarm; + +/** + * @author peng-yongsheng + */ +public enum CauseType { + LOW_SUCCESS_RATE, + SLOW_RESPONSE +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/Application.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/Application.java new file mode 100644 index 000000000..354efb2cf --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/Application.java @@ -0,0 +1,52 @@ +/* + * 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.ui.application; + +/** + * @author peng-yongsheng + */ +public class Application { + private int id; + private String name; + private int numOfServer; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public int getNumOfServer() { + return numOfServer; + } + + public void setNumOfServer(int numOfServer) { + this.numOfServer = numOfServer; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/ApplicationNode.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/ApplicationNode.java new file mode 100644 index 000000000..0affa2480 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/ApplicationNode.java @@ -0,0 +1,109 @@ +/* + * 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.ui.application; + +import org.apache.skywalking.apm.collector.storage.ui.common.Node; + +/** + * @author peng-yongsheng + */ +public class ApplicationNode extends Node { + + private Float sla; + private Long callsPerSec; + private Integer responseTimePerSec; + private Long calls; + private Float apdex; + private Boolean isAlarm; + private Integer numOfServer; + private Integer numOfServerAlarm; + private Integer numOfServiceAlarm; + + public Float getSla() { + return sla; + } + + public void setSla(Float sla) { + this.sla = sla; + } + + public Long getCallsPerSec() { + return callsPerSec; + } + + public void setCallsPerSec(Long callsPerSec) { + this.callsPerSec = callsPerSec; + } + + public Integer getResponseTimePerSec() { + return responseTimePerSec; + } + + public void setResponseTimePerSec(Integer responseTimePerSec) { + this.responseTimePerSec = responseTimePerSec; + } + + public Long getCalls() { + return calls; + } + + public void setCalls(Long calls) { + this.calls = calls; + } + + public Float getApdex() { + return apdex; + } + + public void setApdex(Float apdex) { + this.apdex = apdex; + } + + public Boolean getAlarm() { + return isAlarm; + } + + public void setAlarm(Boolean alarm) { + isAlarm = alarm; + } + + public Integer getNumOfServer() { + return numOfServer; + } + + public void setNumOfServer(Integer numOfServer) { + this.numOfServer = numOfServer; + } + + public Integer getNumOfServerAlarm() { + return numOfServerAlarm; + } + + public void setNumOfServerAlarm(Integer numOfServerAlarm) { + this.numOfServerAlarm = numOfServerAlarm; + } + + public Integer getNumOfServiceAlarm() { + return numOfServiceAlarm; + } + + public void setNumOfServiceAlarm(Integer numOfServiceAlarm) { + this.numOfServiceAlarm = numOfServiceAlarm; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/ConjecturalNode.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/ConjecturalNode.java new file mode 100644 index 000000000..c77c36955 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/application/ConjecturalNode.java @@ -0,0 +1,27 @@ +/* + * 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.ui.application; + +import org.apache.skywalking.apm.collector.storage.ui.common.Node; + +/** + * @author peng-yongsheng + */ +public class ConjecturalNode extends Node { +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Call.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Call.java new file mode 100644 index 000000000..7a388e3ce --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Call.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.ui.common; + +/** + * @author peng-yongsheng + */ +public class Call { + private String source; + private String target; + private Boolean isAlert; + private String callType; + private Integer callsPerSec; + private Integer responseTimePerSec; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Duration.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Duration.java new file mode 100644 index 000000000..88ef2fa7f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Duration.java @@ -0,0 +1,53 @@ +/* + * 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.ui.common; + +/** + * @author peng-yongsheng + */ +public class Duration { + + private String start; + private String end; + private Step step; + + public String getStart() { + return start; + } + + public void setStart(String start) { + this.start = start; + } + + public String getEnd() { + return end; + } + + public void setEnd(String end) { + this.end = end; + } + + public Step getStep() { + return step; + } + + public void setStep(Step step) { + this.step = step; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Node.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Node.java new file mode 100644 index 000000000..e4d43c379 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Node.java @@ -0,0 +1,52 @@ +/* + * 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.ui.common; + +/** + * @author peng-yongsheng + */ +public abstract class Node { + private String id; + private String name; + private String type; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Pagination.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Pagination.java new file mode 100644 index 000000000..dc4904807 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Pagination.java @@ -0,0 +1,52 @@ +/* + * 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.ui.common; + +/** + * @author peng-yongsheng + */ +public class Pagination { + private Integer pageNum; + private Integer pageSize; + private Boolean needTotal; + + public Integer getPageNum() { + return pageNum; + } + + public void setPageNum(Integer pageNum) { + this.pageNum = pageNum; + } + + public Integer getPageSize() { + return pageSize; + } + + public void setPageSize(Integer pageSize) { + this.pageSize = pageSize; + } + + public Boolean getNeedTotal() { + return needTotal; + } + + public void setNeedTotal(Boolean needTotal) { + this.needTotal = needTotal; + } +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/ResponseTimeTrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/ResponseTimeTrend.java new file mode 100644 index 000000000..018892d64 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/ResponseTimeTrend.java @@ -0,0 +1,28 @@ +/* + * 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.ui.common; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class ResponseTimeTrend { + private List trendList; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/SLATrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/SLATrend.java new file mode 100644 index 000000000..a6204646b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/SLATrend.java @@ -0,0 +1,28 @@ +/* + * 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.ui.common; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class SLATrend { + private List trendList; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Step.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Step.java new file mode 100644 index 000000000..6a4d83a0b --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Step.java @@ -0,0 +1,30 @@ +/* + * 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.ui.common; + +/** + * @author peng-yongsheng + */ +public enum Step { + MONTH, + DAY, + HOUR, + MINUTE, + SECOND +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/ThroughputTrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/ThroughputTrend.java new file mode 100644 index 000000000..e6cf37b99 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/ThroughputTrend.java @@ -0,0 +1,28 @@ +/* + * 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.ui.common; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class ThroughputTrend { + private List trendList; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Topology.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Topology.java new file mode 100644 index 000000000..7e3ac2c57 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/Topology.java @@ -0,0 +1,29 @@ +/* + * 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.ui.common; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class Topology { + private List nodes; + private List calls; +} diff --git a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/common/Mutation.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/VisualUserNode.java similarity index 87% rename from apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/common/Mutation.java rename to apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/VisualUserNode.java index 82f21b500..8207acda2 100644 --- a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/common/Mutation.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/common/VisualUserNode.java @@ -16,11 +16,10 @@ * */ -package org.apache.skywalking.apm.collector.ui.graphql.common; +package org.apache.skywalking.apm.collector.storage.ui.common; /** * @author peng-yongsheng */ -public class Mutation { - private String version; +public class VisualUserNode extends Node { } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/AlarmThreshold.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/AlarmThreshold.java new file mode 100644 index 000000000..e96d329ec --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/AlarmThreshold.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.ui.config; + +import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmType; +import org.apache.skywalking.apm.collector.storage.ui.alarm.CauseType; + +/** + * @author peng-yongsheng + */ +public class AlarmThreshold { + private AlarmType type; + private Integer threshold; + private CauseType causeType; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedAlarmThresholdItem.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedAlarmThresholdItem.java new file mode 100644 index 000000000..e42e70d96 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedAlarmThresholdItem.java @@ -0,0 +1,29 @@ +/* + * 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.ui.config; + +import org.apache.skywalking.apm.collector.storage.ui.alarm.CauseType; + +/** + * @author peng-yongsheng + */ +public class ExistedAlarmThresholdItem { + private Integer threshold; + private CauseType causeType; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedAlarmThresholds.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedAlarmThresholds.java new file mode 100644 index 000000000..f4d094547 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedAlarmThresholds.java @@ -0,0 +1,28 @@ +/* + * 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.ui.config; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class ExistedAlarmThresholds { + private List items; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedTTLConfigs.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedTTLConfigs.java new file mode 100644 index 000000000..32b29cbe2 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/ExistedTTLConfigs.java @@ -0,0 +1,28 @@ +/* + * 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.ui.config; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class ExistedTTLConfigs { + private List ttl; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/TTL.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/TTL.java new file mode 100644 index 000000000..3da100ed4 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/TTL.java @@ -0,0 +1,29 @@ +/* + * 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.ui.config; + +import org.apache.skywalking.apm.collector.storage.ui.common.Step; + +/** + * @author peng-yongsheng + */ +public class TTL { + private Step unit; + private Integer value; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/TTLConfigItem.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/TTLConfigItem.java new file mode 100644 index 000000000..8984f1616 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/config/TTLConfigItem.java @@ -0,0 +1,29 @@ +/* + * 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.ui.config; + +import org.apache.skywalking.apm.collector.storage.ui.common.Step; + +/** + * @author peng-yongsheng + */ +public class TTLConfigItem { + private Step unit; + private Integer value; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/AlarmTrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/AlarmTrend.java new file mode 100644 index 000000000..025d27df8 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/AlarmTrend.java @@ -0,0 +1,28 @@ +/* + * 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.ui.overview; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class AlarmTrend { + public List numOfAlarmRate; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ClusterBrief.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ClusterBrief.java new file mode 100644 index 000000000..41f3b8d5c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ClusterBrief.java @@ -0,0 +1,30 @@ +/* + * 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.ui.overview; + +/** + * @author peng-yongsheng + */ +public class ClusterBrief { + private int numOfApplication; + private int numOfService; + private int numOfDatabase; + private int numOfCache; + private int numOfMQ; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ConjecturalApp.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ConjecturalApp.java new file mode 100644 index 000000000..a1acc0fe7 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ConjecturalApp.java @@ -0,0 +1,27 @@ +/* + * 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.ui.overview; + +/** + * @author peng-yongsheng + */ +public class ConjecturalApp { + private String name; + private int num; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ConjecturalAppBrief.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ConjecturalAppBrief.java new file mode 100644 index 000000000..d220623fa --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/overview/ConjecturalAppBrief.java @@ -0,0 +1,28 @@ +/* + * 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.ui.overview; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class ConjecturalAppBrief { + private List apps; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/AppServerInfo.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/AppServerInfo.java new file mode 100644 index 000000000..4d4c7cc93 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/AppServerInfo.java @@ -0,0 +1,33 @@ +/* + * 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.ui.server; + +/** + * @author peng-yongsheng + */ +public class AppServerInfo { + private int id; + private String name; + private int tps; + private String os; + private String host; + private int pid; + private String ipv4; + private String ipv6; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/CPUTrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/CPUTrend.java new file mode 100644 index 000000000..062cfe213 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/CPUTrend.java @@ -0,0 +1,28 @@ +/* + * 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.ui.server; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class CPUTrend { + private List cost; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/GCTrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/GCTrend.java new file mode 100644 index 000000000..4880a8f44 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/GCTrend.java @@ -0,0 +1,29 @@ +/* + * 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.ui.server; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class GCTrend { + private List youngGC; + private List oldGC; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/MemoryTrend.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/MemoryTrend.java new file mode 100644 index 000000000..bff93d542 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/server/MemoryTrend.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.ui.server; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class MemoryTrend { + private List heap; + private List maxHeap; + private List noheap; + private List maxNoheap; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/service/ServiceInfo.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/service/ServiceInfo.java new file mode 100644 index 000000000..f33fbd469 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/service/ServiceInfo.java @@ -0,0 +1,29 @@ +/* + * 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.ui.service; + +/** + * @author peng-yongsheng + */ +public class ServiceInfo { + private int id; + private String name; + private int avgResponseTime; + private int tps; +} diff --git a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/application/ApplicationNode.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/service/ServiceNode.java similarity index 71% rename from apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/application/ApplicationNode.java rename to apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/service/ServiceNode.java index 45bc62c4a..5d2b0cc95 100644 --- a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/application/ApplicationNode.java +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/service/ServiceNode.java @@ -16,21 +16,15 @@ * */ -package org.apache.skywalking.apm.collector.ui.graphql.application; +package org.apache.skywalking.apm.collector.storage.ui.service; -import org.apache.skywalking.apm.collector.ui.graphql.common.Node; +import org.apache.skywalking.apm.collector.storage.ui.common.Node; /** * @author peng-yongsheng */ -public class ApplicationNode extends Node { +public class ServiceNode extends Node { private Float sla; - private Long callsPerSec; - private Integer responseTimePerSec; private Long calls; - private Float apdex; - private Boolean isAlarm; - private Integer numOfServer; - private Integer numOfServerAlarm; private Integer numOfServiceAlarm; } diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/BasicTrace.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/BasicTrace.java new file mode 100644 index 000000000..f8829f128 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/BasicTrace.java @@ -0,0 +1,30 @@ +/* + * 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.ui.trace; + +/** + * @author peng-yongsheng + */ +public class BasicTrace { + private String operationName; + private int duration; + private String start; + private Boolean isError; + private String traceId; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/KeyValue.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/KeyValue.java new file mode 100644 index 000000000..03e1d6857 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/KeyValue.java @@ -0,0 +1,27 @@ +/* + * 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.ui.trace; + +/** + * @author peng-yongsheng + */ +public class KeyValue { + private String key; + private String value; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/LogEntity.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/LogEntity.java new file mode 100644 index 000000000..61855c8ea --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/LogEntity.java @@ -0,0 +1,29 @@ +/* + * 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.ui.trace; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class LogEntity { + private String time; + private List data; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Ref.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Ref.java new file mode 100644 index 000000000..a013e0c1a --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Ref.java @@ -0,0 +1,29 @@ +/* + * 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.ui.trace; + +/** + * @author peng-yongsheng + */ +public class Ref { + private String traceId; + private Integer parentSegmentId; + private Integer parentSpanId; + private RefType type; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/RefType.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/RefType.java new file mode 100644 index 000000000..00eca2080 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/RefType.java @@ -0,0 +1,27 @@ +/* + * 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.ui.trace; + +/** + * @author peng-yongsheng + */ +public enum RefType { + CROSS_PROCESS, + CROSS_THREAD +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Segment.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Segment.java new file mode 100644 index 000000000..62fc6ab3d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Segment.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.ui.trace; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class Segment { + private int segmentId; + private String appName; + private Boolean isSizeLimited; + private List spans; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Span.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Span.java new file mode 100644 index 000000000..1df21844c --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Span.java @@ -0,0 +1,43 @@ +/* + * 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.ui.trace; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class Span { + private String traceId; + private String segmentId; + private Integer spanId; + private Integer parentSpanId; + private List refs; + private String applicationCode; + private Long startTime; + private Long endTime; + private String operationName; + private String type; + private String peer; + private String component; + private Boolean isError; + private String layer; + private List tags; + private List logs; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Trace.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Trace.java new file mode 100644 index 000000000..a9f03964f --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/Trace.java @@ -0,0 +1,28 @@ +/* + * 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.ui.trace; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class Trace { + private List spans; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceBrief.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceBrief.java new file mode 100644 index 000000000..1ec1987e3 --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceBrief.java @@ -0,0 +1,29 @@ +/* + * 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.ui.trace; + +import java.util.List; + +/** + * @author peng-yongsheng + */ +public class TraceBrief { + private List traces; + private Integer total; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java new file mode 100644 index 000000000..62757804d --- /dev/null +++ b/apm-collector/apm-collector-storage/collector-storage-define/src/main/java/org/apache/skywalking/apm/collector/storage/ui/trace/TraceQueryCondition.java @@ -0,0 +1,36 @@ +/* + * 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.ui.trace; + +import java.util.List; +import org.apache.skywalking.apm.collector.storage.ui.common.Duration; + +/** + * @author peng-yongsheng + */ +public class TraceQueryCondition { + private List applicationCodes; + private String traceId; + private String operationName; + private Duration queryDuration; + private int minTraceDuration; + private int maxTraceDuration; + private Boolean topN; + private int needTotal; +} diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/CpuMetricEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/CpuMetricEsUIDAO.java index 9ca846133..788bc5fc1 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/CpuMetricEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/CpuMetricEsUIDAO.java @@ -21,7 +21,6 @@ package org.apache.skywalking.apm.collector.storage.es.dao; import com.google.gson.JsonArray; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable; @@ -54,7 +53,7 @@ public class CpuMetricEsUIDAO extends EsDAO implements ICpuMetricUIDAO { long timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String id = timeBucket + Const.ID_SPLIT + instanceId; prepareMultiGet.add(CpuMetricTable.TABLE, CpuMetricTable.TABLE_TYPE, id); } diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsUIDAO.java index 068955095..75f2e7cc8 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/GCMetricEsUIDAO.java @@ -22,7 +22,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; @@ -112,7 +111,7 @@ public class GCMetricEsUIDAO extends EsDAO implements IGCMetricUIDAO { MultiGetRequestBuilder youngPrepareMultiGet = getClient().prepareMultiGet(); long timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String youngId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.NEW_VALUE; youngPrepareMultiGet.add(GCMetricTable.TABLE, GCMetricTable.TABLE_TYPE, youngId); } @@ -132,7 +131,7 @@ public class GCMetricEsUIDAO extends EsDAO implements IGCMetricUIDAO { MultiGetRequestBuilder oldPrepareMultiGet = getClient().prepareMultiGet(); timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String oldId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.OLD_VALUE; oldPrepareMultiGet.add(GCMetricTable.TABLE, GCMetricTable.TABLE_TYPE, oldId); } diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceEsUIDAO.java index 358650a76..7148c1704 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceEsUIDAO.java @@ -18,8 +18,6 @@ package org.apache.skywalking.apm.collector.storage.es.dao; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import java.util.LinkedList; import java.util.List; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; @@ -28,6 +26,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.register.Instance; import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable; +import org.apache.skywalking.apm.collector.storage.ui.application.Application; import org.elasticsearch.action.get.GetRequestBuilder; import org.elasticsearch.action.get.GetResponse; import org.elasticsearch.action.search.SearchRequestBuilder; @@ -95,7 +94,7 @@ public class InstanceEsUIDAO extends EsDAO implements IInstanceUIDAO { return heartBeatTime; } - @Override public JsonArray getApplications(long startTime, long endTime) { + @Override public List getApplications(long startTime, long endTime) { logger.debug("application list get, start time: {}, end time: {}", startTime, endTime); SearchRequestBuilder searchRequestBuilder = getClient().prepareSearch(InstanceTable.TABLE); searchRequestBuilder.setTypes(InstanceTable.TABLE_TYPE); @@ -108,16 +107,16 @@ public class InstanceEsUIDAO extends EsDAO implements IInstanceUIDAO { SearchResponse searchResponse = searchRequestBuilder.execute().actionGet(); Terms genders = searchResponse.getAggregations().get(InstanceTable.COLUMN_APPLICATION_ID); - JsonArray applications = new JsonArray(); + List applications = new LinkedList<>(); for (Terms.Bucket applicationsBucket : genders.getBuckets()) { Integer applicationId = applicationsBucket.getKeyAsNumber().intValue(); logger.debug("applicationId: {}", applicationId); ValueCount instanceCount = applicationsBucket.getAggregations().get(InstanceTable.COLUMN_INSTANCE_ID); - JsonObject application = new JsonObject(); - application.addProperty("applicationId", applicationId); - application.addProperty("instanceCount", instanceCount.getValue()); + Application application = new Application(); + application.setId(applicationId); + application.setNumOfServer((int)instanceCount.getValue()); applications.add(application); } return applications; diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceMetricEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceMetricEsUIDAO.java index de6657339..591e8e32d 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceMetricEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/InstanceMetricEsUIDAO.java @@ -21,7 +21,6 @@ package org.apache.skywalking.apm.collector.storage.es.dao; import com.google.gson.JsonArray; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; @@ -86,7 +85,7 @@ public class InstanceMetricEsUIDAO extends EsDAO implements IInstanceMetricUIDAO do { String id = timeBucket + Const.ID_SPLIT + instanceId; prepareMultiGet.add(InstanceMetricTable.TABLE, InstanceMetricTable.TABLE_TYPE, id); - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); } while (timeBucket <= endTimeBucket); @@ -118,9 +117,9 @@ public class InstanceMetricEsUIDAO extends EsDAO implements IInstanceMetricUIDAO MultiGetRequestBuilder prepareMultiGet = getClient().prepareMultiGet(); int i = 0; - long timeBucket; + long timeBucket = 0; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), startTimeBucket, i); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, startTimeBucket, i); String id = timeBucket + Const.ID_SPLIT + instanceId; prepareMultiGet.add(InstanceMetricTable.TABLE, InstanceMetricTable.TABLE_TYPE, id); i++; diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java index 8caa326e7..5bcfc5c69 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryMetricEsUIDAO.java @@ -22,7 +22,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; @@ -63,7 +62,7 @@ public class MemoryMetricEsUIDAO extends EsDAO implements IMemoryMetricUIDAO { int i = 0; long timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + isHeap; prepareMultiGet.add(MemoryMetricTable.TABLE, MemoryMetricTable.TABLE_TYPE, id); } diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryPoolMetricEsUIDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryPoolMetricEsUIDAO.java index dc5b4b333..54a40c738 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryPoolMetricEsUIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/MemoryPoolMetricEsUIDAO.java @@ -22,7 +22,6 @@ import com.google.gson.JsonArray; import com.google.gson.JsonObject; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricUIDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; @@ -62,7 +61,7 @@ public class MemoryPoolMetricEsUIDAO extends EsDAO implements IMemoryPoolMetricU long timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + poolType; prepareMultiGet.add(MemoryPoolMetricTable.TABLE, MemoryPoolMetricTable.TABLE_TYPE, id); } diff --git a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java index c9b54be66..460b3e3fe 100644 --- a/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-es-provider/src/main/java/org/apache/skywalking/apm/collector/storage/es/dao/register/InstanceRegisterEsDAO.java @@ -21,6 +21,7 @@ package org.apache.skywalking.apm.collector.storage.es.dao.register; import java.util.HashMap; import java.util.Map; import org.apache.skywalking.apm.collector.client.elasticsearch.ElasticSearchClient; +import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO; import org.apache.skywalking.apm.collector.storage.es.base.dao.EsDAO; import org.apache.skywalking.apm.collector.storage.table.register.Instance; @@ -57,8 +58,8 @@ public class InstanceRegisterEsDAO extends EsDAO implements IInstanceRegisterDAO source.put(InstanceTable.COLUMN_INSTANCE_ID, instance.getInstanceId()); source.put(InstanceTable.COLUMN_APPLICATION_ID, instance.getApplicationId()); source.put(InstanceTable.COLUMN_AGENT_UUID, instance.getAgentUUID()); - source.put(InstanceTable.COLUMN_REGISTER_TIME, instance.getRegisterTime()); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, instance.getHeartBeatTime()); + source.put(InstanceTable.COLUMN_REGISTER_TIME, TimeBucketUtils.INSTANCE.getSecondTimeBucket(instance.getRegisterTime())); + source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, TimeBucketUtils.INSTANCE.getSecondTimeBucket(instance.getHeartBeatTime())); source.put(InstanceTable.COLUMN_OS_INFO, instance.getOsInfo()); source.put(InstanceTable.COLUMN_ADDRESS_ID, instance.getAddressId()); source.put(InstanceTable.COLUMN_IS_ADDRESS, instance.getIsAddress()); @@ -76,7 +77,7 @@ public class InstanceRegisterEsDAO extends EsDAO implements IInstanceRegisterDAO updateRequest.setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE); Map source = new HashMap<>(); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, heartbeatTime); + source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, TimeBucketUtils.INSTANCE.getSecondTimeBucket(heartbeatTime)); updateRequest.doc(source); client.update(updateRequest); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuMetricH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuMetricH2UIDAO.java index 5f840cb6d..e3ec3d908 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuMetricH2UIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/CpuMetricH2UIDAO.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.dao; import com.google.gson.JsonArray; @@ -24,14 +23,13 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable; import org.apache.skywalking.apm.collector.client.h2.H2Client; import org.apache.skywalking.apm.collector.client.h2.H2ClientException; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.storage.dao.ICpuMetricUIDAO; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.CpuMetricTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -68,7 +66,7 @@ public class CpuMetricH2UIDAO extends H2DAO implements ICpuMetricUIDAO { long timeBucket = startTimeBucket; List idList = new ArrayList<>(); do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String id = timeBucket + Const.ID_SPLIT + instanceId; idList.add(id); } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2UIDAO.java index 8cf181341..4c33c3536 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2UIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/GCMetricH2UIDAO.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.dao; import com.google.gson.JsonArray; @@ -25,14 +24,13 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; +import org.apache.skywalking.apm.collector.client.h2.H2Client; +import org.apache.skywalking.apm.collector.client.h2.H2ClientException; import org.apache.skywalking.apm.collector.core.util.Const; import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO; -import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; -import org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.client.h2.H2ClientException; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; +import org.apache.skywalking.apm.collector.storage.table.jvm.GCMetricTable; import org.apache.skywalking.apm.network.proto.GCPhrase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -119,7 +117,7 @@ public class GCMetricH2UIDAO extends H2DAO implements IGCMetricUIDAO { long timeBucket = startTimeBucket; List youngIdsList = new ArrayList<>(); do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String youngId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.NEW_VALUE; youngIdsList.add(youngId); } @@ -132,7 +130,7 @@ public class GCMetricH2UIDAO extends H2DAO implements IGCMetricUIDAO { List oldIdsList = new ArrayList<>(); timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String oldId = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + GCPhrase.OLD_VALUE; oldIdsList.add(oldId); } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2UIDAO.java index 674cbee05..a13ed2a2a 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2UIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceH2UIDAO.java @@ -18,8 +18,6 @@ package org.apache.skywalking.apm.collector.storage.h2.dao; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; import java.sql.ResultSet; import java.sql.SQLException; import java.util.LinkedList; @@ -32,6 +30,7 @@ import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; import org.apache.skywalking.apm.collector.storage.table.register.Instance; import org.apache.skywalking.apm.collector.storage.table.register.InstanceTable; +import org.apache.skywalking.apm.collector.storage.ui.application.Application; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,9 +87,9 @@ public class InstanceH2UIDAO extends H2DAO implements IInstanceUIDAO { } @Override - public JsonArray getApplications(long startTime, long endTime) { + public List getApplications(long startTime, long endTime) { H2Client client = getClient(); - JsonArray applications = new JsonArray(); + List applications = new LinkedList<>(); String sql = SqlBuilder.buildSql(GET_APPLICATIONS_SQL, InstanceTable.COLUMN_INSTANCE_ID, InstanceTable.TABLE, InstanceTable.COLUMN_HEARTBEAT_TIME, InstanceTable.COLUMN_APPLICATION_ID); Object[] params = new Object[] {startTime}; @@ -98,9 +97,9 @@ public class InstanceH2UIDAO extends H2DAO implements IInstanceUIDAO { while (rs.next()) { Integer applicationId = rs.getInt(InstanceTable.COLUMN_APPLICATION_ID); logger.debug("applicationId: {}", applicationId); - JsonObject application = new JsonObject(); - application.addProperty("applicationId", applicationId); - application.addProperty("instanceCount", rs.getInt("cnt")); + Application application = new Application(); + application.setId(applicationId); + application.setNumOfServer(rs.getInt("cnt")); applications.add(application); } } catch (SQLException | H2ClientException e) { diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMetricH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMetricH2UIDAO.java index 91c23d276..77b3185bb 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMetricH2UIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/InstanceMetricH2UIDAO.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.dao; import com.google.gson.JsonArray; @@ -25,12 +24,11 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.apache.skywalking.apm.collector.client.h2.H2Client; -import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; -import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; import org.apache.skywalking.apm.collector.client.h2.H2ClientException; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO; +import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; import org.apache.skywalking.apm.collector.storage.table.instance.InstanceMetricTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -100,7 +98,7 @@ public class InstanceMetricH2UIDAO extends H2DAO implements IInstanceMetricUIDAO List idList = new ArrayList<>(); do { String id = timeBucket + Const.ID_SPLIT + instanceId; - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); idList.add(id); } while (timeBucket <= endTimeBucket); @@ -145,7 +143,7 @@ public class InstanceMetricH2UIDAO extends H2DAO implements IInstanceMetricUIDAO List idList = new ArrayList<>(); do { String id = timeBucket + Const.ID_SPLIT + instanceId; - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); idList.add(id); } while (timeBucket <= endTimeBucket); diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java index 26f7f5644..01e9e5425 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryMetricH2UIDAO.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.dao; import com.google.gson.JsonArray; @@ -26,12 +25,11 @@ import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import org.apache.skywalking.apm.collector.client.h2.H2Client; +import org.apache.skywalking.apm.collector.client.h2.H2ClientException; import org.apache.skywalking.apm.collector.core.util.Const; import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.storage.dao.IMemoryMetricUIDAO; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; -import org.apache.skywalking.apm.collector.client.h2.H2ClientException; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryMetricTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -76,7 +74,7 @@ public class MemoryMetricH2UIDAO extends H2DAO implements IMemoryMetricUIDAO { List idList = new ArrayList<>(); long timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + isHeap; idList.add(id); } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryPoolMetricH2UIDAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryPoolMetricH2UIDAO.java index d4a5b11ae..c7aa20427 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryPoolMetricH2UIDAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/MemoryPoolMetricH2UIDAO.java @@ -16,7 +16,6 @@ * */ - package org.apache.skywalking.apm.collector.storage.h2.dao; import com.google.gson.JsonArray; @@ -25,11 +24,10 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; -import org.apache.skywalking.apm.collector.core.util.Const; -import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.client.h2.H2Client; import org.apache.skywalking.apm.collector.client.h2.H2ClientException; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +import org.apache.skywalking.apm.collector.core.util.Const; +import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.storage.dao.IMemoryPoolMetricUIDAO; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; import org.apache.skywalking.apm.collector.storage.table.jvm.MemoryPoolMetricTable; @@ -76,7 +74,7 @@ public class MemoryPoolMetricH2UIDAO extends H2DAO implements IMemoryPoolMetricU List idList = new ArrayList<>(); long timeBucket = startTimeBucket; do { - timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket, 1); +// timeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, 1); String id = timeBucket + Const.ID_SPLIT + instanceId + Const.ID_SPLIT + poolType; idList.add(id); } diff --git a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java index 45edf55a0..e1042f5dc 100644 --- a/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java +++ b/apm-collector/apm-collector-storage/collector-storage-h2-provider/src/main/java/org/apache/skywalking/apm/collector/storage/h2/dao/register/InstanceRegisterH2DAO.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Map; import org.apache.skywalking.apm.collector.client.h2.H2Client; import org.apache.skywalking.apm.collector.client.h2.H2ClientException; +import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; import org.apache.skywalking.apm.collector.storage.base.sql.SqlBuilder; import org.apache.skywalking.apm.collector.storage.dao.register.IInstanceRegisterDAO; import org.apache.skywalking.apm.collector.storage.h2.base.dao.H2DAO; @@ -58,8 +59,8 @@ public class InstanceRegisterH2DAO extends H2DAO implements IInstanceRegisterDAO source.put(InstanceTable.COLUMN_INSTANCE_ID, instance.getInstanceId()); source.put(InstanceTable.COLUMN_APPLICATION_ID, instance.getApplicationId()); source.put(InstanceTable.COLUMN_AGENT_UUID, instance.getAgentUUID()); - source.put(InstanceTable.COLUMN_REGISTER_TIME, instance.getRegisterTime()); - source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, instance.getHeartBeatTime()); + source.put(InstanceTable.COLUMN_REGISTER_TIME, TimeBucketUtils.INSTANCE.getSecondTimeBucket(instance.getRegisterTime())); + source.put(InstanceTable.COLUMN_HEARTBEAT_TIME, TimeBucketUtils.INSTANCE.getSecondTimeBucket(instance.getHeartBeatTime())); source.put(InstanceTable.COLUMN_OS_INFO, instance.getOsInfo()); source.put(InstanceTable.COLUMN_ADDRESS_ID, instance.getAddressId()); source.put(InstanceTable.COLUMN_IS_ADDRESS, instance.getIsAddress()); @@ -77,7 +78,7 @@ public class InstanceRegisterH2DAO extends H2DAO implements IInstanceRegisterDAO H2Client client = getClient(); String sql = SqlBuilder.buildSql(UPDATE_HEARTBEAT_TIME_SQL, InstanceTable.TABLE, InstanceTable.COLUMN_HEARTBEAT_TIME, InstanceTable.COLUMN_ID); - Object[] params = new Object[] {heartbeatTime, instanceId}; + Object[] params = new Object[] {TimeBucketUtils.INSTANCE.getSecondTimeBucket(heartbeatTime), instanceId}; try { client.execute(sql, params); } catch (H2ClientException e) { diff --git a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/GraphQLCreator.java b/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/GraphQLCreator.java deleted file mode 100644 index f6df67125..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/GraphQLCreator.java +++ /dev/null @@ -1,59 +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.graphql; - -import com.coxautodev.graphql.tools.SchemaParser; -import graphql.GraphQL; -import graphql.schema.GraphQLSchema; -import org.apache.skywalking.apm.collector.ui.graphql.alarm.AlarmQuery; -import org.apache.skywalking.apm.collector.ui.graphql.application.ApplicationQuery; -import org.apache.skywalking.apm.collector.ui.graphql.application.ConjecturalNode; -import org.apache.skywalking.apm.collector.ui.graphql.common.VisualUserNode; -import org.apache.skywalking.apm.collector.ui.graphql.config.ConfigMutation; -import org.apache.skywalking.apm.collector.ui.graphql.config.ConfigQuery; -import org.apache.skywalking.apm.collector.ui.graphql.overview.OverViewLayerQuery; -import org.apache.skywalking.apm.collector.ui.graphql.server.ServerQuery; -import org.apache.skywalking.apm.collector.ui.graphql.service.ServiceQuery; -import org.apache.skywalking.apm.collector.ui.graphql.trace.TraceQuery; - -/** - * @author peng-yongsheng - */ -public class GraphQLCreator { - - public GraphQL create() { - GraphQLSchema schema = SchemaParser.newParser() - .file("ui-graphql/alarm.graphqls") - .file("ui-graphql/application-layer.graphqls") - .file("ui-graphql/common.graphqls") - .file("ui-graphql/config.graphqls") - .file("ui-graphql/overview-layer.graphqls") - .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()) - .resolvers(new OverViewLayerQuery(), new ServerQuery(), new ServiceQuery(), new TraceQuery()) - .resolvers(new ConfigQuery(), new ConfigMutation()) - .dictionary(ConjecturalNode.class, VisualUserNode.class) - .build() - .makeExecutableSchema(); - - return GraphQL.newGraphQL(schema).build(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/utils/DurationUtils.java b/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/utils/DurationUtils.java new file mode 100644 index 000000000..e5f3838f3 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-graphql/src/main/java/org/apache/skywalking/apm/collector/ui/graphql/utils/DurationUtils.java @@ -0,0 +1,54 @@ +/* + * 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.graphql.utils; + +import java.text.ParseException; + +/** + * @author peng-yongsheng + */ +public enum DurationUtils { + INSTANCE; + + public long exchangeToTimeBucket(String dateStr) throws ParseException { + dateStr = dateStr.replaceAll("-", ""); + dateStr = dateStr.replaceAll(" ", ""); + return Long.valueOf(dateStr); + } + + public long monthDurationToSecondTimeBucket(String dateStr) throws ParseException { + long month = exchangeToTimeBucket(dateStr); + return month * 100 * 100 * 100 * 100; + } + + public long dayDurationToSecondTimeBucket(String dateStr) throws ParseException { + long month = exchangeToTimeBucket(dateStr); + return month * 100 * 100 * 100; + } + + public long hourDurationToSecondTimeBucket(String dateStr) throws ParseException { + long month = exchangeToTimeBucket(dateStr); + return month * 100 * 100; + } + + public long minuteDurationToSecondTimeBucket(String dateStr) throws ParseException { + long month = exchangeToTimeBucket(dateStr); + return month * 100; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-graphql/src/test/java/org/apache/skywalking/apm/collector/ui/graphql/GraphQLCreatorTestCase.java b/apm-collector/apm-collector-ui/collector-ui-graphql/src/test/java/org/apache/skywalking/apm/collector/ui/graphql/utils/DurationUtilsTestCase.java similarity index 78% rename from apm-collector/apm-collector-ui/collector-ui-graphql/src/test/java/org/apache/skywalking/apm/collector/ui/graphql/GraphQLCreatorTestCase.java rename to apm-collector/apm-collector-ui/collector-ui-graphql/src/test/java/org/apache/skywalking/apm/collector/ui/graphql/utils/DurationUtilsTestCase.java index a232eb75e..89d1ee3ba 100644 --- a/apm-collector/apm-collector-ui/collector-ui-graphql/src/test/java/org/apache/skywalking/apm/collector/ui/graphql/GraphQLCreatorTestCase.java +++ b/apm-collector/apm-collector-ui/collector-ui-graphql/src/test/java/org/apache/skywalking/apm/collector/ui/graphql/utils/DurationUtilsTestCase.java @@ -16,19 +16,18 @@ * */ -package org.apache.skywalking.apm.collector.ui.graphql; +package org.apache.skywalking.apm.collector.ui.graphql.utils; -import graphql.GraphQL; +import java.text.ParseException; +import org.junit.Assert; import org.junit.Test; /** * @author peng-yongsheng */ -public class GraphQLCreatorTestCase { +public class DurationUtilsTestCase { @Test - public void test() { - GraphQLCreator creator = new GraphQLCreator(); - GraphQL graphQL = creator.create(); + public void test() throws ParseException { } } diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/UIModuleJettyProvider.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/UIModuleJettyProvider.java index c3876eeb8..d01cda2b1 100644 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/UIModuleJettyProvider.java +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/UIModuleJettyProvider.java @@ -34,20 +34,8 @@ import org.apache.skywalking.apm.collector.server.Server; import org.apache.skywalking.apm.collector.storage.StorageModule; import org.apache.skywalking.apm.collector.ui.UIModule; import org.apache.skywalking.apm.collector.ui.jetty.handler.GraphQLHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.SegmentTopGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.SpanGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.TraceDagGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.TraceStackGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.application.ApplicationsGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.instancehealth.InstanceHealthGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceMetricGetOneTimeBucketHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceMetricGetRangeTimeBucketHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.instancemetric.InstanceOsInfoGetHandler; import org.apache.skywalking.apm.collector.ui.jetty.handler.naming.UIJettyNamingHandler; import org.apache.skywalking.apm.collector.ui.jetty.handler.naming.UIJettyNamingListener; -import org.apache.skywalking.apm.collector.ui.jetty.handler.servicetree.ServiceTreeGetByIdHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.time.AllInstanceLastTimeGetHandler; -import org.apache.skywalking.apm.collector.ui.jetty.handler.time.OneInstanceLastTimeGetHandler; /** * @author peng-yongsheng @@ -99,19 +87,6 @@ public class UIModuleJettyProvider extends ModuleProvider { } private void addHandlers(Server jettyServer) { - jettyServer.addHandler(new ApplicationsGetHandler(getManager())); - jettyServer.addHandler(new InstanceHealthGetHandler(getManager())); - jettyServer.addHandler(new InstanceMetricGetOneTimeBucketHandler(getManager())); - jettyServer.addHandler(new InstanceMetricGetRangeTimeBucketHandler(getManager())); - jettyServer.addHandler(new InstanceOsInfoGetHandler(getManager())); - jettyServer.addHandler(new ServiceTreeGetByIdHandler(getManager())); - jettyServer.addHandler(new AllInstanceLastTimeGetHandler(getManager())); - jettyServer.addHandler(new OneInstanceLastTimeGetHandler(getManager())); - jettyServer.addHandler(new SegmentTopGetHandler(getManager())); - jettyServer.addHandler(new SpanGetHandler(getManager())); - jettyServer.addHandler(new TraceDagGetHandler(getManager())); - jettyServer.addHandler(new TraceStackGetHandler(getManager())); - - jettyServer.addHandler(new GraphQLHandler()); + jettyServer.addHandler(new GraphQLHandler(getManager())); } } 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 d5e38df4f..3deeb3b1a 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 @@ -18,6 +18,7 @@ package org.apache.skywalking.apm.collector.ui.jetty.handler; +import com.coxautodev.graphql.tools.SchemaParser; import com.google.gson.Gson; import com.google.gson.JsonArray; import com.google.gson.JsonElement; @@ -26,30 +27,67 @@ import graphql.ExecutionInput; import graphql.ExecutionResult; import graphql.GraphQL; import graphql.GraphQLError; +import graphql.schema.GraphQLSchema; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.List; import javax.servlet.http.HttpServletRequest; +import org.apache.skywalking.apm.collector.core.module.ModuleManager; import org.apache.skywalking.apm.collector.core.util.CollectionUtils; import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.graphql.GraphQLCreator; +import org.apache.skywalking.apm.collector.storage.ui.application.ApplicationNode; +import org.apache.skywalking.apm.collector.storage.ui.application.ConjecturalNode; +import org.apache.skywalking.apm.collector.storage.ui.common.VisualUserNode; +import org.apache.skywalking.apm.collector.ui.graphql.VersionMutation; +import org.apache.skywalking.apm.collector.ui.graphql.VersionQuery; +import org.apache.skywalking.apm.collector.ui.mutation.ConfigMutation; +import org.apache.skywalking.apm.collector.ui.query.AlarmQuery; +import org.apache.skywalking.apm.collector.ui.query.ApplicationQuery; +import org.apache.skywalking.apm.collector.ui.query.ConfigQuery; +import org.apache.skywalking.apm.collector.ui.query.OverViewLayerQuery; +import org.apache.skywalking.apm.collector.ui.query.ServerQuery; +import org.apache.skywalking.apm.collector.ui.query.ServiceQuery; +import org.apache.skywalking.apm.collector.ui.query.TraceQuery; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** * @author peng-yongsheng */ public class GraphQLHandler extends JettyHandler { + private final Logger logger = LoggerFactory.getLogger(GraphQLHandler.class); + + private final ModuleManager moduleManager; private final Gson gson = new Gson(); private final GraphQL graphQL; private static final String QUERY = "query"; private static final String DATA = "data"; private static final String ERRORS = "errors"; + private static final String MESSAGE = "message"; - public GraphQLHandler() { - GraphQLCreator creator = new GraphQLCreator(); - this.graphQL = creator.create(); + public GraphQLHandler(ModuleManager moduleManager) { + this.moduleManager = moduleManager; + + GraphQLSchema schema = SchemaParser.newParser() + .file("ui-graphql/alarm.graphqls") + .file("ui-graphql/application-layer.graphqls") + .file("ui-graphql/common.graphqls") + .file("ui-graphql/config.graphqls") + .file("ui-graphql/overview-layer.graphqls") + .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 OverViewLayerQuery(moduleManager), new ServerQuery(), new ServiceQuery(), new TraceQuery()) + .resolvers(new ConfigQuery(), new ConfigMutation()) + .dictionary(ConjecturalNode.class, VisualUserNode.class, ApplicationNode.class) + .build() + .makeExecutableSchema(); + + this.graphQL = GraphQL.newGraphQL(schema).build(); } @Override public String pathSpec() { @@ -73,21 +111,40 @@ public class GraphQLHandler extends JettyHandler { } private JsonObject execute(String request) { - ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(request).build(); - ExecutionResult executionResult = graphQL.execute(executionInput); + try { + ExecutionInput executionInput = ExecutionInput.newExecutionInput().query(request).build(); + ExecutionResult executionResult = graphQL.execute(executionInput); + Object data = executionResult.getData(); + List errors = executionResult.getErrors(); - Object data = executionResult.getData(); - List errors = executionResult.getErrors(); + JsonObject jsonObject = new JsonObject(); + if (data != null) { + jsonObject.addProperty(DATA, data.toString()); + } - JsonObject jsonObject = new JsonObject(); - jsonObject.addProperty(DATA, data.toString()); + if (CollectionUtils.isNotEmpty(errors)) { + JsonArray errorArray = new JsonArray(); + errors.forEach(error -> { + JsonObject errorJson = new JsonObject(); + errorJson.addProperty(MESSAGE, error.getMessage()); + errorArray.add(errorJson); + }); + + jsonObject.add(ERRORS, errorArray); + } + + return jsonObject; + } catch (Throwable e) { + logger.error(e.getMessage(), e); + JsonObject jsonObject = new JsonObject(); + + JsonArray errorArray = new JsonArray(); + JsonObject errorJson = new JsonObject(); + errorJson.addProperty(MESSAGE, e.getMessage()); + errorArray.add(errorJson); - if (CollectionUtils.isNotEmpty(errors)) { - String errorJsonStr = gson.toJson(errors, JsonArray.class); - JsonArray errorArray = gson.fromJson(errorJsonStr, JsonArray.class); jsonObject.add(ERRORS, errorArray); + return jsonObject; } - - return jsonObject; } } diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java deleted file mode 100644 index 4cdeaf384..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/SegmentTopGetHandler.java +++ /dev/null @@ -1,141 +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.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.storage.dao.ISegmentCostUIDAO; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.core.util.StringUtils; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.SegmentTopService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SegmentTopGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(SegmentTopGetHandler.class); - - @Override public String pathSpec() { - return "/segment/top"; - } - - private final SegmentTopService service; - - public SegmentTopGetHandler(ModuleManager moduleManager) { - this.service = new SegmentTopService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime") || !req.getParameterMap().containsKey("from") || !req.getParameterMap().containsKey("limit")) { - throw new ArgumentsParseException("the request parameter must contains startTime, endTime, from, limit"); - } - - if (logger.isDebugEnabled()) { - logger.debug("startTime: {}, endTime: {}, from: {}", req.getParameter("startTime"), req.getParameter("endTime"), req.getParameter("from")); - } - - long startTime; - try { - startTime = Long.valueOf(req.getParameter("startTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter startTime must be a long"); - } - - long endTime; - try { - endTime = Long.valueOf(req.getParameter("endTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter endTime must be a long"); - } - - int from; - try { - from = Integer.valueOf(req.getParameter("from")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter from must be an integer"); - } - - int limit; - try { - limit = Integer.valueOf(req.getParameter("limit")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter from must be an integer"); - } - - int minCost = -1; - if (req.getParameterMap().containsKey("minCost")) { - minCost = Integer.valueOf(req.getParameter("minCost")); - } - int maxCost = -1; - if (req.getParameterMap().containsKey("maxCost")) { - maxCost = Integer.valueOf(req.getParameter("maxCost")); - } - - String globalTraceId = null; - if (req.getParameterMap().containsKey("globalTraceId")) { - globalTraceId = req.getParameter("globalTraceId"); - } - - String operationName = null; - if (req.getParameterMap().containsKey("operationName")) { - operationName = req.getParameter("operationName"); - } - - int applicationId; - try { - applicationId = Integer.valueOf(req.getParameter("applicationId")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter applicationId must be a int"); - } - - ISegmentCostUIDAO.Error error; - String errorStr = req.getParameter("error"); - if (StringUtils.isNotEmpty(errorStr)) { - if ("true".equals(errorStr)) { - error = ISegmentCostUIDAO.Error.True; - } else if ("false".equals(errorStr)) { - error = ISegmentCostUIDAO.Error.False; - } else { - error = ISegmentCostUIDAO.Error.All; - } - } else { - error = ISegmentCostUIDAO.Error.All; - } - - ISegmentCostUIDAO.Sort sort = ISegmentCostUIDAO.Sort.Cost; - if (req.getParameterMap().containsKey("sort")) { - String sortStr = req.getParameter("sort"); - if (sortStr.toLowerCase().equals(ISegmentCostUIDAO.Sort.Time.name().toLowerCase())) { - sort = ISegmentCostUIDAO.Sort.Time; - } - } - - return service.loadTop(startTime, endTime, minCost, maxCost, operationName, globalTraceId, error, applicationId, limit, from, sort); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java deleted file mode 100644 index bb14254b5..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/SpanGetHandler.java +++ /dev/null @@ -1,66 +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.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.SpanService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class SpanGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(SpanGetHandler.class); - - @Override public String pathSpec() { - return "/span/spanId"; - } - - private final SpanService service; - - public SpanGetHandler(ModuleManager moduleManager) { - this.service = new SpanService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String segmentId = req.getParameter("segmentId"); - String spanIdStr = req.getParameter("spanId"); - logger.debug("segmentSpanId: {}, spanIdStr: {}", segmentId, spanIdStr); - - int spanId; - try { - spanId = Integer.parseInt(spanIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("span id must be integer"); - } - - return service.load(segmentId, spanId); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java deleted file mode 100644 index 34143ce3b..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/TraceDagGetHandler.java +++ /dev/null @@ -1,77 +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.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.TraceDagService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceDagGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(TraceDagGetHandler.class); - - @Override public String pathSpec() { - return "/traceDag"; - } - - private final TraceDagService service; - - public TraceDagGetHandler(ModuleManager moduleManager) { - this.service = new TraceDagService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime")) { - throw new ArgumentsParseException("the request parameter must contains startTime, endTime"); - } - - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - logger.debug("startTime: {}, endTimeStr: {}", startTimeStr, endTimeStr); - - long startTime; - try { - startTime = Long.valueOf(req.getParameter("startTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter startTime must be a long"); - } - - long endTime; - try { - endTime = Long.valueOf(req.getParameter("endTime")); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("the request parameter endTime must be a long"); - } - - return service.load(startTime, endTime); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java deleted file mode 100644 index 368348abd..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/TraceStackGetHandler.java +++ /dev/null @@ -1,58 +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.jetty.handler; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.TraceStackService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class TraceStackGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(TraceStackGetHandler.class); - - @Override public String pathSpec() { - return "/traceStack/globalTraceId"; - } - - private final TraceStackService service; - - public TraceStackGetHandler(ModuleManager moduleManager) { - this.service = new TraceStackService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String globalTraceId = req.getParameter("globalTraceId"); - logger.debug("globalTraceId: {}", globalTraceId); - - return service.load(globalTraceId); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java deleted file mode 100644 index 51ddcc6ce..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/application/ApplicationsGetHandler.java +++ /dev/null @@ -1,77 +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.jetty.handler.application; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.ui.service.ApplicationService; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ApplicationsGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(ApplicationsGetHandler.class); - - @Override public String pathSpec() { - return "/applications"; - } - - private final ApplicationService applicationService; - - public ApplicationsGetHandler(ModuleManager moduleManager) { - this.applicationService = new ApplicationService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime")) { - throw new ArgumentsParseException("must contains startTime. endTime parameter"); - } - - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - logger.debug("applications getApplicationIdByCode start time: {}, end time: {}", startTimeStr, endTimeStr); - - long startTime; - try { - startTime = Long.parseLong(startTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start time must be long"); - } - - long endTime; - try { - endTime = Long.parseLong(endTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end time must be long"); - } - - return applicationService.getApplications(startTime, endTime); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java deleted file mode 100644 index 008f4e143..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancehealth/InstanceHealthGetHandler.java +++ /dev/null @@ -1,85 +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.jetty.handler.instancehealth; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.InstanceHealthService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceHealthGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceHealthGetHandler.class); - - @Override public String pathSpec() { - return "/instance/health/applicationId"; - } - - private final InstanceHealthService service; - - public InstanceHealthGetHandler(ModuleManager moduleManager) { - this.service = new InstanceHealthService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String timeBucketStr = req.getParameter("timeBucket"); - String[] applicationIdsStr = req.getParameterValues("applicationIds"); - logger.debug("instance health getApplicationIdByCode timeBucket: {}, applicationIdsStr: {}", timeBucketStr, applicationIdsStr); - - long timeBucket; - try { - timeBucket = Long.parseLong(timeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("timestamp must be long"); - } - - int[] applicationIds = new int[applicationIdsStr.length]; - for (int i = 0; i < applicationIdsStr.length; i++) { - try { - applicationIds[i] = Integer.parseInt(applicationIdsStr[i]); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("application id must be integer"); - } - } - - JsonObject response = new JsonObject(); - response.addProperty("timeBucket", timeBucket); - JsonArray appInstances = new JsonArray(); - response.add("appInstances", appInstances); - - for (int applicationId : applicationIds) { - appInstances.add(service.getInstances(timeBucket, applicationId)); - } - return response; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java deleted file mode 100644 index 15e73ce93..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetOneTimeBucketHandler.java +++ /dev/null @@ -1,86 +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.jetty.handler.instancemetric; - -import com.google.gson.JsonElement; -import java.util.LinkedHashSet; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.InstanceJVMService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceMetricGetOneTimeBucketHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceMetricGetOneTimeBucketHandler.class); - - @Override public String pathSpec() { - return "/instance/jvm/instanceId/oneBucket"; - } - - private final InstanceJVMService service; - - public InstanceMetricGetOneTimeBucketHandler(ModuleManager moduleManager) { - this.service = new InstanceJVMService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String timeBucketStr = req.getParameter("timeBucket"); - String instanceIdStr = req.getParameter("instanceId"); - String[] metricTypes = req.getParameterValues("metricTypes"); - - logger.debug("instance jvm metric getApplicationIdByCode timeBucket: {}, instance id: {}, metric types: {}", timeBucketStr, instanceIdStr, metricTypes); - - long timeBucket; - try { - timeBucket = Long.parseLong(timeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("timeBucket must be long"); - } - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("instance id must be integer"); - } - - if (metricTypes.length == 0) { - throw new ArgumentsParseException("at least one metric type"); - } - - Set metricTypeSet = new LinkedHashSet<>(); - for (String metricType : metricTypes) { - metricTypeSet.add(metricType); - } - - return service.getInstanceJvmMetric(instanceId, metricTypeSet, timeBucket); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java deleted file mode 100644 index a78c63dca..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceMetricGetRangeTimeBucketHandler.java +++ /dev/null @@ -1,94 +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.jetty.handler.instancemetric; - -import com.google.gson.JsonElement; -import java.util.LinkedHashSet; -import java.util.Set; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.InstanceJVMService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceMetricGetRangeTimeBucketHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceMetricGetRangeTimeBucketHandler.class); - - @Override public String pathSpec() { - return "/instance/jvm/instanceId/rangeBucket"; - } - - private final InstanceJVMService service; - - public InstanceMetricGetRangeTimeBucketHandler(ModuleManager moduleManager) { - this.service = new InstanceJVMService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String startTimeBucketStr = req.getParameter("startTimeBucket"); - String endTimeBucketStr = req.getParameter("endTimeBucket"); - String instanceIdStr = req.getParameter("instanceId"); - String[] metricTypes = req.getParameterValues("metricTypes"); - - logger.debug("instance jvm metric getApplicationIdByCode start timeBucket: {}, end timeBucket:{} , instance id: {}, metric types: {}", startTimeBucketStr, endTimeBucketStr, instanceIdStr, metricTypes); - - long startTimeBucket; - try { - startTimeBucket = Long.parseLong(startTimeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start timeBucket must be long"); - } - - long endTimeBucket; - try { - endTimeBucket = Long.parseLong(endTimeBucketStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end timeBucket must be long"); - } - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("instance id must be integer"); - } - - if (metricTypes.length == 0) { - throw new ArgumentsParseException("at least one metric type"); - } - - Set metricTypeSet = new LinkedHashSet<>(); - for (String metricType : metricTypes) { - metricTypeSet.add(metricType); - } - - return service.getInstanceJvmMetrics(instanceId, metricTypeSet, startTimeBucket, endTimeBucket); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java deleted file mode 100644 index 3b035f8eb..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/instancemetric/InstanceOsInfoGetHandler.java +++ /dev/null @@ -1,65 +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.jetty.handler.instancemetric; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.InstanceJVMService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class InstanceOsInfoGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(InstanceOsInfoGetHandler.class); - - @Override public String pathSpec() { - return "/instance/os/instanceId"; - } - - private final InstanceJVMService service; - - public InstanceOsInfoGetHandler(ModuleManager moduleManager) { - this.service = new InstanceJVMService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String instanceIdStr = req.getParameter("instanceId"); - logger.debug("instance os info getApplicationIdByCode, instance id: {}", instanceIdStr); - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("instance id must be integer"); - } - - return service.getInstanceOsInfo(instanceId); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java deleted file mode 100644 index 27ea8149f..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/servicetree/ServiceTreeGetByIdHandler.java +++ /dev/null @@ -1,85 +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.jetty.handler.servicetree; - -import com.google.gson.JsonElement; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.ui.service.ServiceTreeService; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class ServiceTreeGetByIdHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(ServiceTreeGetByIdHandler.class); - - @Override public String pathSpec() { - return "/service/tree/entryServiceId"; - } - - private final ServiceTreeService service; - - public ServiceTreeGetByIdHandler(ModuleManager moduleManager) { - this.service = new ServiceTreeService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - if (!req.getParameterMap().containsKey("entryServiceId") || !req.getParameterMap().containsKey("startTime") || !req.getParameterMap().containsKey("endTime")) { - throw new ArgumentsParseException("must contains parameters: entryServiceId, startTime, endTime"); - } - - String entryServiceIdStr = req.getParameter("entryServiceId"); - String startTimeStr = req.getParameter("startTime"); - String endTimeStr = req.getParameter("endTime"); - logger.debug("service entry getApplicationIdByCode entryServiceId: {}, startTime: {}, endTime: {}", entryServiceIdStr, startTimeStr, endTimeStr); - - int entryServiceId; - try { - entryServiceId = Integer.parseInt(entryServiceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("entry service id must be integer"); - } - - long startTime; - try { - startTime = Long.parseLong(startTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("start time must be long"); - } - - long endTime; - try { - endTime = Long.parseLong(endTimeStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("end time must be long"); - } - - return service.loadServiceTree(entryServiceId, startTime, endTime); - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java deleted file mode 100644 index f0ea90d7a..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/time/AllInstanceLastTimeGetHandler.java +++ /dev/null @@ -1,71 +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.jetty.handler.time; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import java.util.Calendar; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.TimeSynchronousService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class AllInstanceLastTimeGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(AllInstanceLastTimeGetHandler.class); - - @Override public String pathSpec() { - return "/time/allInstance"; - } - - private final TimeSynchronousService service; - - public AllInstanceLastTimeGetHandler(ModuleManager moduleManager) { - this.service = new TimeSynchronousService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - Long timeBucket = service.allInstanceLastTime(); - logger.debug("all instance last time: {}", timeBucket); - - if (timeBucket == 0) { - timeBucket = TimeBucketUtils.INSTANCE.getSecondTimeBucket(System.currentTimeMillis()); - } - Calendar calendar = Calendar.getInstance(); - calendar.setTimeInMillis(TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND.name(), timeBucket)); - calendar.add(Calendar.SECOND, -5); - timeBucket = calendar.getTimeInMillis(); - - JsonObject timeJson = new JsonObject(); - timeJson.addProperty("timeBucket", TimeBucketUtils.INSTANCE.getSecondTimeBucket(timeBucket)); - return timeJson; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java deleted file mode 100644 index 89aaa7093..000000000 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/jetty/handler/time/OneInstanceLastTimeGetHandler.java +++ /dev/null @@ -1,70 +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.jetty.handler.time; - -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import javax.servlet.http.HttpServletRequest; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.server.jetty.ArgumentsParseException; -import org.apache.skywalking.apm.collector.server.jetty.JettyHandler; -import org.apache.skywalking.apm.collector.ui.service.TimeSynchronousService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author peng-yongsheng - */ -public class OneInstanceLastTimeGetHandler extends JettyHandler { - - private final Logger logger = LoggerFactory.getLogger(OneInstanceLastTimeGetHandler.class); - - @Override public String pathSpec() { - return "/time/oneInstance"; - } - - private final TimeSynchronousService service; - - public OneInstanceLastTimeGetHandler(ModuleManager moduleManager) { - this.service = new TimeSynchronousService(moduleManager); - } - - @Override protected JsonElement doGet(HttpServletRequest req) throws ArgumentsParseException { - String instanceIdStr = req.getParameter("instanceId"); - logger.debug("instanceId: {}", instanceIdStr); - - int instanceId; - try { - instanceId = Integer.parseInt(instanceIdStr); - } catch (NumberFormatException e) { - throw new ArgumentsParseException("application instance id must be integer"); - } - - Long time = service.instanceLastTime(instanceId); - logger.debug("application instance id: {}, instance last time: {}", instanceId, time); - JsonObject timeJson = new JsonObject(); - timeJson.addProperty("timeBucket", time); - return timeJson; - } - - @Override protected JsonElement doPost(HttpServletRequest req) throws ArgumentsParseException { - throw new UnsupportedOperationException(); - } -} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/mutation/ConfigMutation.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/mutation/ConfigMutation.java new file mode 100644 index 000000000..ab2d80a09 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/mutation/ConfigMutation.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.ui.mutation; + +import java.util.List; +import org.apache.skywalking.apm.collector.storage.ui.config.AlarmThreshold; +import org.apache.skywalking.apm.collector.storage.ui.config.TTLConfigItem; +import org.apache.skywalking.apm.collector.ui.graphql.Mutation; + +/** + * @author peng-yongsheng + */ +public class ConfigMutation implements Mutation { + + public Boolean setDataTTLConfigs(List ttl) { + return null; + } + + public Boolean setAlarmThreshold(List thresholds) { + return null; + } +} 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 new file mode 100644 index 000000000..820b41a19 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/AlarmQuery.java @@ -0,0 +1,37 @@ +/* + * 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.query; + +import org.apache.skywalking.apm.collector.ui.graphql.Query; +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; + +/** + * @author peng-yongsheng + */ +public class AlarmQuery implements Query { + + public Alarm loadAlertList(String keyword, AlarmType alarmType, Duration duration, Pagination pagination) { + Alarm alarm = new Alarm(); + alarm.setCount(0); + return alarm; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQuery.java new file mode 100644 index 000000000..b8f09c622 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQuery.java @@ -0,0 +1,94 @@ +/* + * 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.query; + +import java.text.ParseException; +import java.util.List; +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.application.Application; +import org.apache.skywalking.apm.collector.storage.ui.common.Duration; +import org.apache.skywalking.apm.collector.storage.ui.common.Topology; +import org.apache.skywalking.apm.collector.storage.ui.server.AppServerInfo; +import org.apache.skywalking.apm.collector.storage.ui.service.ServiceInfo; +import org.apache.skywalking.apm.collector.ui.graphql.Query; +import org.apache.skywalking.apm.collector.ui.graphql.utils.DurationUtils; +import org.apache.skywalking.apm.collector.ui.service.ApplicationService; + +/** + * @author peng-yongsheng + */ +public class ApplicationQuery implements Query { + + private final ModuleManager moduleManager; + private ApplicationService applicationService; + + public ApplicationQuery(ModuleManager moduleManager) { + this.moduleManager = moduleManager; + } + + private ApplicationService getApplicationService() { + if (ObjectUtils.isEmpty(applicationService)) { + this.applicationService = new ApplicationService(moduleManager); + } + return applicationService; + } + + public List getAllApplication(Duration duration) throws ParseException { + long start = 0; + long end = 0; + + switch (duration.getStep()) { + case MONTH: + start = DurationUtils.INSTANCE.monthDurationToSecondTimeBucket(duration.getStart()); + end = DurationUtils.INSTANCE.monthDurationToSecondTimeBucket(duration.getEnd()); + break; + case DAY: + start = DurationUtils.INSTANCE.dayDurationToSecondTimeBucket(duration.getStart()); + end = DurationUtils.INSTANCE.dayDurationToSecondTimeBucket(duration.getEnd()); + break; + case HOUR: + start = DurationUtils.INSTANCE.hourDurationToSecondTimeBucket(duration.getStart()); + end = DurationUtils.INSTANCE.hourDurationToSecondTimeBucket(duration.getEnd()); + break; + case MINUTE: + start = DurationUtils.INSTANCE.minuteDurationToSecondTimeBucket(duration.getStart()); + end = DurationUtils.INSTANCE.minuteDurationToSecondTimeBucket(duration.getEnd()); + break; + case SECOND: + start = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getStart()); + end = DurationUtils.INSTANCE.exchangeToTimeBucket(duration.getEnd()); + break; + } + + return getApplicationService().getApplications(start, end); + } + + public Topology getApplicationTopology(int applicationId, Duration duration) { + return null; + } + + public List getSlowService(int applicationId, Duration duration, Integer top) { + return null; + } + + public List getServerThroughput(int applicationId, Duration duration, Integer top) { + return null; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ConfigQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ConfigQuery.java new file mode 100644 index 000000000..ce1d8d31f --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ConfigQuery.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.ui.query; + +import org.apache.skywalking.apm.collector.ui.graphql.Query; +import org.apache.skywalking.apm.collector.storage.ui.alarm.AlarmType; +import org.apache.skywalking.apm.collector.storage.ui.config.ExistedAlarmThresholds; +import org.apache.skywalking.apm.collector.storage.ui.config.ExistedTTLConfigs; + +/** + * @author peng-yongsheng + */ +public class ConfigQuery implements Query { + + public ExistedTTLConfigs queryAllDataTTLConfigs() { + return null; + } + + public ExistedAlarmThresholds queryAlarmThresholds(AlarmType alarmType) { + return null; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/OverViewLayerQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/OverViewLayerQuery.java new file mode 100644 index 000000000..539b3f1b9 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/OverViewLayerQuery.java @@ -0,0 +1,63 @@ +/* + * 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.query; + +import java.util.List; +import org.apache.skywalking.apm.collector.core.module.ModuleManager; +import org.apache.skywalking.apm.collector.storage.ui.common.Duration; +import org.apache.skywalking.apm.collector.storage.ui.common.Topology; +import org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend; +import org.apache.skywalking.apm.collector.storage.ui.overview.ClusterBrief; +import org.apache.skywalking.apm.collector.storage.ui.overview.ConjecturalAppBrief; +import org.apache.skywalking.apm.collector.storage.ui.server.AppServerInfo; +import org.apache.skywalking.apm.collector.storage.ui.service.ServiceInfo; +import org.apache.skywalking.apm.collector.ui.graphql.Query; + +/** + * @author peng-yongsheng + */ +public class OverViewLayerQuery implements Query { + + public OverViewLayerQuery(ModuleManager moduleManager) { + } + + public Topology getClusterTopology(Duration duration) { + return null; + } + + public ClusterBrief getClusterBrief(Duration duration) { + return null; + } + + public AlarmTrend getAlarmTrend(Duration duration) { + return null; + } + + public ConjecturalAppBrief getConjecturalApps(Duration duration) { + return null; + } + + public List getTopNSlowService(Duration duration, int topN) { + return null; + } + + public List getTopNServerThroughput(Duration duration, int topN) { + return null; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java new file mode 100644 index 000000000..7871337dc --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServerQuery.java @@ -0,0 +1,62 @@ +/* + * 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.query; + +import java.util.List; +import org.apache.skywalking.apm.collector.ui.graphql.Query; +import org.apache.skywalking.apm.collector.storage.ui.common.Duration; +import org.apache.skywalking.apm.collector.storage.ui.common.ResponseTimeTrend; +import org.apache.skywalking.apm.collector.storage.ui.common.ThroughputTrend; +import org.apache.skywalking.apm.collector.storage.ui.server.AppServerInfo; +import org.apache.skywalking.apm.collector.storage.ui.server.CPUTrend; +import org.apache.skywalking.apm.collector.storage.ui.server.GCTrend; +import org.apache.skywalking.apm.collector.storage.ui.server.MemoryTrend; + +/** + * @author peng-yongsheng + */ +public class ServerQuery implements Query { + public List searchServer(String keyword, Duration duration) { + return null; + } + + public List getAllServer(String applicationId, Duration duration) { + return null; + } + + public ResponseTimeTrend getServerResponseTimeTrend(int serverId, Duration duration) { + return null; + } + + public ThroughputTrend getServerTPSTrend(int serverId, Duration duration) { + return null; + } + + public CPUTrend getCPUTrend(int serverId, Duration duration) { + return null; + } + + public GCTrend getGCTrend(int serverId, Duration duration) { + return null; + } + + public MemoryTrend getMemoryTrend(int serverId, Duration duration) { + return null; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServiceQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServiceQuery.java new file mode 100644 index 000000000..ef11c1066 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/ServiceQuery.java @@ -0,0 +1,53 @@ +/* + * 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.query; + +import java.util.List; +import org.apache.skywalking.apm.collector.ui.graphql.Query; +import org.apache.skywalking.apm.collector.storage.ui.common.Duration; +import org.apache.skywalking.apm.collector.storage.ui.common.ResponseTimeTrend; +import org.apache.skywalking.apm.collector.storage.ui.common.SLATrend; +import org.apache.skywalking.apm.collector.storage.ui.common.ThroughputTrend; +import org.apache.skywalking.apm.collector.storage.ui.common.Topology; +import org.apache.skywalking.apm.collector.storage.ui.service.ServiceNode; + +/** + * @author peng-yongsheng + */ +public class ServiceQuery implements Query { + public List searchService(String keyword, Duration duration, Integer topN) { + return null; + } + + public ResponseTimeTrend getServiceResponseTimeTrend(int serviceId, Duration duration) { + return null; + } + + public ThroughputTrend getServiceTPSTrend(int serviceId, Duration duration) { + return null; + } + + public SLATrend getServiceSLATrend(int serviceId, Duration duration) { + return null; + } + + public Topology getServiceTopology(int serviceId, Duration duration) { + return null; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java new file mode 100644 index 000000000..32eaa7291 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/query/TraceQuery.java @@ -0,0 +1,37 @@ +/* + * 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.query; + +import org.apache.skywalking.apm.collector.ui.graphql.Query; +import org.apache.skywalking.apm.collector.storage.ui.trace.Trace; +import org.apache.skywalking.apm.collector.storage.ui.trace.TraceBrief; +import org.apache.skywalking.apm.collector.storage.ui.trace.TraceQueryCondition; + +/** + * @author peng-yongsheng + */ +public class TraceQuery implements Query { + public TraceBrief queryBasicTraces(TraceQueryCondition condition) { + return null; + } + + public Trace queryTrace(String id) { + return null; + } +} diff --git a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationService.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationService.java index 1807fc321..d96317dd5 100644 --- a/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationService.java +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/main/java/org/apache/skywalking/apm/collector/ui/service/ApplicationService.java @@ -16,16 +16,15 @@ * */ - package org.apache.skywalking.apm.collector.ui.service; -import com.google.gson.JsonArray; -import com.google.gson.JsonObject; +import java.util.List; 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.IInstanceUIDAO; +import org.apache.skywalking.apm.collector.storage.ui.application.Application; /** * @author peng-yongsheng @@ -40,14 +39,12 @@ public class ApplicationService { this.applicationCacheService = moduleManager.find(CacheModule.NAME).getService(ApplicationCacheService.class); } - public JsonArray getApplications(long startTime, long endTime) { - JsonArray applications = instanceDAO.getApplications(startTime, endTime); + public List getApplications(long startTime, long endTime) { + List applications = instanceDAO.getApplications(startTime, endTime); - applications.forEach(jsonElement -> { - JsonObject application = jsonElement.getAsJsonObject(); - int applicationId = application.get("applicationId").getAsInt(); - String applicationCode = applicationCacheService.getApplicationCodeById(applicationId); - application.addProperty("applicationCode", applicationCode); + applications.forEach(application -> { + String applicationCode = applicationCacheService.getApplicationCodeById(application.getId()); + application.setName(applicationCode); }); return applications; } 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 index 65492c8b1..98ba79884 100644 --- 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 @@ -16,19 +16,15 @@ * */ - package org.apache.skywalking.apm.collector.ui.service; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import java.util.List; import org.apache.skywalking.apm.collector.cache.CacheModule; -import org.apache.skywalking.apm.collector.core.module.ModuleManager; -import org.apache.skywalking.apm.collector.storage.dao.IGCMetricUIDAO; -import org.apache.skywalking.apm.collector.storage.table.register.Instance; import org.apache.skywalking.apm.collector.cache.service.ApplicationCacheService; -import org.apache.skywalking.apm.collector.core.util.TimeBucketUtils; +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.IGCMetricUIDAO; import org.apache.skywalking.apm.collector.storage.dao.IInstanceMetricUIDAO; import org.apache.skywalking.apm.collector.storage.dao.IInstanceUIDAO; import org.slf4j.Logger; @@ -56,58 +52,58 @@ public class InstanceHealthService { 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.name(), timeBucket, -60 * 30); - List instanceList = instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket); +// long[] timeBuckets = TimeBucketUtils.INSTANCE.getFiveSecondTimeBuckets(timeBucket); +// long halfHourBeforeTimeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, -60 * 30); +// List instanceList = instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket); JsonArray instances = new JsonArray(); response.add("instances", instances); - instanceList.forEach(instance -> { - response.addProperty("applicationCode", applicationCacheService.getApplicationCodeById(applicationId)); - response.addProperty("applicationId", applicationId); +// instanceList.forEach(instance -> { +// response.addProperty("applicationCode", applicationCacheService.getApplicationCodeById(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); +// } - 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.name(), instance.getHeartBeatTime()); - long currentTime = TimeBucketUtils.INSTANCE.changeTimeBucket2TimeStamp(TimeBucketUtils.TimeBucketType.SECOND.name(), 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); - }); +// 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/test/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQueryTestCase.java b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQueryTestCase.java new file mode 100644 index 000000000..c0bddff71 --- /dev/null +++ b/apm-collector/apm-collector-ui/collector-ui-jetty-provider/src/test/java/org/apache/skywalking/apm/collector/ui/query/ApplicationQueryTestCase.java @@ -0,0 +1,139 @@ +/* + * 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.query; + +import java.text.ParseException; +import org.apache.skywalking.apm.collector.storage.ui.common.Duration; +import org.apache.skywalking.apm.collector.storage.ui.common.Step; +import org.apache.skywalking.apm.collector.ui.service.ApplicationService; +import org.junit.Assert; +import org.junit.Test; +import org.mockito.Mockito; +import org.mockito.internal.util.reflection.Whitebox; + +/** + * @author peng-yongsheng + */ +public class ApplicationQueryTestCase { + + @Test + public void testGetAllApplicationByMonthDuration() throws ParseException { + ApplicationQuery query = new ApplicationQuery(null); + ApplicationService applicationService = Mockito.mock(ApplicationService.class); + Whitebox.setInternalState(query, "applicationService", applicationService); + + Mockito.when(applicationService.getApplications(Mockito.anyLong(), Mockito.anyLong())).then(invocation -> { + Object[] arguments = invocation.getArguments(); + Assert.assertEquals(20170100000000l, arguments[0]); + Assert.assertEquals(20170100000000l, arguments[1]); + return null; + }); + + Duration duration = new Duration(); + duration.setStart("2017-01"); + duration.setEnd("2017-01"); + duration.setStep(Step.MONTH); + + query.getAllApplication(duration); + } + + @Test + public void testGetAllApplicationByDayDuration() throws ParseException { + ApplicationQuery query = new ApplicationQuery(null); + ApplicationService applicationService = Mockito.mock(ApplicationService.class); + Whitebox.setInternalState(query, "applicationService", applicationService); + + Mockito.when(applicationService.getApplications(Mockito.anyLong(), Mockito.anyLong())).then(invocation -> { + Object[] arguments = invocation.getArguments(); + Assert.assertEquals(20170101000000l, arguments[0]); + Assert.assertEquals(20170101000000l, arguments[1]); + return null; + }); + + Duration duration = new Duration(); + duration.setStart("2017-01-01"); + duration.setEnd("2017-01-01"); + duration.setStep(Step.DAY); + + query.getAllApplication(duration); + } + + @Test + public void testGetAllApplicationByHourDuration() throws ParseException { + ApplicationQuery query = new ApplicationQuery(null); + ApplicationService applicationService = Mockito.mock(ApplicationService.class); + Whitebox.setInternalState(query, "applicationService", applicationService); + + Mockito.when(applicationService.getApplications(Mockito.anyLong(), Mockito.anyLong())).then(invocation -> { + Object[] arguments = invocation.getArguments(); + Assert.assertEquals(20170101010000l, arguments[0]); + Assert.assertEquals(20170101010000l, arguments[1]); + return null; + }); + + Duration duration = new Duration(); + duration.setStart("2017-01-01 01"); + duration.setEnd("2017-01-01 01"); + duration.setStep(Step.HOUR); + + query.getAllApplication(duration); + } + + @Test + public void testGetAllApplicationByMinuteDuration() throws ParseException { + ApplicationQuery query = new ApplicationQuery(null); + ApplicationService applicationService = Mockito.mock(ApplicationService.class); + Whitebox.setInternalState(query, "applicationService", applicationService); + + Mockito.when(applicationService.getApplications(Mockito.anyLong(), Mockito.anyLong())).then(invocation -> { + Object[] arguments = invocation.getArguments(); + Assert.assertEquals(20170101010100l, arguments[0]); + Assert.assertEquals(20170101010100l, arguments[1]); + return null; + }); + + Duration duration = new Duration(); + duration.setStart("2017-01-01 0101"); + duration.setEnd("2017-01-01 0101"); + duration.setStep(Step.MINUTE); + + query.getAllApplication(duration); + } + + @Test + public void testGetAllApplicationBySecondDuration() throws ParseException { + ApplicationQuery query = new ApplicationQuery(null); + ApplicationService applicationService = Mockito.mock(ApplicationService.class); + Whitebox.setInternalState(query, "applicationService", applicationService); + + Mockito.when(applicationService.getApplications(Mockito.anyLong(), Mockito.anyLong())).then(invocation -> { + Object[] arguments = invocation.getArguments(); + Assert.assertEquals(20170101010101l, arguments[0]); + Assert.assertEquals(20170101010101l, arguments[1]); + return null; + }); + + Duration duration = new Duration(); + duration.setStart("2017-01-01 010101"); + duration.setEnd("2017-01-01 010101"); + duration.setStep(Step.SECOND); + + query.getAllApplication(duration); + } +} diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls index 91d0b2d79..ba6dde139 100644 --- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls @@ -33,9 +33,15 @@ type ConjecturalNode implements Node { type: String } +type Application { + id: ID! + name: String! + # The number of servers in the application code + numOfServer: Int! +} extend type Query { - getAllApplication(duration: Duration!): [ApplicationNode!]! + getAllApplication(duration: Duration!): [Application!]! getApplicationTopology(applicationId: ID!, duration: Duration!): Topology getSlowService(applicationId: ID!, duration: Duration!, top: Int!): [ServiceInfo!]! getServerThroughput(applicationId: ID!, duration: Duration!, top: Int!): [AppServerInfo!]!