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


##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/ProfileThreadSnapshotRecord.java:
##########
@@ -69,6 +70,50 @@ public class ProfileThreadSnapshotRecord extends Record {
     private int sequence;
     @Column(name = STACK_BINARY)
     private byte[] stackBinary;
+    @ElasticSearch.EnableDocValues
+    @Column(name = LANGUAGE_TYPE)
+    @BanyanDB.NoIndexing
+    private int languageType; // store as 0/1 for storage compatibility
+
+    public enum Language {
+        JAVA(0),
+        GO(1);
+        
+        private final int value;
+        
+        Language(int value) {
+            this.value = value;
+        }
+        
+        public int getValue() {
+            return value;
+        }
+        
+        public static Language fromValue(int value) {
+            for (Language language : values()) {
+                if (language.value == value) {
+                    return language;
+                }
+            }
+            return JAVA; // default to Java
+        }
+    }
+
+    public Language getLanguage() {
+        return Language.fromValue(languageType);
+    }
+
+    public void setLanguage(final Language language) {
+        this.languageType = language.getValue();
+    }
+
+    public boolean isGo() {
+        return languageType == Language.GO.getValue();
+    }
+
+    public void setGo(final boolean go) {

Review Comment:
   It's not suitable for a new language in the future, please remove it. 



##########
oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/profiling/trace/analyze/ProfileAnalyzer.java:
##########
@@ -115,9 +158,41 @@ protected SequenceSearch getAllSequenceRange(String 
segmentId, long start, long
         int minSequence = 
getProfileThreadSnapshotQueryDAO().queryMinSequence(segmentId, start, end);
         int maxSequence = 
getProfileThreadSnapshotQueryDAO().queryMaxSequence(segmentId, start, end) + 1;
 
+        if (LOGGER.isInfoEnabled()) {
+            LOGGER.info("Profile analyze sequence window: segmentId={}, 
start={}, end={}, minSeq={}, maxSeq(exclusive)={}",
+                segmentId, start, end, minSequence, maxSequence);
+        }
+
         // data not found
         if (maxSequence <= 0) {
-            return null;
+            LOGGER.info("Profile analyze not found any sequence in window: 
segmentId={}, start={}, end={}",
+                segmentId, start, end);
+
+            // Go-only fallback: if this segment has Go snapshots, ignore time 
window and fetch any sequences
+            int fbMin = 
getProfileThreadSnapshotQueryDAO().queryMinSequence(segmentId, 0L, 
Long.MAX_VALUE);

Review Comment:
   Why can it not use the previous query result in this method? In your way, it 
will make another 2 DB queries. 



##########
oap-server/server-receiver-plugin/skywalking-profile-receiver-plugin/src/main/java/org/apache/skywalking/oap/server/receiver/profile/provider/handler/ProfileTaskServiceHandler.java:
##########
@@ -160,4 +261,414 @@ private void recordProfileTaskLog(ProfileTask task, 
String instanceId, ProfileTa
         RecordStreamProcessor.getInstance().in(logRecord);
     }
 
+    /**
+     * Parse Go profile data and extract all segment information
+     */
+    private List<GoProfileSegmentInfo> parseGoProfileData(byte[] profileData) {
+        List<GoProfileSegmentInfo> segments = new ArrayList<>();
+        
+        try {
+            // Parse pprof format profile data (payload may be gzip-compressed 
per pprof spec)
+            byte[] parsedBytes = tryDecompressGzip(profileData);
+            ProfileProto.Profile profile = 
ProfileProto.Profile.parseFrom(parsedBytes);

Review Comment:
   Please use `library-pprof-parser` for this. 



##########
apm-protocol/apm-network/src/main/proto:
##########


Review Comment:
   You should not update the protocol, the protocol has already been updated to 
the latest version. 



##########
docs/en/changes/changes.md:
##########
@@ -113,7 +113,9 @@
 * Update Grafana dashboards for OAP observability.
 * BanyanDB: fix query `getInstance` by instance ID.
 * Support the go agent(0.7.0 release) bundled pprof profiling feature. 
-
+* Profile-receiver-plugin: feat: add go profile data receive func; add google 
pprof proto to prase.
+* Storage: feat: add isGo column to ProfileThreadSnapshotRecord.

Review Comment:
   The column name should be changed. 



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