From ebffbf81ad607482c1855576a12b1a60b11beb90 Mon Sep 17 00:00:00 2001 From: JophieQu_Mac Date: Wed, 23 Jul 2025 06:26:54 +0800 Subject: [PATCH 1/5] feat: support pprof --- pprof/pprof.proto | 74 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 pprof/pprof.proto diff --git a/pprof/pprof.proto b/pprof/pprof.proto new file mode 100644 index 0000000..c317d68 --- /dev/null +++ b/pprof/pprof.proto @@ -0,0 +1,74 @@ +/* + * 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.v10; + +option java_multiple_files = true; +option java_package = "org.apache.skywalking.apm.network.language.pprof.v10"; +option csharp_namespace = "SkyWalking.NetworkProtocol.V10"; +option go_package = "skywalking.apache.org/repo/goapi/collect/language/pprof/v10"; + +import "common/Command.proto"; + +service PprofTask { + // collect pprof data to the OAP server. + rpc collect (stream PprofData) returns (skywalking.v3.Commands); + // getPprofTaskCommands sends query to the OAP server for all pprof tasks to be executed for the given Go Agent instance + rpc getPprofTaskCommands (PprofTaskCommandQuery) returns (skywalking.v3.Commands); +} + +message PprofData { + // metaData of the pprof task and its result data, only sent in the first request. + PprofMetaData metaData = 1; + + oneof result { + string errorMessage = 2; + // pprof binary content + bytes content = 3; + } +} + +enum PprofProfilingStatus { + // PROFILING_SUCCESS indicates the Go Agent has finished the execution + PROFILING_SUCCESS = 0; + // EXECUTION_TASK_ERROR indicates a potential execution error caused by the Go Agent, such as an error in the task parameters that were sent. + EXECUTION_TASK_ERROR = 1; + // TERMINATED_BY_OVERSIZE means that the server cannot receive the pprof file because the size of the file is over the limitation. + TERMINATED_BY_OVERSIZE = 2; +} + +message PprofMetaData { + string service = 1; + string serviceInstance = 2; + // pprof task id + string taskId = 3; + // PprofProfilingStatus indicates the overall status of the pprof task, i.e. success or failure + PprofProfilingStatus type = 4; + // if type is success then it will be the size of the pprof file, otherwise it will be 0 + int32 contentSize = 5; +} + +message PprofTaskCommandQuery { + // service name of the Go process + string service = 1; + string serviceInstance = 2; + + // lastCommandTime is the timestamp of the last pprof task received + int64 lastCommandTime = 3; +} From e6b798cfba320ac8be9a5ad715b034818c86b72d Mon Sep 17 00:00:00 2001 From: JophieQu_Mac Date: Tue, 5 Aug 2025 20:59:10 +0800 Subject: [PATCH 2/5] fix: Add tryupload to check the size of pprof --- pprof/pprof.proto | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pprof/pprof.proto b/pprof/pprof.proto index c317d68..498b561 100644 --- a/pprof/pprof.proto +++ b/pprof/pprof.proto @@ -27,6 +27,8 @@ option go_package = "skywalking.apache.org/repo/goapi/collect/language/pprof/v10 import "common/Command.proto"; service PprofTask { + // tryUpload check the pprof data size. + rpc tryUpload(PprofMetaData) returns (PprofTryUploadResponse); // collect pprof data to the OAP server. rpc collect (stream PprofData) returns (skywalking.v3.Commands); // getPprofTaskCommands sends query to the OAP server for all pprof tasks to be executed for the given Go Agent instance @@ -34,9 +36,7 @@ service PprofTask { } message PprofData { - // metaData of the pprof task and its result data, only sent in the first request. - PprofMetaData metaData = 1; - + PprofMetaData metadata = 1; oneof result { string errorMessage = 2; // pprof binary content @@ -46,11 +46,15 @@ message PprofData { enum PprofProfilingStatus { // PROFILING_SUCCESS indicates the Go Agent has finished the execution - PROFILING_SUCCESS = 0; + PPROF_PROFILING_SUCCESS = 0; // EXECUTION_TASK_ERROR indicates a potential execution error caused by the Go Agent, such as an error in the task parameters that were sent. - EXECUTION_TASK_ERROR = 1; + PPROF_EXECUTION_TASK_ERROR = 1; // TERMINATED_BY_OVERSIZE means that the server cannot receive the pprof file because the size of the file is over the limitation. - TERMINATED_BY_OVERSIZE = 2; + PPROF_TERMINATED_BY_OVERSIZE = 2; +} + +message PprofTryUploadResponse { + PprofProfilingStatus status = 1; } message PprofMetaData { From ca1be2a52fd5f71ed32c1d8fe7c994006763c3b4 Mon Sep 17 00:00:00 2001 From: JophieQu_Mac Date: Wed, 6 Aug 2025 15:43:16 +0800 Subject: [PATCH 3/5] fix: pprof send data dual stream --- pprof/pprof.proto | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/pprof/pprof.proto b/pprof/pprof.proto index 498b561..b24650a 100644 --- a/pprof/pprof.proto +++ b/pprof/pprof.proto @@ -27,15 +27,14 @@ option go_package = "skywalking.apache.org/repo/goapi/collect/language/pprof/v10 import "common/Command.proto"; service PprofTask { - // tryUpload check the pprof data size. - rpc tryUpload(PprofMetaData) returns (PprofTryUploadResponse); // collect pprof data to the OAP server. - rpc collect (stream PprofData) returns (skywalking.v3.Commands); + rpc collect (stream PprofData) returns (stream PprofCollectionResponse); // getPprofTaskCommands sends query to the OAP server for all pprof tasks to be executed for the given Go Agent instance rpc getPprofTaskCommands (PprofTaskCommandQuery) returns (skywalking.v3.Commands); } message PprofData { + // metaData of the pprof task and its result data, only sent in the first request. PprofMetaData metadata = 1; oneof result { string errorMessage = 2; @@ -53,7 +52,7 @@ enum PprofProfilingStatus { PPROF_TERMINATED_BY_OVERSIZE = 2; } -message PprofTryUploadResponse { +message PprofCollectionResponse { PprofProfilingStatus status = 1; } From 3527153600d9afd49cc4a50ee7ec79e66a61085b Mon Sep 17 00:00:00 2001 From: JophieQu_Mac Date: Wed, 6 Aug 2025 17:15:59 +0800 Subject: [PATCH 4/5] fix: adjust the format --- .DS_Store | Bin 0 -> 8196 bytes pprof/{pprof.proto => Pprof.proto} | 6 +++--- 2 files changed, 3 insertions(+), 3 deletions(-) create mode 100644 .DS_Store rename pprof/{pprof.proto => Pprof.proto} (91%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..42dfda57da7b09c34455bf81085389d97200f0a1 GIT binary patch literal 8196 zcmeHMTWl0n7(U;$g>x*IDU{N(tS%M^&;q4^+;M430Rf9_@1V=<&HxjpGi7IX7bTdQ zXw-J{CF?1Bo6^u19#yA~P>b2C}q{(r4+|abhQcV(sXY63E?2qOgFL%S-*bqk` zjzAoNI0A75;t1Rs5uj(bZ2T6_eKi{QaRlNB+?5fK`$LKjDbtZ0Q!?B-s0&K~lClH{ z8=X@f5Mol1OhN^^eHfJLj8U|H|p4a(AIVtT2*z;q{)0TujP+s4twQHU<5_K z!zk>NTCe9hxyreb>$k0PR^4(#2InD7nB!>b^N6z1XEd-q*YCFqK1m_Y zPMMXwe_>18>h%wHZr`=%($s0wbs=Wf50q@*&NbO z1tIFR3%#x}VqMZ3W;Zs?NhH*qtC-3vgT&=|2Ya~+h1lQl$Z;}JMJyWh| zh9ikYY60i_q`k9XQLoG*v3Lmqj9#CdiN5Bt;6tjf{{#zA`6L9h^TVue{6fgPu{#9sf?<+c?)h8}<(y1*@k_ zl!_4DJ2?;U64@nat7!*bAq>dwR3b4X7u#Z*mPvj$Hq6!&dlS7}zepI}c1t#qm~MmO zGH*^VQ8WsJ+MI4vTK#q0l8>n-*2*@sZZ^#F%w=VElD)`Iu{YSe>?}LSK4zb@FW3e4 zCHsc`z>n@y_n;P2FbxUJ#{w)wJ2qe=HsL{ZVK*K|4<123vN!+(dDtkx zM}QKZ#Itw~&*LOs!<%>uZ{t0j!+CswkMJqJ!q>QnpYbdHz!m(dXK}HrPn&>?3yir@+EqOr;Xe!Uy@t9w{8Dl^5wfJGDGTS%&ebvZ}Xz1 z?GJ27kCRBzuEMly861*!0@Xv(hWGh;zJ;kI<|g}y)z-1AxukNdl2Q6($zOg+&c08~ zOX@Ymd!^173zPaJ;=EE9CtH%bMyaOMWyv<7S5YE~5W6zjB6M)2tP$&kUQH>b)Qw`Z z(3#9~rEifdacZ|s)YI$?d!LB<2@&-&`=0&Ceq&eI-{3^d1~j4xbCD!+F2Z88pcSjJ z25YgNsM>{YY{L#bgbezKsDl_n4kj!dgomR<*8oK#>lmKG(|87_@Dg6eD|i*J<224F z!j02#M}>e&;=_qFEM*F= Date: Wed, 6 Aug 2025 17:21:30 +0800 Subject: [PATCH 5/5] fix: remove .DS_Store files --- .DS_Store | Bin 8196 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index 42dfda57da7b09c34455bf81085389d97200f0a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMTWl0n7(U;$g>x*IDU{N(tS%M^&;q4^+;M430Rf9_@1V=<&HxjpGi7IX7bTdQ zXw-J{CF?1Bo6^u19#yA~P>b2C}q{(r4+|abhQcV(sXY63E?2qOgFL%S-*bqk` zjzAoNI0A75;t1Rs5uj(bZ2T6_eKi{QaRlNB+?5fK`$LKjDbtZ0Q!?B-s0&K~lClH{ z8=X@f5Mol1OhN^^eHfJLj8U|H|p4a(AIVtT2*z;q{)0TujP+s4twQHU<5_K z!zk>NTCe9hxyreb>$k0PR^4(#2InD7nB!>b^N6z1XEd-q*YCFqK1m_Y zPMMXwe_>18>h%wHZr`=%($s0wbs=Wf50q@*&NbO z1tIFR3%#x}VqMZ3W;Zs?NhH*qtC-3vgT&=|2Ya~+h1lQl$Z;}JMJyWh| zh9ikYY60i_q`k9XQLoG*v3Lmqj9#CdiN5Bt;6tjf{{#zA`6L9h^TVue{6fgPu{#9sf?<+c?)h8}<(y1*@k_ zl!_4DJ2?;U64@nat7!*bAq>dwR3b4X7u#Z*mPvj$Hq6!&dlS7}zepI}c1t#qm~MmO zGH*^VQ8WsJ+MI4vTK#q0l8>n-*2*@sZZ^#F%w=VElD)`Iu{YSe>?}LSK4zb@FW3e4 zCHsc`z>n@y_n;P2FbxUJ#{w)wJ2qe=HsL{ZVK*K|4<123vN!+(dDtkx zM}QKZ#Itw~&*LOs!<%>uZ{t0j!+CswkMJqJ!q>QnpYbdHz!m(dXK}HrPn&>?3yir@+EqOr;Xe!Uy@t9w{8Dl^5wfJGDGTS%&ebvZ}Xz1 z?GJ27kCRBzuEMly861*!0@Xv(hWGh;zJ;kI<|g}y)z-1AxukNdl2Q6($zOg+&c08~ zOX@Ymd!^173zPaJ;=EE9CtH%bMyaOMWyv<7S5YE~5W6zjB6M)2tP$&kUQH>b)Qw`Z z(3#9~rEifdacZ|s)YI$?d!LB<2@&-&`=0&Ceq&eI-{3^d1~j4xbCD!+F2Z88pcSjJ z25YgNsM>{YY{L#bgbezKsDl_n4kj!dgomR<*8oK#>lmKG(|87_@Dg6eD|i*J<224F z!j02#M}>e&;=_qFEM*F=