Simple APM

Yet another profiling tool

License

License

GroupId

GroupId

com.github.liuzhengyang
ArtifactId

ArtifactId

simple-apm
Last Version

Last Version

1.10.5
Release Date

Release Date

Type

Type

pom
Description

Description

Simple APM
Yet another profiling tool
Project URL

Project URL

http://github.com/liuzhengyang/simple-apm
Source Code Management

Source Code Management

https://github.com/liuzhengyang/simple-apm

Download simple-apm

Filename Size
simple-apm-1.10.5.pom 10 KB
Browse

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.liuzhengyang/simple-apm/ -->
<dependency>
    <groupId>com.github.liuzhengyang</groupId>
    <artifactId>simple-apm</artifactId>
    <version>1.10.5</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.github.liuzhengyang/simple-apm/
implementation 'com.github.liuzhengyang:simple-apm:1.10.5'
// https://jarcasting.com/artifacts/com.github.liuzhengyang/simple-apm/
implementation ("com.github.liuzhengyang:simple-apm:1.10.5")
'com.github.liuzhengyang:simple-apm:pom:1.10.5'
<dependency org="com.github.liuzhengyang" name="simple-apm" rev="1.10.5">
  <artifact name="simple-apm" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.github.liuzhengyang', module='simple-apm', version='1.10.5')
)
libraryDependencies += "com.github.liuzhengyang" % "simple-apm" % "1.10.5"
[com.github.liuzhengyang/simple-apm "1.10.5"]

Dependencies

compile (22)

Group / Artifact Type Version
org.ow2.asm : asm jar 7.2
org.ow2.asm : asm-util jar 7.2
org.ow2.asm : asm-commons jar 7.2
org.ow2.asm : asm-tree jar 7.2
org.ow2.asm : asm-analysis jar 7.2
org.ow2.asm : asm-test jar 7.2
net.bytebuddy : byte-buddy-agent jar 1.10.1
net.bytebuddy : byte-buddy jar 1.10.1
org.javassist : javassist jar 3.26.0-GA
io.netty : netty-all jar 4.1.42.Final
org.slf4j : slf4j-api jar 1.7.28
ch.qos.logback : logback-classic jar 1.2.3
ch.qos.logback : logback-core jar 1.2.3
com.google.guava : guava jar 28.0-jre
org.mvel : mvel2 jar 2.4.4.Final
com.fasterxml.jackson.core : jackson-core jar 2.10.0
com.fasterxml.jackson.core : jackson-databind jar 2.10.0
io.vertx : vertx-shell jar 3.8.5
io.vertx : vertx-core jar 3.8.5
io.vertx : vertx-web jar 3.8.5
io.vertx : vertx-web-templ-freemarker jar 3.8.5
org.apache.commons : commons-lang3 jar 3.9

Project Modules

  • apm-agent
  • apm-boot
  • apm-common
  • apm-core

simple-apm

实现一个简版的arthas。

javaagent运行时attach到目标进程,通过netty启动一个rpc接口,接收命令,如果是监控方法耗时、参数、返回值的watch命令, 则创建一个ClassFileTransformer, 通过ASM修改对应的类,在方法前后注入代码,调用Instrumentation.retransform方法完成增强。

Quick Start

release中下载boot.jar和agent.jar

java -Xbootclasspath/a:${机器上tools.jar位置} -jar apm-boot-1.0-SNAPSHOT-jar-with-dependencies.jar apm-agent-1.0-SNAPSHOT-jar-with-dependencies.jar的全路径位置 目标进程id

启动完成后,可以访问http://localhost:5000/shell.html 或者 telnet localhost 6000进行访问

Commands

目前实现的方法有

sc

Search Class

sc

watch

观察方法的参数、返回值、耗时 watch

el

执行表达式 el

dump

dump一个class到本地class文件

dump xxxx.class

websocket

支持websocket链接,并且提供了一个默认的websocket页面 websocket

Versions

Version
1.10.5
1.10.4
1.10.3
1.10.2
1.10.1
1.10.0
1.8
1.1
1.0