mrproliu commented on code in PR #13524:
URL: https://github.com/apache/skywalking/pull/13524#discussion_r2464857867


##########
.github/workflows/skywalking.yaml:
##########
@@ -490,6 +490,9 @@ jobs:
             config: test/e2e-v2/cases/profiling/trace/opensearch/e2e.yaml
             env: OPENSEARCH_VERSION=2.4.0
 
+          - name: Go Profiling

Review Comment:
   ```suggestion
             - name: Go Trace Profiling
   ```
   



##########
.licenserc.yaml:
##########
@@ -70,6 +70,7 @@ header:
     - '**/mockito-extensions/**'
     - 'oap-server/server-library/library-async-profiler-jfr-parser'
     - 'docs/en/changes/changes.tpl'
+    - 'oap-server/server-core/src/main/proto/profile.proto'

Review Comment:
   You should not have this file. 



##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/ProfileThreadSnapshotRecord.java:
##########
@@ -52,6 +52,7 @@ public class ProfileThreadSnapshotRecord extends Record {
     public static final String DUMP_TIME = "dump_time";
     public static final String SEQUENCE = "sequence";
     public static final String STACK_BINARY = "stack_binary";
+    public static final String IS_GO = "is_go";

Review Comment:
   The field name should not be related to specific language. 



##########
.github/workflows/skywalking.yaml:
##########
@@ -490,6 +490,9 @@ jobs:
             config: test/e2e-v2/cases/profiling/trace/opensearch/e2e.yaml
             env: OPENSEARCH_VERSION=2.4.0
 
+          - name: Go Profiling
+            config: test/e2e-v2/cases/go/profiling-cases.yaml

Review Comment:
   Please move this into test/e2e-v2/profiling/trace/go folder. 



##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/ProfileThreadSnapshotRecord.java:
##########
@@ -69,6 +70,18 @@ public class ProfileThreadSnapshotRecord extends Record {
     private int sequence;
     @Column(name = STACK_BINARY)
     private byte[] stackBinary;
+    @ElasticSearch.EnableDocValues
+    @Column(name = IS_GO)
+    @BanyanDB.NoIndexing
+    private int isGo; // store as 0/1 for storage compatibility

Review Comment:
   @please change the field name as language type. 



##########
test/e2e-v2/cases/satellite/native-protocols/expected/profile-segment-analyze.yml:
##########
@@ -15,6 +15,7 @@
 
 tip: null
 trees:
+  {{- if .trees }}

Review Comment:
   Please rollback to the original one. 



##########
.github/workflows/skywalking.yaml:
##########
@@ -969,110 +972,110 @@ jobs:
         with:
           e2e-file: $GITHUB_WORKSPACE/test/e2e-v2/cases/simple/jdk/e2e.yaml
 
-#  e2e-test-banyandb-stages:

Review Comment:
   Why you need to change it?



##########
test/e2e-v2/cases/go/docker-compose.yml:
##########
@@ -48,9 +48,14 @@ services:
       - e2e
     expose:
       - 8080
+    ports:

Review Comment:
   Why you need to define this? Please remove it encase its works for the 
debug. 



##########
test/e2e-v2/cases/profiling/trace/expected/profile-segment-analyze.yml:
##########
@@ -20,7 +20,7 @@ trees:
     {{- contains .elements }}
     - id: "{{ notEmpty .id }}"
       parentid: "{{ notEmpty .parentid }}"
-      codesignature: 
"test.apache.skywalking.e2e.profile.ProfileController.createAuthor:-1"
+      codesignature: "{{ notEmpty .codesignature }}"

Review Comment:
   Why you need to update this?



##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/analyze/GoProfileAnalyzer.java:
##########
@@ -0,0 +1,296 @@
+/*
+ * 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.
+ */
+
+package org.apache.skywalking.oap.server.core.profiling.trace.analyze;
+
+import com.google.perftools.profiles.ProfileProto;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import 
org.apache.skywalking.oap.server.core.profiling.trace.ProfileThreadSnapshotRecord;
+import 
org.apache.skywalking.oap.server.core.query.input.SegmentProfileAnalyzeQuery;
+import org.apache.skywalking.oap.server.core.query.type.ProfileAnalyzation;
+import org.apache.skywalking.oap.server.core.query.type.ProfileStackElement;
+import org.apache.skywalking.oap.server.core.query.type.ProfileStackTree;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Analyzer for Go pprof samples. Builds a stack tree with total/self 
durations using sampling period.
+ * This works independently from ThreadSnapshot, for Go profiles only.
+ */
+public class GoProfileAnalyzer {
+    private static final Logger LOGGER = 
LoggerFactory.getLogger(GoProfileAnalyzer.class);
+
+    /**
+     * Aggregation node for building the stack tree.
+     */
+    private static final class NodeAgg {
+        int id;
+        int parentId;
+        String name;
+        long totalMs;
+        long count;
+        List<Integer> children = new ArrayList<>();
+    }
+
+    /**
+     * Analyze a pprof profile for a specific segment and time window.
+     * periodMs: derived from pprof period/periodType; fallback to 10ms when 
absent.
+     */
+    public ProfileAnalyzation analyze(final String segmentId,

Review Comment:
   Is this already done in the proof library?



##########
oap-server/server-receiver-plugin/skywalking-profile-receiver-plugin/pom.xml:
##########
@@ -33,5 +33,19 @@
             <artifactId>skywalking-sharing-server-plugin</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!-- Protobuf runtime for generated classes in this module -->
+        <dependency>

Review Comment:
   Import the pprof library is enough. 



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to