Implement the method named getAllApplication in application layer graphql protocol.
This commit is contained in:
parent
843e709fae
commit
a25e353e2d
|
|
@ -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<ApplicationInstanceMapping> 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);
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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": [
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Application> getApplications(long startTime, long endTime);
|
||||
|
||||
Instance getInstance(int instanceId);
|
||||
|
||||
List<Instance> 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<AlarmItem> items;
|
||||
private Integer count;
|
||||
|
||||
public List<AlarmItem> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public void setItems(List<AlarmItem> items) {
|
||||
this.items = items;
|
||||
}
|
||||
|
||||
public Integer getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(Integer count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 {
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Integer> trendList;
|
||||
}
|
||||
|
|
@ -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<Integer> trendList;
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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<Integer> trendList;
|
||||
}
|
||||
|
|
@ -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<Node> nodes;
|
||||
private List<Call> calls;
|
||||
}
|
||||
|
|
@ -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 {
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<ExistedAlarmThresholdItem> items;
|
||||
}
|
||||
|
|
@ -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> ttl;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<Integer> numOfAlarmRate;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<ConjecturalApp> apps;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<Integer> cost;
|
||||
}
|
||||
|
|
@ -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<Integer> youngGC;
|
||||
private List<Integer> oldGC;
|
||||
}
|
||||
|
|
@ -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<Integer> heap;
|
||||
private List<Integer> maxHeap;
|
||||
private List<Integer> noheap;
|
||||
private List<Integer> maxNoheap;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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<KeyValue> data;
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
|
@ -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
|
||||
}
|
||||
|
|
@ -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<Span> spans;
|
||||
}
|
||||
|
|
@ -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<Ref> 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<KeyValue> tags;
|
||||
private List<LogEntity> logs;
|
||||
}
|
||||
|
|
@ -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<Span> spans;
|
||||
}
|
||||
|
|
@ -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<BasicTrace> traces;
|
||||
private Integer total;
|
||||
}
|
||||
|
|
@ -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<String> applicationCodes;
|
||||
private String traceId;
|
||||
private String operationName;
|
||||
private Duration queryDuration;
|
||||
private int minTraceDuration;
|
||||
private int maxTraceDuration;
|
||||
private Boolean topN;
|
||||
private int needTotal;
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Application> 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<Application> 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;
|
||||
|
|
|
|||
|
|
@ -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++;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String, Object> 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);
|
||||
|
|
|
|||
|
|
@ -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<String> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> 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<String> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Application> getApplications(long startTime, long endTime) {
|
||||
H2Client client = getClient();
|
||||
JsonArray applications = new JsonArray();
|
||||
List<Application> 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) {
|
||||
|
|
|
|||
|
|
@ -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<String> 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<String> 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);
|
||||
|
|
|
|||
|
|
@ -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<String> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> 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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 {
|
||||
}
|
||||
}
|
||||
|
|
@ -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()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<GraphQLError> errors = executionResult.getErrors();
|
||||
|
||||
Object data = executionResult.getData();
|
||||
List<GraphQLError> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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<String> 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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
@ -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<TTLConfigItem> ttl) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Boolean setAlarmThreshold(List<AlarmThreshold> thresholds) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Application> 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<ServiceInfo> getSlowService(int applicationId, Duration duration, Integer top) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<AppServerInfo> getServerThroughput(int applicationId, Duration duration, Integer top) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<ServiceInfo> getTopNSlowService(Duration duration, int topN) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<AppServerInfo> getTopNServerThroughput(Duration duration, int topN) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<AppServerInfo> searchServer(String keyword, Duration duration) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<AppServerInfo> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<ServiceNode> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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<Application> getApplications(long startTime, long endTime) {
|
||||
List<Application> 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<Instance> instanceList = instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket);
|
||||
// long[] timeBuckets = TimeBucketUtils.INSTANCE.getFiveSecondTimeBuckets(timeBucket);
|
||||
// long halfHourBeforeTimeBucket = TimeBucketUtils.INSTANCE.addSecondForSecondTimeBucket(TimeBucketUtils.TimeBucketType.SECOND, timeBucket, -60 * 30);
|
||||
// List<Instance> instanceList = instanceDAO.getInstances(applicationId, halfHourBeforeTimeBucket);
|
||||
|
||||
JsonArray instances = new JsonArray();
|
||||
response.add("instances", instances);
|
||||
|
||||
instanceList.forEach(instance -> {
|
||||
response.addProperty("applicationCode", applicationCacheService.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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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!]!
|
||||
|
|
|
|||
Loading…
Reference in New Issue