提交 cb69e968 编写于 作者: wu-sheng's avatar wu-sheng

Refactor the graphQL query protocol. @hanahmily @peng-yongsheng

上级 3cbf04fe
# 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!]!
}
\ No newline at end of file
......@@ -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
}
\ No newline at end of file
......@@ -82,3 +82,12 @@ enum Language {
PYTHON
RUBY
}
enum Scope {
SERVICE
SERVICE_INSTANCE
ENDPOINT
SERVICE_RELATION
SERVICE_INSTANCE_RELATION
ENDPOINT_RELATION
}
\ No newline at end of file
......@@ -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!]!
}
\ No newline at end of file
......@@ -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!]!
}
\ No newline at end of file
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册