You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@skywalking.apache.org by ha...@apache.org on 2017/12/27 04:41:40 UTC

[incubator-skywalking] branch feature/ui-protocol updated: Finish all protocol

This is an automated email from the ASF dual-hosted git repository.

hanahmily pushed a commit to branch feature/ui-protocol
in repository https://gitbox.apache.org/repos/asf/incubator-skywalking.git


The following commit(s) were added to refs/heads/feature/ui-protocol by this push:
     new 6d96cf6  Finish all protocol
6d96cf6 is described below

commit 6d96cf6bf2cbb608a7cd358a73bb6cc4591134b8
Author: gaohongtao <ha...@gmail.com>
AuthorDate: Wed Dec 27 12:41:28 2017 +0800

    Finish all protocol
---
 .../src/main/resources/ui-graphql/alarm.graphqls   |  15 +++
 .../ui-graphql/application-layer.graphqls          |  37 ++++++-
 .../src/main/resources/ui-graphql/common.graphqls  |  79 +++++++++++----
 .../resources/ui-graphql/overview-layer.graphqls   | 107 ++++-----------------
 .../resources/ui-graphql/server-layer.graphqls     |  42 ++++----
 .../resources/ui-graphql/service-layer.graphqls    |  28 ++++++
 .../apm/ui/protocol/GraphQLScriptTest.java         |   9 +-
 7 files changed, 182 insertions(+), 135 deletions(-)

diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/alarm.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/alarm.graphqls
index e69de29..b63946d 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/alarm.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/alarm.graphqls
@@ -0,0 +1,15 @@
+type AlarmItem {
+    content: String!
+    startTime: String!
+    alertType: AlarmType!
+}
+
+enum AlarmType {
+    APPLICATION,
+    SERVER,
+    SERVICE
+}
+
+extend type Query {
+    loadAlertList(keyword: String, alertType: AlarmType, duration:Duration!):[AlarmItem]
+}
\ No newline at end of file
diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls
index 4889edf..572b038 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/application-layer.graphqls
@@ -1,8 +1,37 @@
-type AppServerList {
-   servers: [AppServerInfo!]
+# ApplicationNode represents this node is under monitoring by agent.
+type ApplicationNode implements Node {
+    id: ID!
+    name: String!
+    type: String
+    # Success rate of all incoming requests.
+    # Max value is 100.
+    # 2 Digits after floating point.
+    sla: Float!
+    # The number of incoming calls
+    calls: Long!
+    # ref: http://www.apdex.org/
+    # Max value is 1
+    # 2 Digits after floating point.
+    apdex: Float!
+    # The number of servers in the application code
+    numOfServer: Int!
+    # The number of servers alerting
+    numOfServerAlarm: Int!
+    # The number of services alerting
+    numOfServiceAlarm: Int!
 }
 
+# The conjectural node generated by exit span
+type ConjecturalNode implements Node {
+    id: ID!
+    name: String!
+    type: String
+}
+
+
 extend type Query {
-  getApplicationTopology(appId: ID!, duration: Duration!): ApplicationTopology
-  getServers(appId: ID!, duration: Duration!): AppServerList
+  getAllApplication(duration: Duration!): [ApplicationNode]
+  getApplicationTopology(appId: ID!, duration: Duration!): Topology
+  getSlowService(appId: ID!, duration: Duration!): [DurationItem]
+  getServerThroughput(appId: ID!, duration: Duration!): [ThroughputItem]
 }
\ No newline at end of file
diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/common.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/common.graphqls
index 679379c..0520b4b 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/common.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/common.graphqls
@@ -1,10 +1,10 @@
 schema {
-  query: Query
+    query: Query
 }
 
 #Root node
 type Query {
-  version: String
+    version: String
 }
 
 # The Duration defines the start and end time for each query operation.
@@ -25,31 +25,76 @@ type Query {
 #       metrics from the following time points expected
 #       2017-11-08 9:00 -> 2017-11-08 19:00
 #       there are 11 time points (hours) in the time span.
-input Duration{
-  start: String!
-  end: String!
-  step: Step!
+input Duration {
+    start: String!
+    end: String!
+    step: Step!
 }
 
-enum Step{
-  MONTH
-  DAY
-  HOUR
-  MINUTE
-  SECOND
+enum Step {
+    MONTH
+    DAY
+    HOUR
+    MINUTE
+    SECOND
 }
 
 ######################################
 # Common Metrics and Trends
 ######################################
 type ResponseTimeTrend {
-  trendList: [Int!]
+    trendList: [Int!]
 }
 
-type TPSTrend {
-  trendList: [Int!]
+type ThroughputTrend {
+    trendList: [Int!]
 }
 
-type ThroughputTrend {
-  trendList: [Int!]
+type SLATrend {
+    trendList: [Int!]
+}
+
+# The overview topology of the whole application cluster or services,
+type Topology {
+    nodes: [Node]!
+    calls: [Call]
+}
+
+# The base Node of all node types in topology
+interface Node {
+    # The global id of each node,
+    # 1. `Application ID` represents application under monitoring
+    # 2. `Peer ID` string represents the conjectural dependency.
+    id: ID!
+    # Application Code or literal Peer
+    name: String!
+    # The type name
+    # 1. The most important component in the application, from service provider perspective.
+    # 2. Conjectural dependent component, e.g. MySQL, Redis, Kafka
+    type: String
+}
+
+# The Call represents a directed distributed call,
+# from the `source` to the `target`.
+type Call {
+    source: ID!
+    target: ID!
+    isAlert: Boolean
+    # The protocol and tech stack used in this distributed call
+    callType: String!
+    callsPerSec: Int!
+    # Unit: millisecond
+    responseTimePerSec: Int!
+}
+
+# The item of slow service list
+type DurationItem {
+    name: String!
+    duration: Int!
+}
+
+# The item of throughput list
+type ThroughputItem {
+    name: String!
+    tps: Int!
 }
\ No newline at end of file
diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/overview-layer.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/overview-layer.graphqls
index e06e944..aae527e 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/overview-layer.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/overview-layer.graphqls
@@ -1,110 +1,37 @@
-# The overview topology of the whole application cluster,
-# which includes all applications and dependencies, e.g. MQ, Database, Cache, outside Web Service
-type ApplicationTopology {
-  nodes: [Node]!
-  calls: [Call]
-}
-
-# The base Node of all node types in topology
-interface Node {
-  # The global id of each node,
-  # 1. `Application ID` represents application under monitoring
-  # 2. `Peer ID` string represents the conjectural dependency.
-  id: ID!
-  # Application Code or literal Peer
-  name: String!
-  # The type name
-  # 1. The most important component in the application, from service provider perspective.
-  # 2. Conjectural dependent component, e.g. MySQL, Redis, Kafka
-  type: String
-}
-
-# ApplicationNode represents this node is under monitoring by agent.
-type ApplicationNode implements Node {
-  id: ID!
-  name: String!
-  type: String
-  # Success rate of all incoming requests.
-  # Max value is 100.
-  # 2 Digits after floating point.
-  sla: Float!
-  # The number of incoming calls
-  calls: Long!
-  # ref: http://www.apdex.org/
-  # Max value is 1
-  # 2 Digits after floating point.
-  apdex: Float!
-  # The number of servers in the application code
-  numOfServer: Int!
-  # The number of servers alerting
-  numOfServerAlarm: Int!
-  # The number of services alerting
-  numOfServiceAlarm: Int!
-}
-
-# The conjectural node generated by exit span
-type ConjecturalNode implements Node {
-  id: ID!
-  name: String!
-  type: String
-}
-
-# The Call represents a directed distributed call,
-# from the `source` to the `target`.
-type Call {
-  source: ID!
-  target: ID!
-  isAlert: Boolean
-  # The protocol and tech stack used in this distributed call
-  callType: String!
-  callsPerSec: Int!
-  # Unit: millisecond
-  responseTimePerSec: Int!
-}
-
 # Query the cluster brief based on the given duration
 type ClusterBrief {
-  numOfApplication: Int
-  numOfService: Int
-  numOfDatabase: Int
-  numOfCache: Int
-  numOfMQ: Int
+    numOfApplication: Int
+    numOfService: Int
+    numOfDatabase: Int
+    numOfCache: Int
+    numOfMQ: Int
 }
 
 # Query the trend of alarm rate based on the given duration
 type AlarmTrend {
-  numOfAlarmRate: [Int]!
+    numOfAlarmRate: [Int]!
 }
 
 # Query all conjectural applications based on the given duration
 # All applications here are not installed agent.
 type ConjecturalAppBrief {
-  apps: [ConjecturalApp!]
+    apps: [ConjecturalApp!]
 }
 
 # The basic info of the conjectural application,
 # includes the type and num of same type application
 type ConjecturalApp {
-  # The display name of the application
-  # e.g. MySQL, RocketMQ, Kafka, Nginx
-  name: String!
-  num: Int!
-}
-
-type ApplicationBrief {
-  apps: [ApplicationInfo!]
-}
-
-type ApplicationInfo {
-  id: ID!
-  name: String!
-  tps: Int!
+    # The display name of the application
+    # e.g. MySQL, RocketMQ, Kafka, Nginx
+    name: String!
+    num: Int!
 }
 
 extend type Query {
-  getClusterTopology(duration: Duration!): ApplicationTopology
-  getClusterBrief(duration: Duration!): ClusterBrief
-  getAlarmTrend(duration: Duration!): AlarmTrend
-  getConjecturalApps(duration: Duration!): ConjecturalAppBrief
-  getApplicationBrief(duration: Duration!, topN: Int!): ApplicationBrief
+    getClusterTopology(duration: Duration!): Topology
+    getClusterBrief(duration: Duration!): ClusterBrief
+    getAlarmTrend(duration: Duration!): AlarmTrend
+    getConjecturalApps(duration: Duration!): ConjecturalAppBrief
+    getTopNSlowService(duration: Duration!, topN: Int!): [DurationItem]
+    getTopNServerThroughput(duration: Duration!, topN: Int!): [ThroughputItem]
 }
diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/server-layer.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/server-layer.graphqls
index cd86957..eac33a7 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/server-layer.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/server-layer.graphqls
@@ -4,39 +4,39 @@
 #   1. Spring boot application
 #   2. A Tomcat server instance
 type AppServerInfo {
-  id: ID!
-  name: String!
-  tps: Int!
-  os: String
-  host: String
-  pid: Int
-  IPv4: String
-  IPv6: String
+    id: ID!
+    name: String!
+    tps: Int!
+    os: String
+    host: String
+    pid: Int
+    IPv4: String
+    IPv6: String
 }
 
 type CPUTrend {
-  cost: [Int!]
+    cost: [Int!]
 }
 
 # The gc trend represents the numbers of Garbage Collector execution
 type GCTrend {
-  youngGC: [Int!]
-  oldGC: [Int!]
+    youngGC: [Int!]
+    oldGC: [Int!]
 }
 
 # The memory used and max limit in heap and noheap space.
 type MemoryTrend {
-  heap: [int!]
-  maxHeap: [int!]
-  noheap: [int!]
-  maxNoheap: [int!]
+    heap: [Int!]
+    maxHeap: [Int!]
+    noheap: [Int!]
+    maxNoheap: [Int!]
 }
 
-
 extend type Query {
-  getServerResponseTimeTrend(serverId: ID!, duration: Duration!): ResponseTimeTrend
-  getServerTPSTrend(serverId: ID!, duration: Duration!): TPSTrend
-  getCPUTrend(serverId: ID!, duration: Duration!): CPUTrend
-  getGCTrend(serverId: ID!, duration: Duration!): GCTrend
-  getMemoryTrend(serverId: ID!, duration: Duration!): MemoryTrend
+    searchServer(keyword: String!, duration: Duration!): [AppServerInfo]
+    getServerResponseTimeTrend(serverId: ID!, duration: Duration!): ResponseTimeTrend
+    getServerTPSTrend(serverId: ID!, duration: Duration!): ThroughputTrend
+    getCPUTrend(serverId: ID!, duration: Duration!): CPUTrend
+    getGCTrend(serverId: ID!, duration: Duration!): GCTrend
+    getMemoryTrend(serverId: ID!, duration: Duration!): MemoryTrend
 }
\ No newline at end of file
diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/service-layer.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/service-layer.graphqls
index e69de29..2d7a906 100644
--- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/service-layer.graphqls
+++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/service-layer.graphqls
@@ -0,0 +1,28 @@
+type ServiceNode implements Node {
+    id: ID!
+    name: String!
+    type: String
+    # Success rate of all incoming requests.
+    # Max value is 100.
+    # 2 Digits after floating point.
+    sla: Float!
+    # The number of incoming calls
+    calls: Long!
+    # The number of services alerting
+    numOfServiceAlarm: Int!
+}
+
+type TraceItem {
+    time: String!
+    entry: String!
+    duration: Int!
+}
+
+extend type Query {
+    searchService(keyword: String!, duration: Duration!): [ServiceNode]
+    getServiceResponseTimeTrend(serviceId: ID!, duration: Duration!): ResponseTimeTrend
+    getServiceTPSTrend(serviceId: ID!, duration: Duration!): ThroughputTrend
+    getServiceSLATrend(serviceId: ID!, duration: Duration!): SLATrend
+    getServiceTopology(serviceId: ID!, duration: Duration!): Topology
+    getServiceSlowTrace(serviceId: ID!, duration: Duration!): [TraceItem]
+}
\ No newline at end of file
diff --git a/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLScriptTest.java b/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLScriptTest.java
index 795a01b..f017d68 100644
--- a/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLScriptTest.java
+++ b/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLScriptTest.java
@@ -26,8 +26,7 @@ import graphql.schema.idl.TypeDefinitionRegistry;
 import java.io.File;
 import org.junit.Test;
 
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 public class GraphQLScriptTest {
     
@@ -40,8 +39,12 @@ public class GraphQLScriptTest {
         typeRegistry.merge(schemaParser.parse(loadSchema("common.graphqls")));
         typeRegistry.merge(schemaParser.parse(loadSchema("trace.graphqls")));
         typeRegistry.merge(schemaParser.parse(loadSchema("overview-layer.graphqls")));
+        typeRegistry.merge(schemaParser.parse(loadSchema("application-layer.graphqls")));
+        typeRegistry.merge(schemaParser.parse(loadSchema("server-layer.graphqls")));
+        typeRegistry.merge(schemaParser.parse(loadSchema("service-layer.graphqls")));
+        typeRegistry.merge(schemaParser.parse(loadSchema("alarm.graphqls")));
         RuntimeWiring wiring = buildRuntimeWiring();
-        assertThat(schemaGenerator.makeExecutableSchema(typeRegistry, wiring).getAllTypesAsList().size(), is(32));
+        assertTrue(schemaGenerator.makeExecutableSchema(typeRegistry, wiring).getAllTypesAsList().size() > 0);
     }
     
     private File loadSchema(final String s) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@skywalking.apache.org" <co...@skywalking.apache.org>'].