You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2020/04/16 07:51:39 UTC

[GitHub] [skywalking-query-protocol] wu-sheng commented on a change in pull request #39: New Metrics Query protocol

wu-sheng commented on a change in pull request #39: New Metrics Query protocol 
URL: https://github.com/apache/skywalking-query-protocol/pull/39#discussion_r409352252
 
 

 ##########
 File path: metrics-v2.graphqls
 ##########
 @@ -0,0 +1,128 @@
+# 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, top-n-records.graphqls, and aggregation.graphqls.
+# By leveraging the new ID rule(no register) in the v8, we could query metrics based on name(s) directly.
+
+type MetricsDefintion {
+    name: String!
+    valueType: MetricsType!
+}
+
+# Metrics type is a new concept since v8.
+enum MetricsType {
+    # Regular value type is suitable for readMetricsValue, readMetricsValues and sortMetrics
+    REGULAR_VALUE
+    # Metrics value includes multiple labels, is suitable for readLabeledMetricsValues
+    # Label should be assigned before the query happens, such as at the setting stage
+    LABELED_VALUE
+    # Heatmap value suitable for readHeatMap
+    HEATMAP
+    # Top metrics is for readSampledRecords only. This value
+    SAMPLED_RECORD
+}
+
+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
+}
+
+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 TopNCondition {
+    # Metrics name
+    name: String!
+    # Follow entity definition description.
+    entity: Entity
+    topN: Int!
+    order: Order!
+}
+
+type MetricsValues {
+    # Could be null if no label assigned in the query condition
+    lable: String
+    # Values of this label value.
+    values: IntValues
+}
+
+type HeatMap {
+    # Each element of values matches the time point of the query duration.
+    # The element in the IntValues represents the value of the same index bucket
+    values: [IntValues!]!
+    # Bucket describes the ranges of #values represent.
+    buckets: [Bucket!]!
+}
+
+# Bucket represents the value range.
+type Bucket {
+    start: Int!
+    end: Int!
+}
+
+type TopNRecords {
+    # Literal string name for visualization
+    name: String!
+    # ID repesents the owner of this entity.
+    id: ID!
+    # Usually an integer as this is metrics.
+    value: String
+    # Have value, Only if the record has related trace id.
+    # UI should show this as an attached value.
+    refId: ID
+}
+
+extend type Query {
+    # Metrics definition metadata query. Respont the metrics type which determines the suitable query methods.
+    typeOfMetrics(names: String!): [MetricsDefintion!]!
+
+    # Read metrics single value in the duration of required metrics for
+    readMetricsValue(metrics: MetricsCondition!, duration: Duration!): Int!
+    readMetricsValues(metrics: MetricsCondition!, duration: Duration!): [MetricsValues!]!
+    sortMetrics(metrics: MetricsCondition!, duration: Duration!): [TopNRecords!]!
+    # Read value in the given time duration, usually as a linear.
+    # labels: the labels you need to query.
+    readLabeledMetricsValues(metrics: MetricsCondition!, labels: [String!]!, duration: Duration!): [MetricsValues!]!
+    # Heatmap is bucket based value statistic result.
+    readHeatMap(metrics: MetricsCondition!, duration: Duration!): HeatMap
 
 Review comment:
   @lunchboxav The heatmap you asked.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services