未验证 提交 ab38da59 编写于 作者: wu-sheng's avatar wu-sheng 提交者: GitHub

Merge pull request #732 from apache/fix/graphql/node-nullable

Adjust ui-query protocol
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
......@@ -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!]!
}
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 {
......
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
......@@ -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!]!
}
......@@ -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
......
......@@ -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
......
# 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
}
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册