Skip to content

Commit

Permalink
release for opensource
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdiknight committed Feb 26, 2021
1 parent 3c2800c commit 9bd6ac8
Show file tree
Hide file tree
Showing 13 changed files with 551 additions and 24 deletions.
25 changes: 2 additions & 23 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,23 +1,2 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
nb-configuration.xml
target
28 changes: 27 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,30 @@
## xpocket-plugin-arthas
![XPocket](resourse/xpocket.jpg)

### XPocket相关插件会陆续开源放出,敬请期待!
### Arthas Plugin For XPocket
#### 简介
Java诊断工具Arthas的XPocket插件实现

#### 操作指南
使用
``` shell
use arthas@ALIBABA
```
进入Arthas插件域
然后使用
``` shell
help
```
或者
``` shell
system.help arthas@ALIBABA
```
来获取详细帮助信息

更多操作以及介绍请参考[官方介绍](https://arthas.aliyun.com/)

[Arthas](https://github.com/alibaba/arthas)

[XPocket主框架](https://github.com/perfma/xpocket)

[插件下载](https://plugin.xpocket.perfma.com/plugin/52)
57 changes: 57 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.perfmaxpocket</groupId>
<artifactId>xpocket-plugin-arthas</artifactId>
<version>1.0.0-RELEASE</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.perfma.xlab</groupId>
<artifactId>xpocket-plugin-spi</artifactId>
<version>2.0.0-RELEASE</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<dependency>
<groupId>com.perfma.wrapped</groupId>
<artifactId>com.sun.tools</artifactId>
<version>1.8.0_jdk8u275-b01_linux_x64</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>make-assembly-default</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.perfma.xpocket.plugin.arthas;

import com.perfma.xlab.xpocket.spi.command.AbstractXPocketCommand;
import com.perfma.xlab.xpocket.spi.command.CommandList;
import com.perfma.xlab.xpocket.spi.XPocketPlugin;
import com.perfma.xlab.xpocket.spi.process.XPocketProcess;

/**
*
* @author gongyu <yin.tong@perfma.com>
*/
@CommandList(names={"attach","keymap","sc","sm","jad","classloader","getstatic",
"monitor","stack","thread","trace","watch","tt","jvm","perfcounter","ognl","mc",
"redefine","dashboard","dump","heapdump","options","reset","version",
"session","sysprop","sysenv","vmoption","logger","profiler","stop","detach"},
usage={"attach [pid],attach a java process and start the Arthas server in localhost 3658,then connect it",
"keymap for Arthas keyboard shortcut",
"check the info for the classes loaded by JVM",
"check methods info for the loaded classes",
"decompile the specified loaded classes",
"check the inheritance structure, urls, class loading info for the specified class; using classloader to get the url of the resource e.g. java/lang/String.class",
"examine class’s static properties",
"monitor method execution statistics",
"display the stack trace for the specified class and method",
"show java thread information",
"trace the execution time of specified method invocation",
"display the input/output parameter, return object, and thrown exception of specified method invocation",
"time tunnel, record the arguments and returned value for the methods and replay",
"show JVM information",
"show JVM Perf Counter information",
"execute ognl expression",
"Memory compiler, compiles .java files into .class files in memory",
"load external *.class files and re-define it into JVM",
"dashboard for the system’s real-time data",
"dump the loaded classes in byte code to the specified location",
"dump java heap in hprof binary format, like jmap",
"check/set Arthas global options",
"reset all the enhanced classes. All enhanced classes will also be reset when Arthas server is closed by stop",
"print the version for the Arthas attached to the current Java process",
"display current session information",
"view/modify system properties",
"view system environment variables",
"view/modify the vm diagnostic options.",
"print the logger information, update the logger level",
"use async-profiler to generate flame graph",
"terminate the Arthas server, all Arthas sessions will be destroyed",
"disconnect from the Arthas server,but will not destroyed the other Arthas sessions"
})
public class ArthasCommandInvoker extends AbstractXPocketCommand {

private ArthasPlugin plugin;

@Override
public boolean isPiped() {
return false;
}

@Override
public void init(XPocketPlugin plugin) {
this.plugin = (ArthasPlugin)plugin;
}

@Override
public boolean isAvailableNow(String cmd) {
return plugin.isAvaibleNow(cmd);
}

@Override
public void invoke(XPocketProcess process) throws Throwable {
plugin.invoke(process);
}

@Override
public String details(String cmd) {
return plugin.details(cmd);
}



}
Loading

0 comments on commit 9bd6ac8

Please sign in to comment.