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 b63946d8b..b60d0a126 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 @@ -1,7 +1,17 @@ +type Alarm { + items: [AlarmItem!]! + count: Int! +} + type AlarmItem { + # Typical include: Application Code + cause type. This is a short description. + title: String! + # Include all related info to trigger this alarm. + # such as: threshold, trigger value, relation(greater or lower), last time content: String! startTime: String! alertType: AlarmType! + causeType: CauseType! } enum AlarmType { @@ -10,6 +20,11 @@ enum AlarmType { SERVICE } +enum CauseType { + LOW_SUCCESS_RATE, + SLOW_RESPONSE +} + extend type Query { - loadAlertList(keyword: String, alertType: AlarmType, duration:Duration!):[AlarmItem] + loadAlertList(keyword: String, alertType: AlarmType, duration:Duration!, paging: Pagination!): Alarm } \ 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 f8ccf0eb9..91d0b2d79 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 @@ -8,20 +8,22 @@ type ApplicationNode implements Node { # 2 Digits after floating point. sla: Float! # The number of incoming calls - calls: Long! + callsPerSec: Long! + # Unit: millisecond + responseTimePerSec: Int! # ref: http://www.apdex.org/ # Max value is 1 # 2 Digits after floating point. apdex: Float! + # Whether the application alerts? + # Default value is false. + isAlarm: Boolean! # The number of servers in the application code numOfServer: Int! # The number of servers alerting numOfServerAlarm: Int! # The number of services alerting numOfServiceAlarm: Int! - # Incoming request node, means User or outside system access the cluster from this. - # Recommend the UI generate a User node for each incoming node - isIncomingNode: Boolean } # The conjectural node generated by exit span @@ -33,8 +35,8 @@ type ConjecturalNode implements Node { extend type Query { - getAllApplication(duration: Duration!): [ApplicationNode] + getAllApplication(duration: Duration!): [ApplicationNode!]! getApplicationTopology(applicationId: ID!, duration: Duration!): Topology - getSlowService(applicationId: ID!, duration: Duration!): [ServiceInfo!] - getServerThroughput(applicationId: ID!, duration: Duration!): [AppServerInfo!] + getSlowService(applicationId: ID!, duration: Duration!, top: Int!): [ServiceInfo!]! + getServerThroughput(applicationId: ID!, duration: Duration!, top: Int!): [AppServerInfo!]! } 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 853f36258..04f21eeb3 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,5 +1,6 @@ schema { query: Query + mutation: Mutation } #Root node @@ -7,6 +8,10 @@ type Query { version: String } +type Mutation { + version: String +} + # The Duration defines the start and end time for each query operation. # Fields: `start` and `end` # represents the time span. And each of them matches the step. @@ -39,6 +44,14 @@ enum Step { SECOND } +input Pagination { + # pageNum starts in 1, the default is 1. + pageNum: Int + pageSize: Int! + # default false + needTotal: Boolean +} + ###################################### # Common Metrics and Trends ###################################### @@ -47,17 +60,17 @@ type ResponseTimeTrend { } type ThroughputTrend { - trendList: [Int!] + trendList: [Int!]! } type SLATrend { - trendList: [Int!] + trendList: [Int!]! } # The overview topology of the whole application cluster or services, type Topology { - nodes: [Node]! - calls: [Call] + nodes: [Node!]! + calls: [Call!]! } # The base Node of all node types in topology @@ -74,6 +87,15 @@ interface Node { type: String } +# Incoming request node, means User or outside system access the cluster from this. +type VisualUserNode implements Node { + id: ID! + # Constant, value = "User" + name: String! + # Constant, value = "USER" + type: String +} + # The Call represents a directed distributed call, # from the `source` to the `target`. type Call { diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/config.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/config.graphqls new file mode 100644 index 000000000..aaa102e1c --- /dev/null +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/config.graphqls @@ -0,0 +1,38 @@ +input TTLConfigItem { + unit: Step! + value: Int! +} + +type ExistedTTLConfigs{ + ttl: [TTL!]! +} + +type TTL { + unit: Step! + value: Int! +} + +input AlarmThreshold { + type: AlarmType! + threshold: Int! + causeType: CauseType! +} + +type ExistedAlarmThresholds { + items: [ExistedAlarmThresholdItem!]! +} + +type ExistedAlarmThresholdItem { + threshold: Int! + causeType: CauseType! +} + +extend type Mutation { + setDataTTLConfigs(ttl: [TTLConfigItem!]!): Boolean! + setAlarmThreshold(thresholds: [AlarmThreshold!]!): Boolean! +} + +extend type Query { + queryAllDataTTLConfigs: ExistedTTLConfigs! + queryAlarmThresholds(alarmType: AlarmType): ExistedAlarmThresholds! +} \ 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 e7b0bc2d6..04b1033a6 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 @@ -15,7 +15,7 @@ type AlarmTrend { # 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, @@ -32,6 +32,6 @@ extend type Query { getClusterBrief(duration: Duration!): ClusterBrief getAlarmTrend(duration: Duration!): AlarmTrend getConjecturalApps(duration: Duration!): ConjecturalAppBrief - getTopNSlowService(duration: Duration!, topN: Int!): [ServiceInfo!] - getTopNServerThroughput(duration: Duration!, topN: Int!): [AppServerInfo!] + getTopNSlowService(duration: Duration!, topN: Int!): [ServiceInfo!]! + getTopNServerThroughput(duration: Duration!, topN: Int!): [AppServerInfo!]! } 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 eac33a7dc..de4134735 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 @@ -15,25 +15,26 @@ type AppServerInfo { } 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 { - searchServer(keyword: String!, duration: Duration!): [AppServerInfo] + searchServer(keyword: String!, duration: Duration!): [AppServerInfo!]! + getAllServer(applicationId: ID!, duration: Duration!): [AppServerInfo!]! getServerResponseTimeTrend(serverId: ID!, duration: Duration!): ResponseTimeTrend getServerTPSTrend(serverId: ID!, duration: Duration!): ThroughputTrend getCPUTrend(serverId: ID!, duration: Duration!): CPUTrend 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 3e33c8f9e..a5b44557a 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 @@ -27,7 +27,7 @@ type TraceItem { } extend type Query { - searchService(keyword: String!, duration: Duration!): [ServiceNode] + searchService(keyword: String!, duration: Duration!, topN: Int!): [ServiceNode!]! getServiceResponseTimeTrend(serviceId: ID!, duration: Duration!): ResponseTimeTrend getServiceTPSTrend(serviceId: ID!, duration: Duration!): ThroughputTrend getServiceSLATrend(serviceId: ID!, duration: Duration!): SLATrend diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls index 4e2e1a0ec..d867caba6 100644 --- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/trace.graphqls @@ -1,6 +1,7 @@ # The list of traces type TraceBrief { - traces: [BasicTrace!] + traces: [BasicTrace!]! + total: Int! } # Trace basic info @@ -23,8 +24,7 @@ input TraceQueryCondition { minTraceDuration: Int # The max time of trace maxTraceDuration: Int - topN: Boolean - needTotal: Int + paging: Pagination! } enum QueryOrder { @@ -34,21 +34,14 @@ enum QueryOrder { # The trace represents a distributed trace, includes all segments and spans. type Trace { - traceId: ID! - segments: [Segment!] -} - -type Segment { - segmentId: ID! - appName: String! - isSizeLimited: Boolean! spans: [Span!]! } type Span { - refs: [Ref!] + traceId: ID! + segmentId: ID! spanId: Int! - parentSpanId: Int! + refs: [Ref!]! startTime: Long! endTime: Long! operationName: String @@ -60,17 +53,25 @@ type Span { isError: Boolean # There are 5 layers: Unknown, Database, RPCFramework, Http, MQ and Cache layer: String - tags: [KeyValue!] - logs: [LogEntity!] + tags: [KeyValue!]! + logs: [LogEntity!]! } # Ref represents the link between the segment and its parents. +# The parent(ref) may not exists, which means batch process. +# The UI should display a list, representing the other trace IDs. type Ref { + traceId: ID! parentSegmentId: ID! parentSpanId: Int! # Ref type represents why did the ref happen. # Include: 1) CrossProcess 2) CrossThread - type: String! + type: RefType! +} + +enum RefType { + CROSS_PROCESS, + CROSS_THREAD } type KeyValue { @@ -86,4 +87,4 @@ type LogEntity { extend type Query { queryBasicTraces(condition: TraceQueryCondition): TraceBrief queryTrace(traceId: ID!): Trace -} \ 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 f017d6844..5c93a8e93 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 @@ -43,6 +43,7 @@ public class GraphQLScriptTest { typeRegistry.merge(schemaParser.parse(loadSchema("server-layer.graphqls"))); typeRegistry.merge(schemaParser.parse(loadSchema("service-layer.graphqls"))); typeRegistry.merge(schemaParser.parse(loadSchema("alarm.graphqls"))); + typeRegistry.merge(schemaParser.parse(loadSchema("config.graphqls"))); RuntimeWiring wiring = buildRuntimeWiring(); assertTrue(schemaGenerator.makeExecutableSchema(typeRegistry, wiring).getAllTypesAsList().size() > 0); }