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 2023/03/01 13:55:38 UTC

[skywalking-query-protocol] branch master updated: Add continuous profiling feature related query protocol (#109)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 4749946  Add continuous profiling feature related query protocol (#109)
4749946 is described below

commit 4749946962b9c685111876d1abe8c745d3cf3253
Author: mrproliu <74...@qq.com>
AuthorDate: Wed Mar 1 21:55:33 2023 +0800

    Add continuous profiling feature related query protocol (#109)
---
 common.graphqls               |  1 +
 continuous-profiling.graphqls | 83 +++++++++++++++++++++++++++++++++++++++++++
 ebpf-profiling.graphqls       | 54 ++++++++++++++++++++++++++--
 3 files changed, 135 insertions(+), 3 deletions(-)

diff --git a/common.graphqls b/common.graphqls
index 4b48d04..cd798c0 100644
--- a/common.graphqls
+++ b/common.graphqls
@@ -104,6 +104,7 @@ enum Scope {
     Service
     ServiceInstance
     Endpoint
+    Process
     ServiceRelation
     ServiceInstanceRelation
     EndpointRelation
diff --git a/continuous-profiling.graphqls b/continuous-profiling.graphqls
new file mode 100644
index 0000000..e1a9a93
--- /dev/null
+++ b/continuous-profiling.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.
+
+# Set policy configuration
+input ContinuousProfilingPolicyCreation {
+    # service of the policy
+    serviceId: ID!
+    # target of the policy
+    targets: [ContinuousProfilingPolicyTargetCreation!]!
+}
+
+input ContinuousProfilingPolicyTargetCreation {
+    targetType: ContinuousProfilingTargetType!
+    checkItems: [ContinuousProfilingPolicyItemCreation!]!
+}
+
+# Policy item of continuous profiling
+input ContinuousProfilingPolicyItemCreation {
+    # define the monitor type to collect metrics
+    type: ContinuousProfilingMonitorType!
+    # threshold of policy, which decide by the monitor type
+    threshold: String!
+    # the length of time to evaluate the metrics
+    period: Int!
+    # how many times after the metrics match the threshold, will trigger profiling
+    count: Int!
+    # the URI path/regex filter when monitor the HTTP related types
+    uriList: [String!]
+    uriRegex: String
+}
+
+enum ContinuousProfilingTargetType {
+    # eBPF On CPU Profiling
+    ON_CPU,
+    # eBPF Off CPU Profiling
+    OFF_CPU,
+    # eBPF Network Profiling
+    NETWORK
+}
+
+type ContinuousProfilingSetResult {
+    # TRUE if the policy is set successfully
+    status: Boolean!
+    # error reason when status == FALSE
+    errorReason: String
+}
+
+type ContinuousProfilingPolicyTarget {
+    type: ContinuousProfilingTargetType!
+    checkItems: [ContinuousProfilingPolicyItem!]!
+}
+
+type ContinuousProfilingPolicyItem {
+    type: ContinuousProfilingMonitorType!
+    threshold: String!
+    period: Int!
+    count: Int!
+    uriList: [String!]
+    uriRegex: String
+}
+
+extend type Mutation {
+    # set the continuous profiling policy
+    setContinuousProfilingPolicy(request: ContinuousProfilingPolicyCreation!): ContinuousProfilingSetResult!
+}
+
+extend type Query {
+    # query all continuous profiling task through service
+    queryContinuousProfilingServiceTargets(serviceId: ID!): [ContinuousProfilingPolicyTarget!]!
+}
\ No newline at end of file
diff --git a/ebpf-profiling.graphqls b/ebpf-profiling.graphqls
index 2d08d35..76559d9 100644
--- a/ebpf-profiling.graphqls
+++ b/ebpf-profiling.graphqls
@@ -110,13 +110,18 @@ type EBPFProfilingTask {
     serviceInstanceName: String
     # process labels for filter
     processLabels: [String!]!
+    # process of profiling task triggered by continuous profiling
+    processId: ID
+    processName: String
 
     # Start time of the task, type is timestamp.
     taskStartTime: Long!
     # profiling task trigger type
     triggerType: EBPFProfilingTriggerType!
-    # "FIXED_TIME" type task profiling duration
+    # task profiling duration
     fixedTriggerDuration: Long
+    # "CONTINUOUS_PROFILING" type task causes
+    continuousProfilingCauses: [ContinuousProfilingTriggeredCause!]
 
     # profiling task target type
     targetType: EBPFProfilingTargetType!
@@ -125,6 +130,46 @@ type EBPFProfilingTask {
     createTime: Long!
 }
 
+type ContinuousProfilingTriggeredCause {
+    # which type is reached the threshold
+    # all causes threshold and current value has multiply with "100" for avoid float value
+    type: ContinuousProfilingMonitorType!
+    # single value based cause
+    singleValue: ContinuousProfilingSingleValueCause
+    # uri based cause
+    uri: ContinuousProfilingURICause
+}
+
+enum ContinuousProfilingMonitorType {
+    # monitoring Process CPU percent, value in [0-100]
+    PROCESS_CPU,
+    # monitoring process thread count, value must bigger than zero
+    PROCESS_THREAD_COUNT,
+    # monitoring current system load
+    SYSTEM_LOAD,
+    # monitoring the process HTTP response error(status>=500) percent, value in [0-100]
+    HTTP_ERROR_RATE,
+    # monitoring the process HTTP response duration(ms)
+    HTTP_AVG_RESPONSE_TIME
+}
+
+type ContinuousProfilingSingleValueCause {
+    # defined threshold
+    threshold: Long!
+    # current value of the process
+    current: Long!
+}
+
+type ContinuousProfilingURICause {
+    # which URI triggered threshold(one of)
+    uriRegex: String
+    uriPath: String
+    # defined threshold
+    threshold: Long!
+    # current value of the process URI
+    current: Long!
+}
+
 type EBPFProfilingSchedule {
     # profiling task schedule ID
     scheduleId: ID!
@@ -186,7 +231,9 @@ enum EBPFProfilingStackType {
 # Define when the profiling task would be execute
 enum EBPFProfilingTriggerType {
     # Appoint the task executing total duration
-    FIXED_TIME
+    FIXED_TIME,
+    # Trigger by the reach the continuous profiling policy
+    CONTINUOUS_PROFILING
 }
 
 # The way of profiling the process
@@ -225,7 +272,8 @@ extend type Query {
     # query eBPF profiling data for prepare create task
     queryPrepareCreateEBPFProfilingTaskData(serviceId: ID!): EBPFProfilingTaskPrepare!
     # query eBPF profiling task list
-    queryEBPFProfilingTasks(serviceId: ID, serviceInstanceId: ID, targets: [EBPFProfilingTargetType!]): [EBPFProfilingTask!]!
+    # query `triggerType == FIXED_TIME` when triggerType is absent
+    queryEBPFProfilingTasks(serviceId: ID, serviceInstanceId: ID, targets: [EBPFProfilingTargetType!], triggerType: EBPFProfilingTriggerType): [EBPFProfilingTask!]!
     # query schedules from profiling task
     queryEBPFProfilingSchedules(taskId: ID!): [EBPFProfilingSchedule!]!
     # analyze the profiling schedule