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/02/10 15:24:01 UTC

[skywalking-data-collect-protocol] branch master updated: Support continuous profiling feature (#83)

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-data-collect-protocol.git


The following commit(s) were added to refs/heads/master by this push:
     new 9b2f4a5  Support continuous profiling feature (#83)
9b2f4a5 is described below

commit 9b2f4a5fb5694381924674d6c15cbead6a388d97
Author: mrproliu <74...@qq.com>
AuthorDate: Fri Feb 10 23:23:55 2023 +0800

    Support continuous profiling feature (#83)
---
 common/Command.proto            |  22 +++++++
 ebpf/profiling/Continuous.proto | 123 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 145 insertions(+)

diff --git a/common/Command.proto b/common/Command.proto
index c62c695..f4f7328 100644
--- a/common/Command.proto
+++ b/common/Command.proto
@@ -74,6 +74,28 @@ import "common/Common.proto";
 //                 MaxResponseSize: Integer
 //         ------------------------
 //     FixedTriggerDuration: Long
+//
+// Name: ContinuousProfilingPolicyQuery
+// Args:
+//     ServiceWithPolicyJSON: List JSON serialization of ServiceWithPolicy.
+//         --- ServiceWithPolicy ---
+//         ServiceName: String
+//         UUID: String
+//         Profiling: Multiple profiling configuration. Map
+//             Key: Profiling type. Enum, value = ON_CPU, OFF_CPU, NETWORK
+//             Value: Profiling policies. Map
+//                 Key: Monitoring type. Enum, value = PROCESS_CPU, PROCESS_THREAD_COUNT, SYSTEM_LOAD, HTTP_ERROR_RATE, HTTP_AVG_RESPONSE_TIME
+//                 Value: Policy configuration. Object.
+//                     Threshold: String
+//                     Period(s): Integer
+//                     Count: Integer
+//                     URIList: List<String>
+//                     URIRegex: String
+//         ---------------------------
+//
+// Name: ContinuousProfilingReportTask
+// Args:
+//     TaskId: String
 message Command {
     // Use command name to distinguish different data type.
     string command = 1;
diff --git a/ebpf/profiling/Continuous.proto b/ebpf/profiling/Continuous.proto
new file mode 100644
index 0000000..b39e42a
--- /dev/null
+++ b/ebpf/profiling/Continuous.proto
@@ -0,0 +1,123 @@
+/*
+ * 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.
+ *
+ */
+
+syntax = "proto3";
+
+package skywalking.v3;
+
+option java_multiple_files = true;
+option java_package = "org.apache.skywalking.apm.network.ebpf.profiling.v3";
+option go_package = "skywalking.apache.org/repo/goapi/collect/ebpf/profiling/v3";
+
+import "common/Command.proto";
+
+service ContinuousProfilingService {
+    // Query continuous profiling policy
+    rpc queryPolicies(ContinuousProfilingPolicyQuery) returns (Commands) {
+    }
+
+    // Report the profiling task when the policy threshold is reached
+    // Use the returned task ID to perform the profiling task through EBPFProfilingService#collectProfilingData.
+    rpc reportProfilingTask(ContinuousProfilingReport) returns (Commands) {
+    }
+}
+
+message ContinuousProfilingPolicyQuery {
+    // current agent contains service and policies
+    repeated ContinuousProfilingServicePolicyQuery policies = 1;
+}
+
+message ContinuousProfilingServicePolicyQuery {
+    // service name of the each process
+    string serviceName = 1;
+    // UUID represents the version(hash/shasum) of the current policies for the service.
+    // This is blank in the initialization stage and is set through the `ContinuousProfilingPolicyQuery` command response for the following rounds of queries.
+    string uuid = 2;
+}
+
+message ContinuousProfilingReport {
+    // over threshold process entity
+    string layer = 1;
+    string serviceName = 2;
+    string instanceName = 3;
+    string processName = 4;
+
+    // reached thresholds causes
+    repeated ContinuousProfilingCause causes = 5;
+
+    // The execution duration for this triggered profiling.
+    // This is set at the agent side.
+    int32 duration = 6;
+    // target profiling task
+    oneof targetTask {
+        ContinuousOnCPUProfilingTask onCPU = 7;
+        ContinuousOffCPUProfilingTask offCPU = 8;
+        ContinuousNetworkProfilingTask network = 9;
+    }
+}
+
+message ContinuousProfilingCause {
+    ContinuousProfilingCauseType type = 1;
+    oneof cause {
+        ContinuousProfilingSingleValueCause singleValue = 2;
+        ContinuousProfilingURICause uri = 3;
+    }
+}
+
+enum ContinuousProfilingCauseType {
+    // Current process CPU usage percent(0-100).
+    ProcessCPU = 0;
+    // The number of threads in the process.
+    ProcessThreadCount = 1;
+    // System load value.
+    SystemLoad = 2;
+    // Process response error rate(0-100).
+    // HTTP response codes in [500-600) are considered errors.
+    // Formula: ErrorCount / TotalCount * 100
+    HTTPErrorRate = 3;
+    // Process response average time(ms).
+    // Formula: TotalResponseTime(ms) / TotalCount
+    HTTPAvgResponseTime = 4;
+}
+
+message ContinuousProfilingSingleValueCause {
+    double threshold = 1;
+    double current = 2;
+}
+
+message ContinuousProfilingURICause {
+    oneof uri {
+        string regex = 1;
+        string path = 2;
+    }
+    double threshold = 3;
+    double current = 4;
+}
+
+// eBPF on CPU profiling task
+message ContinuousOnCPUProfilingTask {
+}
+
+// eBPF off CPU profiling task
+message ContinuousOffCPUProfilingTask {
+}
+
+// eBPF Network profiling task
+message ContinuousNetworkProfilingTask {
+    string samplingURIRegex = 1;
+}
\ No newline at end of file