diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/aggregation.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/aggregation.graphqls new file mode 100644 index 0000000000000000000000000000000000000000..4e7d221060fcbea33c1616741a60c6a62d7819fd --- /dev/null +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/aggregation.graphqls @@ -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!]! +} \ No newline at end of file diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/jvm.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/alarm.graphqls similarity index 57% rename from apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/jvm.graphqls rename to apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/alarm.graphqls index eb098d4447a99d01452ac8629ec462f51d25ba3c..52d7d228f855fbf1dcafecb32aebf0dfb539965d 100644 --- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/jvm.graphqls +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/alarm.graphqls @@ -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 diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/common.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/common.graphqls index b0a87857d1728005195bca1f17e37de561af45a4..258e2b42e9ae7251ac22f1cbff6ecf06252bcb58 100644 --- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/common.graphqls +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/common.graphqls @@ -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 diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/overview.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metadata.graphqls similarity index 86% rename from apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/overview.graphqls rename to apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metadata.graphqls index 42ad5de0758c425fb5bd49f0adcefb76d055759d..2c1bc0718abb89670899404d564355b04b559ad9 100644 --- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/overview.graphqls +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metadata.graphqls @@ -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 diff --git a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metric.graphqls b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metric.graphqls index f63cc1507befe3ff8fb11a55ac1ccb571398b5e4..9f27d718c8161eb1a152d429a326c0fd547e7d9c 100644 --- a/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metric.graphqls +++ b/apm-protocol/apm-ui-protocol/src/main/resources/ui-graphql-v6/metric.graphqls @@ -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 diff --git a/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLv6ScriptTest.java b/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLv6ScriptTest.java index 71cead4f6f4fcd9f5f49baa30f9e739cac3f1efd..f3d7adf12ed3ba7031a50d999d08b5267d247c65 100644 --- a/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLv6ScriptTest.java +++ b/apm-protocol/apm-ui-protocol/src/test/java/org/apache/skywalking/apm/ui/protocol/GraphQLv6ScriptTest.java @@ -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); }