-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat(add go profile data collect and analyze) #13524
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 78 commits
46ed258
c556d8d
5f01462
332747d
ac584f9
e285f20
b15c41c
1593082
0eb4f7e
50f2d34
1a1f882
ee3e750
c84db28
bcdc2cc
cc2b3cc
07eef41
ea46b39
3c72f4d
c4f9e1f
412e752
3add337
3044195
b0d71f8
120860e
882ae0d
d4136ab
49e0c76
ec1d993
71e059e
34656a8
f98ebc7
ce666ce
1098d3a
6c1ab7b
a28d2aa
fa82fc1
e81831e
e95dd79
1f47a62
72bf450
2963949
bb5b290
de1717f
625226f
f3322d1
1e5ceae
176d64f
9ba032f
600e083
f681970
256cf08
ba0fd1e
fbf76d2
3044b47
fa94f1d
998ccdb
16f1f72
3a0b246
7cb024a
959479e
9eac3b9
d73595d
cee4873
eee3c65
f0a9af4
a60c033
c471434
49823d7
50e7a3e
82a490b
46654e9
7537d87
55ac28e
284d402
b347616
81681b4
8f3e9fd
dfaaac5
bd122b5
f99831b
278fa18
eaaa361
5ba1a8e
0d6bcc7
dea8217
2f89908
dcf2796
582814a
5717d41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| /* | ||
| * 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; | ||
|
|
||
| /** | ||
| * Language type for profile records. Stored as int in storage for compatibility. | ||
| */ | ||
| public enum ProfileLanguageType { | ||
| JAVA(0), | ||
| GO(1); | ||
|
|
||
| private final int value; | ||
|
|
||
| ProfileLanguageType(int value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| public int getValue() { | ||
| return value; | ||
| } | ||
|
|
||
| public static ProfileLanguageType fromValue(int value) { | ||
| for (ProfileLanguageType language : values()) { | ||
| if (language.value == value) { | ||
| return language; | ||
| } | ||
| } | ||
| return JAVA; // default to Java | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
| @@ -0,0 +1,251 @@ | ||||
| /* | ||||
| * 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.Collections; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.stream.Collectors; | ||||
| import java.util.ArrayDeque; | ||||
| 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.apache.skywalking.oap.server.library.pprof.parser.PprofSegmentParser; | ||||
| import org.apache.skywalking.oap.server.library.pprof.parser.PprofParser; | ||||
| 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); | ||||
|
|
||||
| /** | ||||
| * Analyze a pprof profile for a specific segment and time window. | ||||
| */ | ||||
| public ProfileAnalyzation analyze(final String segmentId, | ||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this already done in the proof library? |
||||
| final long startTimeInclusive, | ||||
|
||||
| final long startTimeInclusive, |
Outdated
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The parameter 'endTimeInclusive' is never used.
| final long endTimeInclusive, |
Outdated
Copilot
AI
Oct 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Variable 'int oldId' is never read.
| int oldId = e.getId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing blank line at end of file.