Skip to content

feat: add async-profiler start/stop demo#1

Draft
zhengziyi0117 wants to merge 16 commits into
mainfrom
feat/async-profiler
Draft

feat: add async-profiler start/stop demo#1
zhengziyi0117 wants to merge 16 commits into
mainfrom
feat/async-profiler

Conversation

@zhengziyi0117
Copy link
Copy Markdown
Owner

  • If this pull request closes/resolves/fixes an existing issue, replace the issue number. Closes #.
  • Update the CHANGES log.


public String elasticsearch() throws Exception {
String indexName = UUID.randomUUID().toString();
String indexName2 = UUID.randomUUID().toString();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为什么你这里会涉及ES测试用例的改动?

import org.apache.skywalking.apm.network.language.profile.v3.ProfileTaskGrpc;
import org.apache.skywalking.apm.util.RunnableWithExceptionProtection;

import java.util.ArrayList;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

不要去改imports风格

*/
public byte[] stop(AsyncProfiler asyncProfiler) throws IOException {
LOGGER.info("async profiler process stop and dump file");
asyncProfiler.stop();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对于JFR来说这里这样处理是可以的,但是对于HTML来说其实是不行的。HTML的输出需要指定格式以及文件名


public String start(AsyncProfiler asyncProfiler) throws IOException {
tempFile = Files.createFile(Paths.get("/Users/bytedance/IdeaProjects/skywalking-java/skywalking-output/" + taskId));
execArgs = execArgs + "file=" + tempFile.toAbsolutePath();
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,这里也需要兼容两种方式

因为你后端声明了HTML和JFR

throws IllegalArgumentException, IOException {
LOGGER.info("async profiler execute arg:{}", arg);
String result = asyncProfiler.execute(arg);
if (!result.endsWith("\n")) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这啥意思?

private void stopAsyncProfile(AsyncProfilerTask task) {
try {
// execute stop task
byte[] data = task.stop(ASYNC_PROFILER);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我建议这里不要传bytes吧,应该传递File的引用,几百兆文件的话很占用内存

你分片上传的意义不就是要节约内存吗

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants