Refactor the graphQL query protocol. @hanahmily @peng-yongsheng
This commit is contained in:
parent
3cbf04feb8
commit
cb69e968f1
|
|
@ -0,0 +1,45 @@
|
|||
# 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.
|
||||
|
||||
# Match the metric by name, order by metric value(such as: avg, percent)
|
||||
input TopNCondition {
|
||||
name: String!
|
||||
topN: Int!
|
||||
order: Order!
|
||||
# When the scope is ServiceInstance or Endpoint,
|
||||
# most likely you need a secondary filter.
|
||||
# Such as:
|
||||
# 1. Get topN service instance in a given service id
|
||||
# 2. Get topN endpoint in a given serivce id.
|
||||
# Backend will decide the filter id meaning by Scope.
|
||||
#
|
||||
# Defintely, it is not required by default.
|
||||
filterScope: Scope
|
||||
filterId: Int
|
||||
}
|
||||
|
||||
type TopNEntity {
|
||||
name: String!
|
||||
id: ID!
|
||||
value: Int!
|
||||
}
|
||||
|
||||
# The aggregation query is different with the metric query.
|
||||
# All aggregation queries require backend or/and storage do aggregation in query time.
|
||||
extend type Query {
|
||||
# TopN is an aggregation query.
|
||||
getTopN(metric: TopNCondition!): [TopNEntity!]!
|
||||
}
|
||||
|
|
@ -14,28 +14,23 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
type CPUTrend {
|
||||
cost: [Int!]!
|
||||
# the trend alarm trigger times
|
||||
type AlarmTrend {
|
||||
numOfAlarm: [Int]!
|
||||
}
|
||||
|
||||
# The gc trend represents the numbers and time of Garbage Collector execution
|
||||
type GCTrend {
|
||||
youngGCCount: [Int!]!
|
||||
oldGCount: [Int!]!
|
||||
youngGCTime: [Int!]!
|
||||
oldGCTime: [Int!]!
|
||||
type AlarmMessage {
|
||||
scope: Scope!
|
||||
id: ID!
|
||||
message: String!
|
||||
}
|
||||
|
||||
# The memory used and max limit in heap and noheap space.
|
||||
type MemoryTrend {
|
||||
heap: [Int!]!
|
||||
maxHeap: [Int!]!
|
||||
noheap: [Int!]!
|
||||
maxNoheap: [Int!]!
|
||||
type Alarms {
|
||||
msgs: [AlarmMessage!]!
|
||||
total: Int!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
getJVMCPUTrend(serviceInstanceId: ID!, duration: Duration!): CPUTrend
|
||||
getJVMGCTrend(serviceInstanceId: ID!, duration: Duration!): GCTrend
|
||||
getJVMMemoryTrend(serviceInstanceId: ID!, duration: Duration!): MemoryTrend
|
||||
getAlarmTrend(duration: Duration!): AlarmTrend!
|
||||
getAlarm(duration: Duration!, scope: Scope, paging: Pagination!): Alarms
|
||||
}
|
||||
|
|
@ -82,3 +82,12 @@ enum Language {
|
|||
PYTHON
|
||||
RUBY
|
||||
}
|
||||
|
||||
enum Scope {
|
||||
SERVICE
|
||||
SERVICE_INSTANCE
|
||||
ENDPOINT
|
||||
SERVICE_RELATION
|
||||
SERVICE_INSTANCE_RELATION
|
||||
ENDPOINT_RELATION
|
||||
}
|
||||
|
|
@ -23,11 +23,6 @@ type ClusterBrief {
|
|||
numOfMQ: Int!
|
||||
}
|
||||
|
||||
# Query the trend of alarm rate based on the given duration
|
||||
type AlarmTrend {
|
||||
numOfAlarmRate: [Int]!
|
||||
}
|
||||
|
||||
type Service {
|
||||
id: ID!
|
||||
name: String!
|
||||
|
|
@ -52,7 +47,6 @@ type Endpoint {
|
|||
|
||||
extend type Query {
|
||||
getGlobalBrief(duration: Duration!): ClusterBrief
|
||||
getAlarmTrend(duration: Duration!): AlarmTrend
|
||||
|
||||
# Service related meta info.
|
||||
getAllServices(duration: Duration!): [Service!]!
|
||||
|
|
@ -64,5 +58,5 @@ extend type Query {
|
|||
# Endpoint query
|
||||
# Consider there are huge numbers of endpoint,
|
||||
# must use endpoint owner's service id, keyword and top N filter to do query.
|
||||
searchEndpoint(keyword: String!, serviceId: ID!, topNFilter: MetricTopNCondition!): [Endpoint!]!
|
||||
searchEndpoint(keyword: String!, serviceId: ID!, topN: Int!): [Endpoint!]!
|
||||
}
|
||||
|
|
@ -54,21 +54,8 @@ type Thermodynamic {
|
|||
axisYStep: Int!
|
||||
}
|
||||
|
||||
# Match the metric by name, order by metric value(such as: avg, percent)
|
||||
input MetricTopNCondition {
|
||||
name: String!
|
||||
topN: Int!
|
||||
order: Order!
|
||||
}
|
||||
|
||||
type MetricEntity {
|
||||
name: String!
|
||||
id: ID!
|
||||
value: Int!
|
||||
}
|
||||
|
||||
extend type Query {
|
||||
getLinearIntValues(metric: MetricCondition!, duration: Duration!): LinearIntValues
|
||||
getThermodynamic(metric: MetricCondition!, duration: Duration!): Thermodynamic
|
||||
getTopN(metric: MetricTopNCondition!): [MetricEntity!]!
|
||||
}
|
||||
|
|
@ -38,9 +38,10 @@ public class GraphQLv6ScriptTest {
|
|||
typeRegistry.merge(schemaParser.parse(loadSchema("common.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("trace.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("metric.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("overview.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("metadata.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("topology.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("jvm.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("alarm.graphqls")));
|
||||
typeRegistry.merge(schemaParser.parse(loadSchema("aggregation.graphqls")));
|
||||
RuntimeWiring wiring = buildRuntimeWiring();
|
||||
assertTrue(schemaGenerator.makeExecutableSchema(typeRegistry, wiring).getAllTypesAsList().size() > 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue