From 06b9f5f692a991f69619262e34bbb1e2a0494a73 Mon Sep 17 00:00:00 2001 From: wu-sheng Date: Wed, 10 Jan 2018 16:38:22 +0800 Subject: [PATCH] 1. Add set/get `DataTTLConfigs` and set/get `AlarmThreshold` mutation service. 2. All empty arrays are represented by `[]`, not `null`. 3. Add Mutation type, represents for all modification operations. 4. Support **Pagination** in some query. 5. Seperate alarm into to title and content --- .../main/resources/ui-graphql/alarm.graphqls | 8 ++++++- .../ui-graphql/application-layer.graphqls | 4 ++-- .../main/resources/ui-graphql/common.graphqls | 21 +++++++++++++++---- .../main/resources/ui-graphql/config.graphqls | 12 +++++++++++ .../ui-graphql/server-layer.graphqls | 14 ++++++------- .../main/resources/ui-graphql/trace.graphqls | 12 +++++------ 6 files changed, 51 insertions(+), 20 deletions(-) create mode 100644 apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/config.graphqls 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..8ecd0fb3c 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 @@ -2,6 +2,7 @@ type AlarmItem { content: String! startTime: String! alertType: AlarmType! + causeType: CauseType! } enum AlarmType { @@ -10,6 +11,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!):[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 f8ccf0eb9..fa11d753f 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 @@ -35,6 +35,6 @@ type ConjecturalNode implements Node { extend type Query { 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 ef552f7e8..c074e5254 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 } +type 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 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..e4df497e4 --- /dev/null +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql/config.graphqls @@ -0,0 +1,12 @@ +type TTLConfigs { + items: [TTLConfigItem]! +} + +type TTLConfigItem { + unit: Step! + value: Int! +} + +extend type Mutation { + setDataTTLConfigs(ttl: TTLConfigs!): TTLConfigs +} \ No newline at end of file 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..1d01ec211 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,21 +15,21 @@ 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 { 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..efdbe9645 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 { @@ -46,7 +46,7 @@ type Segment { } type Span { - refs: [Ref!] + refs: [Ref!]! spanId: Int! parentSpanId: Int! startTime: Long! @@ -60,8 +60,8 @@ 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.