提交 1e57d48d 编写于 作者: wu-sheng's avatar wu-sheng 提交者: 彭勇升 pengys

GraphQL for Thermodynamic in overview page. (#1068)

* Provide graphQL for Thermodynamic in overview page.

* Finish the Thermodynamic.

* `nodes` should not be null.

* Add initialized java bean for graphql protocol.

* Add license head.

* Fixed bean definition fault.
上级 8cafc058
/*
* 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 ValueType {
ALL,
RIGHT,
WRONG
}
/*
* 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.LinkedList;
import java.util.List;
/**
* @author peng-yongsheng
*/
public class Thermodynamic {
private List<List<Long>> nodes;
private int responseTimeStep;
public Thermodynamic() {
this.nodes = new LinkedList<>();
}
public List<List<Long>> getNodes() {
return nodes;
}
public void setNodes(List<List<Long>> nodes) {
this.nodes = nodes;
}
public int getResponseTimeStep() {
return responseTimeStep;
}
public void setResponseTimeStep(int responseTimeStep) {
this.responseTimeStep = responseTimeStep;
}
}
......@@ -18,21 +18,26 @@
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.storage.ui.common.Duration;
import org.apache.skywalking.apm.collector.storage.ui.common.Topology;
import org.apache.skywalking.apm.collector.storage.ui.common.ValueType;
import org.apache.skywalking.apm.collector.storage.ui.overview.AlarmTrend;
import org.apache.skywalking.apm.collector.storage.ui.overview.ApplicationTPS;
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.overview.Thermodynamic;
import org.apache.skywalking.apm.collector.storage.ui.service.ServiceMetric;
import org.apache.skywalking.apm.collector.ui.graphql.Query;
import org.apache.skywalking.apm.collector.ui.service.*;
import org.apache.skywalking.apm.collector.ui.service.AlarmService;
import org.apache.skywalking.apm.collector.ui.service.ApplicationService;
import org.apache.skywalking.apm.collector.ui.service.ClusterTopologyService;
import org.apache.skywalking.apm.collector.ui.service.NetworkAddressService;
import org.apache.skywalking.apm.collector.ui.service.ServiceNameService;
import org.apache.skywalking.apm.collector.ui.utils.DurationUtils;
import java.text.ParseException;
import java.util.List;
import static java.util.Objects.isNull;
/**
......@@ -143,4 +148,8 @@ public class OverViewLayerQuery implements Query {
return getApplicationService().getTopNApplicationThroughput(duration.getStep(), startTimeBucket, endTimeBucket, topN);
}
public Thermodynamic getThermodynamic(Duration duration, ValueType type) throws ParseException {
return new Thermodynamic();
}
}
......@@ -124,3 +124,9 @@ type Call {
# Unit: millisecond
avgResponseTime: Long!
}
enum ValueType {
ALL,
RIGHT,
WRONG
}
......@@ -49,6 +49,22 @@ type ApplicationTPS {
callsPerSec: Int!
}
type Thermodynamic {
# Each element in nodes represents a point in Thermodynamic Diagram
# And the element includes three values:
# 1) Time Bucket based on query duration
# 2) Response time index.
# Response time = [responseTimeStep * index, responseTimeStep * (index+1))
# The last element: [Response Time * index, MAX)
# 3) The number of calls in this response time duration.
#
# Example:
# [ [0, 0, 10], [0, 1, 43], ...]
# These ^^^ two represent the left bottom element, and another element above it.
nodes: [[Long]!]!
responseTimeStep: Int!
}
extend type Query {
getClusterTopology(duration: Duration!): Topology
getClusterBrief(duration: Duration!): ClusterBrief
......@@ -56,4 +72,5 @@ extend type Query {
getConjecturalApps(duration: Duration!): ConjecturalAppBrief
getTopNSlowService(duration: Duration!, topN: Int!): [ServiceMetric!]!
getTopNApplicationThroughput(duration: Duration!, topN: Int!): [ApplicationTPS!]!
getThermodynamic(duration: Duration!, type: ValueType!): Thermodynamic!
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册