You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2020/04/15 15:37:18 UTC

[skywalking-query-protocol] branch metrics created (now a2f1ac5)

This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a change to branch metrics
in repository https://gitbox.apache.org/repos/asf/skywalking-query-protocol.git.


      at a2f1ac5  Add metrics v2 query protocol

This branch includes the following new commits:

     new a2f1ac5  Add metrics v2 query protocol

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[skywalking-query-protocol] 01/01: Add metrics v2 query protocol

Posted by wu...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch metrics
in repository https://gitbox.apache.org/repos/asf/skywalking-query-protocol.git

commit a2f1ac5c1a81f2df2b8645aff153128f6b9c0756
Author: Wu Sheng <wu...@foxmail.com>
AuthorDate: Wed Apr 15 23:36:32 2020 +0800

    Add metrics v2 query protocol
---
 common.graphqls     | 23 +++++++++++++++
 metadata.graphqls   | 11 -------
 metrics-v2.graphqls | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 106 insertions(+), 11 deletions(-)

diff --git a/common.graphqls b/common.graphqls
index 05b9b9a..a08a240 100644
--- a/common.graphqls
+++ b/common.graphqls
@@ -52,6 +52,28 @@ input Duration {
     step: Step!
 }
 
+input Entity {
+    # 1. scope=All, no name is required.
+    # 2. scope=Service, ServiceInstance and Endpoint, set neccessary serviceName/serviceInstanceName/endpointName
+    # 3. Scope=ServiceRelation, ServiceInstanceRelation and EndpointRelation
+    #    serviceName/serviceInstanceName/endpointName is/are the source(s)
+    #    destServiceName/destServiceInstanceName/destEndpointName is/are destination(s)
+    #    set necessary names of sources and destinations.
+    scope: Scope!
+    serviceName: String
+    # Normal service is the service having installed agent or metrics reported directly.
+    # Unnormal service is conjectural service, usually detected by the agent.
+    isNormal: Boolean
+    serviceInstanceName: String
+    endpointName: String
+    destServiceName: String
+    # Normal service is the service having installed agent or metrics reported directly.
+    # Unnormal service is conjectural service, usually detected by the agent.
+    destIsNormal: Boolean
+    destServiceInstanceName: String
+    destEndpointName: String
+}
+
 enum Step {
     DAY
     HOUR
@@ -86,6 +108,7 @@ enum Language {
 }
 
 enum Scope {
+    All
     Service
     ServiceInstance
     Endpoint
diff --git a/metadata.graphqls b/metadata.graphqls
index f7e9ec6..fe03fcc 100644
--- a/metadata.graphqls
+++ b/metadata.graphqls
@@ -14,15 +14,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-# Query the cluster brief based on the given duration
-type ClusterBrief {
-    numOfService: Int!
-    numOfEndpoint: Int!
-    numOfDatabase: Int!
-    numOfCache: Int!
-    numOfMQ: Int!
-}
-
 type Service {
     id: ID!
     name: String!
@@ -67,8 +58,6 @@ type TimeInfo {
 }
 
 extend type Query {
-    getGlobalBrief(duration: Duration!): ClusterBrief
-
     # Normal service related metainfo 
     getAllServices(duration: Duration!): [Service!]!
     searchServices(duration: Duration!, keyword: String!): [Service!]!
diff --git a/metrics-v2.graphqls b/metrics-v2.graphqls
new file mode 100644
index 0000000..ebefd2a
--- /dev/null
+++ b/metrics-v2.graphqls
@@ -0,0 +1,83 @@
+# 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.
+
+# Metrics v2 query protocol is an alternative metrics query(s) of original v1, defined in the metric.graphql and aggregation.graphqls.
+# By leveraging the new ID rule(no register) in the v8, we could query metrics based on name(s) directly.
+
+input MetricsCondition {
+    # Metrics name, which should be defined in OAL script
+    # Such as:
+    # Endpoint_avg = from(Endpoint.latency).avg()
+    # Then, `Endpoint_avg`
+    name: String!
+    # Follow entity definition description.
+    entity: Entity
+}
+
+input BatchMetricsConditions {
+    # Metrics name, which should be defined in OAL script
+    # Such as:
+    # Endpoint_avg = from(Endpoint.latency).avg()
+    # Then, `Endpoint_avg`
+    name: String!
+    # Follow entity definition description.
+    ids: [Entity!]!
+}
+
+input TopNCondition {
+    # Metrics name
+    name: String!
+    # Follow entity definition description.
+    entity: Entity
+    topN: Int!
+    order: Order!
+}
+
+type HeatMap {
+    # Each element in nodes represents a point in Thermodynamic Diagram
+    # And the element includes three values:
+    # 1) Time Bucket based on query duration
+    # 2) Response time index.
+    #    Response time = [responseTimeStep * index, responseTimeStep * (index+1))
+    #    The last element: [Response Time * index, MAX)
+    # 3) The number of calls in this response time duration.
+    #
+    # Example:
+    # [ [0, 0, 10], [0, 1, 43], ...]
+    # These ^^^ two represent the left bottom element, and another element above it.
+    nodes: [[Int]!]!
+    axisYStep: Int!
+}
+
+type TopN {
+    name: String!
+    id: ID!
+    value: Long!
+}
+
+extend type Query {
+    getValuesByEntity(metrics: BatchMetricsConditions!, duration: Duration!): IntValues
+    getLinearIntValuesByEntity(metrics: MetricsCondition!, duration: Duration!): IntValues
+    # Query the type of metrics including multiple values, and format them as multiple linears.
+    # The seq of these multiple lines base on the calculation func in OAL
+    # Such as, should us this to query the result of func percentile(50,75,90,95,99) in OAL,
+    # then five lines will be responsed, p50 is the first element of return value.
+    getMultipleLinearIntValuesByEntity(metrics: MetricsCondition!, linearIndex: [Int!]!, duration: Duration!): [IntValues!]!
+    getHeatmapByEntity(metrics: MetricsCondition!, duration: Duration!): HeatMap
+    # Get TopN from the given entity and parameters.
+    # The alternative query of get* in aggregation.graphqls
+    getTopN(metrics: TopNCondition!, order: Order!): [TopN!]!
+}
\ No newline at end of file