diff --git a/site/docs/.vuepress/configs/head.js b/site/docs/.vuepress/configs/head.js index 1b1efe4b1..86dde89cb 100644 --- a/site/docs/.vuepress/configs/head.js +++ b/site/docs/.vuepress/configs/head.js @@ -59,6 +59,7 @@ module.exports = [ "Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas - alibaba/arthas: Alibaba Java Diagnostic Tool Arthas/Alibaba Java诊断利器Arthas", }, ], + // baidu analytics [ "script", {}, @@ -72,4 +73,26 @@ module.exports = [ })(); `, ], + // aplus + [ + "meta", + { + name: "aes-config", + content: "pid=xux-opensource&user_type=101&uid=&username=", + }, + ], + [ + "script", + { + src: "//g.alicdn.com/alilog/mlog/aplus_v2.js", + id: "beacon-aplus", + exparams: "clog=o&aplus&sidx=aplusSidx&ckx=aplusCkx", + }, + ], + [ + "script", + { + src: "//g.alicdn.com/aes/??tracker/1.0.34/index.js,tracker-plugin-pv/2.4.5/index.js,tracker-plugin-event/1.2.5/index.js,tracker-plugin-jserror/1.0.13/index.js,tracker-plugin-api/1.1.14/index.js,tracker-plugin-perf/1.1.8/index.js,tracker-plugin-eventTiming/1.0.4/index.js", + }, + ], ]; diff --git a/site/docs/.vuepress/configs/navbar/en.js b/site/docs/.vuepress/configs/navbar/en.js index 773cb7db8..e4df06349 100644 --- a/site/docs/.vuepress/configs/navbar/en.js +++ b/site/docs/.vuepress/configs/navbar/en.js @@ -12,6 +12,14 @@ module.exports = [ text: "DOCS", link: "/en/doc", }, + { + text: "COMMANDS", + link: "/en/doc/commands.md", + }, + { + text: "DOWNLOAD", + link: "/en/doc/download.md", + }, { text: "SOLUTIONS", children: [ @@ -41,12 +49,4 @@ module.exports = [ }, ], }, - { - text: "DOWNLOAD", - link: "/en/doc/download.md", - }, - { - text: "COMMANDS", - link: "/en/doc/commands.md", - }, ]; diff --git a/site/docs/.vuepress/configs/navbar/zh.js b/site/docs/.vuepress/configs/navbar/zh.js index d953bc6b7..ae272516f 100644 --- a/site/docs/.vuepress/configs/navbar/zh.js +++ b/site/docs/.vuepress/configs/navbar/zh.js @@ -12,6 +12,14 @@ module.exports = [ text: "文档", link: "/doc/", }, + { + text: "命令列表", + link: "/doc/commands.md", + }, + { + text: "下载", + link: "/doc/download.md", + }, { text: "解决方案", children: [ @@ -41,12 +49,4 @@ module.exports = [ }, ], }, - { - text: "下载", - link: "/doc/download.md", - }, - { - text: "命令列表", - link: "/doc/commands.md", - }, ]; diff --git a/site/docs/.vuepress/configs/sidebar/en.js b/site/docs/.vuepress/configs/sidebar/en.js index 752b930a7..8dfd0fbb7 100644 --- a/site/docs/.vuepress/configs/sidebar/en.js +++ b/site/docs/.vuepress/configs/sidebar/en.js @@ -31,7 +31,58 @@ module.exports = { }, ], }, - "/en/doc/commands.md", + { + text: "All Commands", + link: "/en/doc/commands.md", + collapsible: true, + children: [ + "/en/doc/dashboard.md", + "/en/doc/getstatic.md", + "/en/doc/heapdump.md", + "/en/doc/jvm.md", + "/en/doc/logger.md", + "/en/doc/mbean.md", + "/en/doc/memory.md", + "/en/doc/ognl.md", + "/en/doc/perfcounter.md", + "/en/doc/sysenv.md", + "/en/doc/sysprop.md", + "/en/doc/thread.md", + "/en/doc/vmoption.md", + "/en/doc/vmtool.md", + "/en/doc/classloader.md", + "/en/doc/dump.md", + "/en/doc/jad.md", + "/en/doc/mc.md", + "/en/doc/redefine.md", + "/en/doc/retransform.md", + "/en/doc/sc.md", + "/en/doc/sm.md", + "/en/doc/monitor.md", + "/en/doc/stack.md", + "/en/doc/trace.md", + "/en/doc/tt.md", + "/en/doc/watch.md", + "/en/doc/profiler.md", + "/en/doc/auth.md", + "/en/doc/options.md", + "/en/doc/base64.md", + "/en/doc/cat.md", + "/en/doc/cls.md", + "/en/doc/echo.md", + "/en/doc/grep.md", + "/en/doc/help.md", + "/en/doc/history.md", + "/en/doc/keymap.md", + "/en/doc/pwd.md", + "/en/doc/quit.md", + "/en/doc/reset.md", + "/en/doc/session.md", + "/en/doc/stop.md", + "/en/doc/tee.md", + "/en/doc/version.md", + ], + }, "/en/doc/web-console.md", "/en/doc/tunnel.md", "/en/doc/http-api.md", diff --git a/site/docs/.vuepress/configs/sidebar/zh.js b/site/docs/.vuepress/configs/sidebar/zh.js index 36398c28f..69e5e89b7 100644 --- a/site/docs/.vuepress/configs/sidebar/zh.js +++ b/site/docs/.vuepress/configs/sidebar/zh.js @@ -35,7 +35,58 @@ module.exports = { }, ], }, - "/doc/commands.md", + { + text: "命令列表", + link: "/doc/commands.md", + collapsible: true, + children: [ + "/doc/dashboard.md", + "/doc/getstatic.md", + "/doc/heapdump.md", + "/doc/jvm.md", + "/doc/logger.md", + "/doc/mbean.md", + "/doc/memory.md", + "/doc/ognl.md", + "/doc/perfcounter.md", + "/doc/sysenv.md", + "/doc/sysprop.md", + "/doc/thread.md", + "/doc/vmoption.md", + "/doc/vmtool.md", + "/doc/classloader.md", + "/doc/dump.md", + "/doc/jad.md", + "/doc/mc.md", + "/doc/redefine.md", + "/doc/retransform.md", + "/doc/sc.md", + "/doc/sm.md", + "/doc/monitor.md", + "/doc/stack.md", + "/doc/trace.md", + "/doc/tt.md", + "/doc/watch.md", + "/doc/profiler.md", + "/doc/auth.md", + "/doc/options.md", + "/doc/base64.md", + "/doc/cat.md", + "/doc/cls.md", + "/doc/echo.md", + "/doc/grep.md", + "/doc/help.md", + "/doc/history.md", + "/doc/keymap.md", + "/doc/pwd.md", + "/doc/quit.md", + "/doc/reset.md", + "/doc/session.md", + "/doc/stop.md", + "/doc/tee.md", + "/doc/version.md", + ], + }, "/doc/web-console.md", "/doc/tunnel.md", "/doc/http-api.md", diff --git a/site/docs/.vuepress/theme/components/Page.vue b/site/docs/.vuepress/theme/components/Page.vue index dcccef6c2..3613dd899 100644 --- a/site/docs/.vuepress/theme/components/Page.vue +++ b/site/docs/.vuepress/theme/components/Page.vue @@ -7,7 +7,7 @@ import { usePageData } from "@vuepress/client"; function showRightMenu() { const pages = usePageData(); - return pages.value.headers.length > 1; + return pages.value.headers.length > 0; } diff --git a/site/docs/.vuepress/theme/components/RightMenu.vue b/site/docs/.vuepress/theme/components/RightMenu.vue index 612180616..c99e038fc 100644 --- a/site/docs/.vuepress/theme/components/RightMenu.vue +++ b/site/docs/.vuepress/theme/components/RightMenu.vue @@ -8,23 +8,40 @@ SRC: https://github.com/xugaoyi/vuepress-theme-vdoing/blob/master/vdoing/compone
{{ menu }}
-
- {{ item.title }} +
- {{ item.title }} -
+ {{ item.title }} + {{ item.title }} +
+
+ {{ subItem.title }} + {{ subItem.title }} +
+
@@ -48,6 +65,7 @@ menu.value = theme.value.rightMenuText ?? "Table of Contents"; function getHeadersData() { headers.value = pages.value.headers; } + function getHashText() { hashText.value = decodeURIComponent(window.location.hash.slice(1)); } diff --git a/site/docs/doc/README.md b/site/docs/doc/README.md index d8ff97823..8b5189a7a 100644 --- a/site/docs/doc/README.md +++ b/site/docs/doc/README.md @@ -4,7 +4,7 @@ Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 load、内存、gc、线程的状态信息,并能在不修改应用代码的情况下,对业务问题进行诊断,包括查看方法调用的出入参、异常,监测方法执行耗时,类加载信息等,大大提升线上问题排查效率。 -### Arthas(阿尔萨斯)能为你做什么? +## Arthas(阿尔萨斯)能为你做什么? `Arthas` 是 Alibaba 开源的 Java 诊断工具,深受开发者喜爱。 @@ -23,6 +23,6 @@ Arthas 是一款线上监控诊断产品,通过全局视角实时查看应用 **如果您在使用 Arthas,请让我们知道,您的使用对我们非常重要:[查看](https://github.com/alibaba/arthas/issues/111)** -### Contributors +## Contributors [![](https://opencollective.com/arthas/contributors.svg?width=890&button=false)](https://github.com/alibaba/arthas/graphs/contributors) diff --git a/site/docs/doc/auth.md b/site/docs/doc/auth.md index 84cde7554..7eeb2ee29 100644 --- a/site/docs/doc/auth.md +++ b/site/docs/doc/auth.md @@ -4,7 +4,7 @@ 验证当前会话 ::: -### 配置用户名和密码 +## 配置用户名和密码 在 attach 时,可以在命令行指定密码。比如: @@ -20,7 +20,7 @@ java -jar arthas-boot.jar --password ppp Using generated security password: 0vUBJpRIppkKuZ7dYzYqOKtranj4unGh ``` -### 本地连接不鉴权 +## 本地连接不鉴权 默认情况下,在`arthas.properties`文件里有配置: @@ -30,7 +30,7 @@ arthas.localConnectionNonAuth=true 当配置密码时,使用本地连接,也不需要鉴权。默认配置值是 true,方便本地连接使用。只有远程连接时,才需要鉴权。 -### 在 telnet console 里鉴权 +## 在 telnet console 里鉴权 连接到 arthas 后,直接执行命令会提示需要鉴权: @@ -48,15 +48,15 @@ Authentication result: true - 可以通过 `--username` 选项来指定用户,默认值是`arthas`。 -### Web console 密码验证 +## Web console 密码验证 打开浏览器,会有弹窗提示需要输入 用户名 和 密码。 成功之后,则可以直接连接上 web console。 -### HTTP API 验证 +## HTTP API 验证 -#### Authorization Header 方式(推荐) +### Authorization Header 方式(推荐) Arthas 采用的是 HTTP 标准的 Basic Authorization,客户端请求时增加对应的 header 即可。 @@ -70,7 +70,7 @@ curl 'http://localhost:8563/api' \ --data-raw '{"action":"exec","command":"version"}' ``` -#### URL 参数传递方式 +### URL 参数传递方式 为了方便各种特殊情况,支持了以 parameters 方式传递 username 和 password。比如: diff --git a/site/docs/doc/base64.md b/site/docs/doc/base64.md index 045f7d130..6acb6b22b 100644 --- a/site/docs/doc/base64.md +++ b/site/docs/doc/base64.md @@ -4,7 +4,7 @@ base64 编码转换,和 linux 里的 base64 命令类似。 ::: -### 对文件进行 base64 编码 +## 对文件进行 base64 编码 ```bash [arthas@70070]$ echo 'abc' > /tmp/test.txt @@ -15,20 +15,20 @@ abc YWJjCg== ``` -### 对文件进行 base64 编码并把结果保存到文件里 +## 对文件进行 base64 编码并把结果保存到文件里 ```bash $ base64 --input /tmp/test.txt --output /tmp/result.txt ``` -### 用 base64 解码文件 +## 用 base64 解码文件 ``` $ base64 -d /tmp/result.txt abc ``` -### 用 base64 解码文件并保存结果到文件里 +## 用 base64 解码文件并保存结果到文件里 ```bash $ base64 -d /tmp/result.txt --output /tmp/bbb.txt diff --git a/site/docs/doc/batch-support.md b/site/docs/doc/batch-support.md index 1446cd0a4..263cd4c87 100644 --- a/site/docs/doc/batch-support.md +++ b/site/docs/doc/batch-support.md @@ -4,9 +4,9 @@ 通过批处理功能,arthas 支持一次性批量运行多个命令,并取得命令执行的结果。 ::: -### 使用方法 +## 使用方法 -#### 第一步: 创建你的批处理脚本 +### 第一步: 创建你的批处理脚本 这里我们新建了一个`test.as`脚本,为了规范,我们采用了.as 后缀名,但事实上任意的文本文件都 ok。 @@ -27,7 +27,7 @@ thread sc -d org.apache.commons.lang.StringUtils ``` -#### 第二步: 运行你的批处理脚本 +### 第二步: 运行你的批处理脚本 通过`-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。 @@ -41,7 +41,7 @@ sc -d org.apache.commons.lang.StringUtils ./as.sh -c 'sysprop; thread' > test.out # pid 可以通过 jps 命令查看 ``` -#### 第三步: 查看运行结果 +### 第三步: 查看运行结果 ```bash cat test.out diff --git a/site/docs/doc/cat.md b/site/docs/doc/cat.md index 8ef903264..0a3ae34d8 100644 --- a/site/docs/doc/cat.md +++ b/site/docs/doc/cat.md @@ -6,6 +6,8 @@ 打印文件内容,和 linux 里的 cat 命令类似。 ::: +## 使用参考 + ```bash $ cat /tmp/a.txt ``` diff --git a/site/docs/doc/classloader.md b/site/docs/doc/classloader.md index bfac9932f..0871a00bc 100644 --- a/site/docs/doc/classloader.md +++ b/site/docs/doc/classloader.md @@ -10,7 +10,7 @@ 可以让指定的 classloader 去 getResources,打印出所有查找到的 resources 的 url。对于`ResourceNotFoundException`比较有用。 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | --------------------: | :----------------------------------------- | @@ -22,9 +22,9 @@ | `[c: r:]` | 用 ClassLoader 去查找 resource | | `[c: load:]` | 用 ClassLoader 去加载指定的类 | -### 使用参考 +## 使用参考 -#### 按类加载类型查看统计信息 +### 按类加载类型查看统计信息 ```bash $ classloader @@ -37,7 +37,7 @@ $ classloader Affect(row-cnt:5) cost in 3 ms. ``` -#### 按类加载实例查看统计信息 +### 按类加载实例查看统计信息 ```bash $ classloader -l @@ -49,7 +49,7 @@ $ classloader -l Affect(row-cnt:4) cost in 2 ms. ``` -#### 查看 ClassLoader 的继承树 +### 查看 ClassLoader 的继承树 ```bash $ classloader -t @@ -60,7 +60,7 @@ $ classloader -t Affect(row-cnt:4) cost in 3 ms. ``` -#### 查看 URLClassLoader 实际的 urls +### 查看 URLClassLoader 实际的 urls ```bash $ classloader -c 3d4eac69 @@ -82,7 +82,7 @@ file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar Affect(row-cnt:9) cost in 3 ms. ``` -#### 使用 ClassLoader 去查找 resource +### 使用 ClassLoader 去查找 resource ```bash $ classloader -c 3d4eac69 -r META-INF/MANIFEST.MF @@ -98,7 +98,7 @@ $ classloader -c 1b6d3586 -r java/lang/String.class jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class ``` -#### 使用 ClassLoader 去加载类 +### 使用 ClassLoader 去加载类 ```bash $ classloader -c 3d4eac69 --load demo.MathGame @@ -125,7 +125,7 @@ load class success. classLoaderHash 3d4eac69 ``` -#### 统计 ClassLoader 实际使用 URL 和未使用的 URL +### 统计 ClassLoader 实际使用 URL 和未使用的 URL ::: warning 注意,基于 JVM 目前已加载的所有类统计,不代表`Unused URLs`可以从应用中删掉。因为可能将来需要从`Unused URLs`里加载类,或者需要加载`resources`。 diff --git a/site/docs/doc/dashboard.md b/site/docs/doc/dashboard.md index ed21e8c4f..c367c36ab 100644 --- a/site/docs/doc/dashboard.md +++ b/site/docs/doc/dashboard.md @@ -8,14 +8,14 @@ 当运行在 Ali-tomcat 时,会显示当前 tomcat 的实时信息,如 HTTP 请求的 qps, rt, 错误数, 线程池信息等等。 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | -------: | :--------------------------------------- | | [i:] | 刷新实时数据的时间间隔 (ms),默认 5000ms | | [n:] | 刷新实时数据的次数 | -### 使用参考 +## 使用参考 ``` $ dashboard @@ -52,7 +52,7 @@ processors 8 uptime 272s ``` -### 数据说明 +## 数据说明 - ID: Java 级别的线程 ID,注意这个 ID 不能跟 jstack 中的 nativeID 一一对应。 - NAME: 线程名 @@ -65,7 +65,7 @@ uptime 272s - INTERRUPTED: 线程当前的中断位状态 - DAEMON: 是否是 daemon 线程 -#### JVM 内部线程 +### JVM 内部线程 Java 8 之后支持获取 JVM 内部线程 CPU 时间,这些线程只有名称和 CPU 时间,没有 ID 及状态等信息(显示 ID 为-1)。 通过内部线程可以观测到 JVM 活动,如 GC、JIT 编译等占用 CPU 情况,方便了解 JVM 整体运行状况。 @@ -79,6 +79,6 @@ JVM 内部线程包括下面几种: - GC 线程: 如`GC Thread0`, `G1 Young RemSet Sampling` - 其它内部线程: 如`VM Periodic Task Thread`, `VM Thread`, `Service Thread` -### 截图展示 +## 截图展示 ![](/images/dashboard.png "dashboard") diff --git a/site/docs/doc/dump.md b/site/docs/doc/dump.md index 68384e63c..f51058f98 100644 --- a/site/docs/doc/dump.md +++ b/site/docs/doc/dump.md @@ -6,7 +6,7 @@ dump 已加载类的 bytecode 到特定目录 ::: -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | --------------------: | :----------------------------------------- | @@ -16,7 +16,7 @@ dump 已加载类的 bytecode 到特定目录 | `[d:]` | 设置类文件的目标目录 | | [E] | 开启正则表达式匹配,默认为通配符匹配 | -### 使用参考 +## 使用参考 ```bash $ dump java.lang.String diff --git a/site/docs/doc/echo.md b/site/docs/doc/echo.md index 5d97ed813..702dbe55e 100644 --- a/site/docs/doc/echo.md +++ b/site/docs/doc/echo.md @@ -6,6 +6,8 @@ 打印参数,和 linux 里的 echo 命令类似。 ::: +## 使用参考 + ```bash $ echo 'hello' ``` diff --git a/site/docs/doc/getstatic.md b/site/docs/doc/getstatic.md index f4a9d8a69..2716ba4ed 100644 --- a/site/docs/doc/getstatic.md +++ b/site/docs/doc/getstatic.md @@ -2,6 +2,8 @@ [`getstatic`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-getstatic) +### 使用参考 + - 推荐直接使用[ognl](ognl.md)命令,更加灵活。 通过 getstatic 命令可以方便的查看类的静态属性。使用方法为`getstatic class_name field_name` diff --git a/site/docs/doc/grep.md b/site/docs/doc/grep.md index b2c0ce2d8..81ec7ebae 100644 --- a/site/docs/doc/grep.md +++ b/site/docs/doc/grep.md @@ -6,6 +6,8 @@ 类似传统的`grep`命令。 ::: +## 使用参考 + ``` USAGE: grep [-A ] [-B ] [-C ] [-h] [-i] [-v] [-n] [-m ] [-e] [--trim-end] pattern diff --git a/site/docs/doc/heapdump.md b/site/docs/doc/heapdump.md index d3410f37f..e3034e936 100644 --- a/site/docs/doc/heapdump.md +++ b/site/docs/doc/heapdump.md @@ -6,9 +6,9 @@ dump java heap, 类似 jmap 命令的 heap dump 功能。 ::: -### 使用参考 +## 使用参考 -#### dump 到指定文件 +### dump 到指定文件 ```bash [arthas@58205]$ heapdump /tmp/dump.hprof @@ -16,7 +16,7 @@ Dumping heap to /tmp/dump.hprof... Heap dump file created ``` -#### 只 dump live 对象 +### 只 dump live 对象 ```bash [arthas@58205]$ heapdump --live /tmp/dump.hprof @@ -24,7 +24,7 @@ Dumping heap to /tmp/dump.hprof... Heap dump file created ``` -### dump 到临时文件 +## dump 到临时文件 ```bash [arthas@58205]$ heapdump diff --git a/site/docs/doc/help.md b/site/docs/doc/help.md index ae9cf92c7..f86689e0c 100644 --- a/site/docs/doc/help.md +++ b/site/docs/doc/help.md @@ -6,14 +6,14 @@ [help 指令]的等同于[指令 -help],都是查看具体指令的使用说明。 ::: -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | -------: | :----------------------------------------- | | 不接参数 | 查询当前 arthas 版本支持的指令以及指令描述 | | [name:] | 查询具体指令的使用说明 | -### 使用参考 +## 使用参考 ``` $ help diff --git a/site/docs/doc/history.md b/site/docs/doc/history.md index 64b24d51e..987711731 100644 --- a/site/docs/doc/history.md +++ b/site/docs/doc/history.md @@ -6,14 +6,14 @@ 历史指令会通过一个名叫 history 的文件持久化,所以 history 指令可以查看当前 arthas 服务器的所有历史命令,而不仅只是当前次会话使用过的命令。 ::: -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | -------: | :---------------------- | | [c:] | 清空历史指令 | | [n:] | 显示最近执行的 n 条指令 | -### 使用参考 +## 使用参考 ``` #查看最近执行的3条指令 diff --git a/site/docs/doc/http-api.md b/site/docs/doc/http-api.md index 0b16bcc45..d5f721af5 100644 --- a/site/docs/doc/http-api.md +++ b/site/docs/doc/http-api.md @@ -2,20 +2,20 @@ [`Http API`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=case-http-api) -### 概览 +## 概览 Http API 提供类似 RESTful 的交互接口,请求和响应均为 JSON 格式的数据。相对于 Telnet/WebConsole 的输出非结构化文本数据,Http API 可以提供结构化的数据,支持更复杂的交互功能,比如特定应用场景的一系列诊断操作。 -#### 访问地址 +### 访问地址 Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交请求参数。如 POST `http://127.0.0.1:8563/api` 。 注意:telnet 服务的 3658 端口与 Chrome 浏览器有兼容性问题,建议使用 http 端口 8563 来访问 http 接口。 -#### 请求数据格式 +### 请求数据格式 ```json { @@ -39,7 +39,7 @@ Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交 注意: 不同的 action 使用到参数不同,根据具体的 action 来设置参数。 -#### 请求 Action +### 请求 Action 目前支持的请求 Action 如下: @@ -51,7 +51,7 @@ Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交 - `join_session` : 加入会话,用于支持多人共享同一个 Arthas 会话 - `close_session` : 关闭会话 -#### 响应状态 +### 响应状态 响应中的 state 属性表示请求处理状态,取值如下: @@ -60,7 +60,7 @@ Http API 接口地址为:`http://ip:port/api`,必须使用 POST 方式提交 - `FAILED`:请求处理失败(完成状态),通常附带 message 说明原因; - `REFUSED`:请求被拒绝(完成状态),通常附带 message 说明原因; -### 一次性命令 +## 一次性命令 与执行批处理命令类似,一次性命令以同步方式执行。不需要创建会话,不需要设置`sessionId`选项。 @@ -147,7 +147,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ' - 通过`-n`参数指定较少的执行次数。 - 保证命令匹配的方法可以成功命中和 condition-express 编写正确,如果 watch/trace 没有命中就算指定`-n 1`也会挂起等待到执行超时。 -### 会话交互 +## 会话交互 由用户创建及管理 Arthas 会话,适用于复杂的交互过程。访问流程如下: @@ -158,7 +158,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ' - 中断命令执行 - 关闭会话 -#### 创建会话 +### 创建会话 ```bash curl -Ss -XPOST http://localhost:8563/api -d ' @@ -180,7 +180,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ' 当前会话 ID 为: `b09f1353-202c-407b-af24-701b744f971e`, 当前消费者 ID 为:`5ae4e5fbab8b4e529ac404f260d4e2d1_1 `。 -#### 加入会话 +### 加入会话 指定要加入的会话 ID,服务端将分配一个新的消费者 ID。多个消费者可以接收到同一个会话的命令结果。本接口用于支持多人共享同一个会话或刷新页面后重新拉取会话历史记录。 @@ -205,7 +205,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ' 新的消费者 ID 为`8f7f6ad7bc2d4cb5aa57a530927a95cc_2 ` 。 -#### 拉取命令结果 +### 拉取命令结果 拉取命令结果消息的 action 为`pull_results`。请使用 Http long-polling 方式,定时循环拉取结果消息。 消费者的超时时间为 5 分钟,超时后需要调用`join_session`分配新的消费者。每个消费者单独分配一个缓存队列,按顺序拉取命令结果,不会影响到其它消费者。 @@ -274,7 +274,7 @@ while true; do curl -Ss -XPOST http://localhost:8563/api -d ' } ``` -#### 异步执行命令 +### 异步执行命令 ```bash curl -Ss -XPOST http://localhost:8563/api -d ''' @@ -396,7 +396,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' watch 命令结果的`value`为 watch-experss 的值,上面命令中为`{params, returnObj, throwExp}`,所以 watch 结果的 value 为一个长度为 3 的数组,每个元素分别对应相应顺序的表达式。 请参考"[watch 命令输出 map 对象](#change_watch_value_to_map)"小节。 -#### 中断命令执行 +### 中断命令执行 中断会话正在运行的前台 Job(前台任务): @@ -419,7 +419,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` -#### 关闭会话 +### 关闭会话 指定会话 ID,关闭会话。 @@ -438,11 +438,11 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` -### 鉴权 +## 鉴权 参考: [auth](auth.md) -### Web UI +## Web UI ![](/images/arthas-web-ui.png "arthas web ui") @@ -465,9 +465,9 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' -### 特殊命令结果 +## 特殊命令结果 -#### status +### status ```json { @@ -493,7 +493,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` -#### input_status +### input_status ```json { @@ -514,7 +514,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' 允许用户中断命令执行,表示当前正在执行命令,用户可以发送`interrupt_job`中断执行。 - `DISABLED` : 禁用状态,不能输入命令也不能中断命令。 -#### command +### command ```json { @@ -529,7 +529,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' 用于交互 UI 回显用户输入的命令,拉取的会话命令消息历史会包含`command`类型的消息,按顺序处理即可。 -#### enhancer +### enhancer ```json { @@ -549,9 +549,9 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' `trace/watch/jad/tt`等命令需要对类进行增强,会接收到这个`enhancer`结果。可能出现`enhancer`结果成功,但没有命中方法的情况,客户端可以根据`enhancer`结果提示用户。 -### 案例 +## 案例 -#### 获取 Java 应用的 Classpath +### 获取 Java 应用的 Classpath 通过 Http api 查询 Java 应用的 System properties,提取`java.class.path`的值。 @@ -590,7 +590,7 @@ classpath: demo-arthas-spring-boot.jar -#### watch 命令输出 map 对象 +### watch 命令输出 map 对象 watch 的结果值由计算`watch-express` ognl 表达式产生,可以通过改变 ognl 表达式来生成想要的值,请参考[OGNL 文档](https://commons.apache.org/proper/commons-ognl/language-guide.html)。 diff --git a/site/docs/doc/idea-plugin.md b/site/docs/doc/idea-plugin.md index 302304e4a..17b836886 100644 --- a/site/docs/doc/idea-plugin.md +++ b/site/docs/doc/idea-plugin.md @@ -1,6 +1,6 @@ # IDEA Plugin -#### Arthas-idea(部分命令可视化) +## Arthas-idea(部分命令可视化) ::: tip 插件由社区开发者提供。 @@ -10,7 +10,7 @@ - 使用文档:[https://www.yuque.com/arthas-idea-plugin](https://www.yuque.com/arthas-idea-plugin) - 源码地址: [https://github.com/WangJi92/arthas-idea-plugin](https://github.com/WangJi92/arthas-idea-plugin) -#### Alibaba Cloud Toolkit 热部署组件(一键 retransform) +## Alibaba Cloud Toolkit 热部署组件(一键 retransform) ::: tip 热部署组件支持一键将编辑器中修改的 Java 源码快速编译,并更新到远端应用服务中,免去手动 dump、mc 的过程。此外,也可以一键还原 retransform 的类文件。 diff --git a/site/docs/doc/jad.md b/site/docs/doc/jad.md index a96800e01..980c61b5a 100644 --- a/site/docs/doc/jad.md +++ b/site/docs/doc/jad.md @@ -11,7 +11,7 @@ - 在 Arthas Console 上,反编译出来的源码是带语法高亮的,阅读更方便 - 当然,反编译出来的 java 代码可能会存在语法错误,但不影响你进行阅读理解 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | --------------------: | :----------------------------------------- | @@ -20,9 +20,9 @@ | `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name | | [E] | 开启正则表达式匹配,默认为通配符匹配 | -### 使用参考 +## 使用参考 -#### 反编译`java.lang.String` +### 反编译`java.lang.String` ```java $ jad java.lang.String @@ -60,7 +60,7 @@ Location: ... ``` -#### 反编译时只显示源代码 +### 反编译时只显示源代码 默认情况下,反编译结果里会带有`ClassLoader`信息,通过`--source-only`选项,可以只打印源代码。方便和[mc](mc.md)/[retransform](retransform.md)命令结合使用。 @@ -84,7 +84,7 @@ public class MathGame { ... ``` -#### 反编译指定的函数 +### 反编译指定的函数 ```java $ jad demo.MathGame main @@ -105,7 +105,7 @@ Location: } ``` -#### 反编译时不显示行号 +### 反编译时不显示行号 `--lineNumber` 参数默认值为 true,显示指定为 false 则不打印行号。 @@ -128,7 +128,7 @@ public static void main(String[] args) throws InterruptedException { } ``` -#### 反编译时指定 ClassLoader +### 反编译时指定 ClassLoader ::: tip 当有多个 `ClassLoader` 都加载了这个类时,`jad` 命令会输出对应 `ClassLoader` 实例的 `hashcode`,然后你只需要重新执行 `jad` 命令,并使用参数 `-c ` 就可以反编译指定 ClassLoader 加载的那个类了; diff --git a/site/docs/doc/jvm.md b/site/docs/doc/jvm.md index a403271e9..18796374e 100644 --- a/site/docs/doc/jvm.md +++ b/site/docs/doc/jvm.md @@ -6,7 +6,7 @@ 查看当前 JVM 信息 ::: -### 使用参考 +## 使用参考 ``` $ jvm @@ -110,7 +110,7 @@ RUNTIME Affect(row-cnt:0) cost in 88 ms. ``` -### THREAD 相关 +## THREAD 相关 - COUNT: JVM 当前活跃的线程数 - DAEMON-COUNT: JVM 当前活跃的守护线程数 @@ -118,7 +118,7 @@ Affect(row-cnt:0) cost in 88 ms. - STARTED-COUNT: 从 JVM 启动开始总共启动过的线程次数 - DEADLOCK-COUNT: JVM 当前死锁的线程数 -### 文件描述符相关 +## 文件描述符相关 - MAX-FILE-DESCRIPTOR-COUNT:JVM 进程最大可以打开的文件描述符数 - OPEN-FILE-DESCRIPTOR-COUNT:JVM 当前打开的文件描述符数 diff --git a/site/docs/doc/keymap.md b/site/docs/doc/keymap.md index 254d1845c..3fb51666a 100644 --- a/site/docs/doc/keymap.md +++ b/site/docs/doc/keymap.md @@ -1,4 +1,4 @@ -# Arthas 命令行快捷键 +# keymap [`keymap`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-keymap) @@ -31,7 +31,7 @@ - 任何时候 `tab` 键,会根据当前的输入给出提示 - 命令后敲 `-` 或 `--` ,然后按 `tab` 键,可以展示出此命令具体的选项 -#### 自定义快捷键 +## 自定义快捷键 在当前用户目录下新建`$USER_HOME/.arthas/conf/inputrc`文件,加入自定义配置。 @@ -61,7 +61,7 @@ 然后把`"\C-h": backward-delete-char`换成`"\C-h": backward-char`,然后重新连接即可。 -#### 后台异步命令相关快捷键 +## 后台异步命令相关快捷键 - ctrl + c: 终止当前命令 - ctrl + z: 挂起当前命令,后续可以 bg/fg 重新支持此命令,或 kill 掉 diff --git a/site/docs/doc/logger.md b/site/docs/doc/logger.md index 91dfdd85e..86bf30f98 100644 --- a/site/docs/doc/logger.md +++ b/site/docs/doc/logger.md @@ -6,9 +6,9 @@ 查看 logger 信息,更新 logger level ::: -### 使用参考 +## 使用参考 -#### 查看所有 logger 信息 +### 查看所有 logger 信息 以下面的`logback.xml`为例: @@ -82,7 +82,7 @@ - `APPLICATION` logger 是`RollingFileAppender`,它的 file 是`app.log` - `ASYNC`它的`appenderRef`是`APPLICATION`,即异步输出到文件里 -#### 查看指定名字的 logger 信息 +### 查看指定名字的 logger 信息 ```bash [arthas@2062]$ logger -n org.springframework.web @@ -96,7 +96,7 @@ codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar ``` -#### 查看指定 classloader 的 logger 信息 +### 查看指定 classloader 的 logger 信息 注意 hashcode 是变化的,需要先查看当前的 ClassLoader 信息,提取对应 ClassLoader 的 hashcode。 @@ -137,14 +137,14 @@ `--classLoaderClass` 的值是 ClassLoader 的类名,只有匹配到唯一的 ClassLoader 实例时才能工作,目的是方便输入通用命令,而`-c `是动态变化的。 -#### 更新 logger level +### 更新 logger level ```bash [arthas@2062]$ logger --name ROOT --level debug update logger level success. ``` -#### 指定 classloader 更新 logger level +### 指定 classloader 更新 logger level 默认情况下,logger 命令会在 SystemClassloader 下执行,如果应用是传统的`war`应用,或者 spring boot fat jar 启动的应用,那么需要指定 classloader。 @@ -154,7 +154,7 @@ update logger level success. [arthas@2062]$ logger -c 2a139a55 --name ROOT --level debug ``` -#### 查看没有 appender 的 logger 的信息 +### 查看没有 appender 的 logger 的信息 默认情况下,`logger`命令只打印有 appender 的 logger 的信息。如果想查看没有`appender`的 logger 的信息,可以加上参数`--include-no-appender`。 diff --git a/site/docs/doc/mbean.md b/site/docs/doc/mbean.md index 733a5d37b..dbde4a9f8 100644 --- a/site/docs/doc/mbean.md +++ b/site/docs/doc/mbean.md @@ -8,7 +8,7 @@ 这个命令可以便捷的查看或监控 Mbean 的属性信息。 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | ------------------: | :--------------------------------------------------- | @@ -19,7 +19,7 @@ | [n:] | 刷新属性值的次数 | | [E] | 开启正则表达式匹配,默认为通配符匹配。仅对属性名有效 | -### 使用参考 +## 使用参考 列出所有 Mbean 的名称: diff --git a/site/docs/doc/mc.md b/site/docs/doc/mc.md index a8547d501..ee0713b02 100644 --- a/site/docs/doc/mc.md +++ b/site/docs/doc/mc.md @@ -2,6 +2,8 @@ [`mc-retransform`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=command-mc-retransform) +## 使用参考 + ::: tip Memory Compiler/内存编译器,编译`.java`文件生成`.class`。 ::: diff --git a/site/docs/doc/memory.md b/site/docs/doc/memory.md index 0102ce28a..f8427b6f9 100644 --- a/site/docs/doc/memory.md +++ b/site/docs/doc/memory.md @@ -2,7 +2,7 @@ 查看 JVM 内存信息。 -### 使用参考 +## 使用参考 ``` $ memory diff --git a/site/docs/doc/monitor.md b/site/docs/doc/monitor.md index fc1245432..572769287 100644 --- a/site/docs/doc/monitor.md +++ b/site/docs/doc/monitor.md @@ -14,7 +14,7 @@ 服务端是以任务的形式在后台跑任务,植入的代码随着任务的中止而不会被执行,所以任务关闭后,不会对原有性能产生太大影响,而且原则上,任何 Arthas 命令不会引起原有业务逻辑的改变。 -### 监控的维度说明 +## 监控的维度说明 | 监控项 | 说明 | | --------: | :------------------------- | @@ -27,7 +27,7 @@ | rt | 平均 RT | | fail-rate | 失败率 | -### 参数说明 +## 参数说明 方法拥有一个命名参数 `[c:]`,意思是统计周期(cycle of output),拥有一个整型的参数值 @@ -40,7 +40,7 @@ | `[c:]` | 统计周期,默认值为 120 秒 | | [b] | 在**方法调用之前**计算 condition-express | -### 使用参考 +## 使用参考 ```bash $ monitor -c 5 demo.MathGame primeFactors @@ -71,7 +71,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 94 ms. 2018-12-03 19:07:03 demo.MathGame primeFactors 2 2 0 3182.72 0.00% ``` -#### 计算条件表达式过滤统计结果(方法执行完毕之后) +### 计算条件表达式过滤统计结果(方法执行完毕之后) ```bash monitor -c 5 demo.MathGame primeFactors "params[0] <= 2" @@ -98,7 +98,7 @@ Affect(class count: 1 , method count: 1) cost in 19 ms, listenerId: 5 2020-09-02 09:42:56 demo.MathGame primeFactors 5 3 2 0.15 40.00% ``` -#### 计算条件表达式过滤统计结果(方法执行完毕之前) +### 计算条件表达式过滤统计结果(方法执行完毕之前) ```bash monitor -b -c 5 com.test.testes.MathGame primeFactors "params[0] <= 2" diff --git a/site/docs/doc/ognl.md b/site/docs/doc/ognl.md index 62457294d..62acaeddb 100644 --- a/site/docs/doc/ognl.md +++ b/site/docs/doc/ognl.md @@ -8,7 +8,7 @@ 从 3.0.5 版本增加 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | --------------------: | :--------------------------------------------------------------- | @@ -17,7 +17,7 @@ | `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name | | [x] | 结果对象的展开层次,默认值 1 | -### 使用参考 +## 使用参考 - OGNL 特殊用法请参考:[https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71) - OGNL 表达式官方指南:[https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html) diff --git a/site/docs/doc/options.md b/site/docs/doc/options.md index cf2d4da88..910ed7281 100644 --- a/site/docs/doc/options.md +++ b/site/docs/doc/options.md @@ -13,14 +13,14 @@ | batch-re-transform | true | 是否支持批量对匹配到的类执行 retransform 操作 | | json-format | false | 是否支持 json 化的输出 | | disable-sub-class | false | 是否禁用子类匹配,默认在匹配目标类的时候会默认匹配到其子类,如果想精确匹配,可以关闭此开关 | -| support-default-method | true | 是否支持匹配到 default method, 默认会查找 interface,匹配里面的 default method。参考 [#1105](https://github.com/alibaba/arthas/issues/1105) | +| support-default-method | true | 是否支持匹配到 default method, 默认会查找 interface,匹配里面的 default method。参考 [#1105](https://github.com/alibaba/arthas/issues/1105) | | save-result | false | 是否打开执行结果存日志功能,打开之后所有命令的运行结果都将保存到`~/logs/arthas-cache/result.log`中 | -| job-timeout | 1d | 异步后台任务的默认超时时间,超过这个时间,任务自动停止; 比如设置 1d, 2h, 3m, 25s,分别代表天、小时、分、秒 | +| job-timeout | 1d | 异步后台任务的默认超时时间,超过这个时间,任务自动停止;比如设置 1d, 2h, 3m, 25s,分别代表天、小时、分、秒 | | print-parent-fields | true | 是否打印在 parent class 里的 filed | -| verbose | false | 是否打  印更多详细信息 | +| verbose | false | 是否打印更多详细信息 | | strict | true | 是否启用 strict 模式 | -### 查看所有的 options +## 查看所有的 options ```bash $ options @@ -64,7 +64,7 @@ $ options false` ``` -### 获取 option 的值 +## 获取 option 的值 ``` $ options json-format @@ -79,7 +79,7 @@ $ options json-format 默认情况下`json-format`为 false,如果希望`watch`/`tt`等命令结果以 json 格式输出,则可以设置`json-format`为 true。 ::: -### 设置指定的 option +## 设置指定的 option 例如,想打开执行结果存日志功能,输入如下命令即可: @@ -90,7 +90,7 @@ $ options save-result true save-result false true ``` -### 打开 unsafe 开关,支持 jdk package 下的类 +## 打开 unsafe 开关,支持 jdk package 下的类 默认情况下,`watch`/`trace`/`tt`/`trace`/`monitor`等命令不支持`java.*` package 下的类。可以设置`unsafe`为 true,则可以增强。 @@ -107,7 +107,7 @@ Press Q or Ctrl+C to abort. Affect(class count: 1 , method count: 1) cost in 61 ms, listenerId: 1 ``` -### 关闭 strict 模式,允许在 ognl 表达式里设置对象属性 +## 关闭 strict 模式,允许在 ognl 表达式里设置对象属性 ::: tip since 3.6.0 diff --git a/site/docs/doc/perfcounter.md b/site/docs/doc/perfcounter.md index 6c4cc4835..04af53188 100644 --- a/site/docs/doc/perfcounter.md +++ b/site/docs/doc/perfcounter.md @@ -6,7 +6,7 @@ 查看当前 JVM 的 Perf Counter 信息 ::: -### 使用参考 +## 使用参考 ``` $ perfcounter @@ -34,7 +34,7 @@ $ perfcounter -d java.cls.unloadedClasses Monotonic Events 0 ``` -### jdk9 以上的应用 +## jdk9 以上的应用 如果没有打印出信息,应用在启动时,加下面的参数: diff --git a/site/docs/doc/profiler.md b/site/docs/doc/profiler.md index c0656a2d4..9af3f839f 100644 --- a/site/docs/doc/profiler.md +++ b/site/docs/doc/profiler.md @@ -10,7 +10,7 @@ `profiler` 命令基本运行结构是 `profiler action [actionArg]` -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | ----------: | :-------------------------------------------------------------- | @@ -21,7 +21,7 @@ | [d:] | 运行评测指定秒 | | [e:] | 要跟踪哪个事件(cpu, alloc, lock, cache-misses 等),默认是 cpu | -### 启动 profiler +## 启动 profiler ``` $ profiler start @@ -32,14 +32,14 @@ Started [cpu] profiling 默认情况下,生成的是 cpu 的火焰图,即 event 为`cpu`。可以用`--event`参数来指定。 ::: -### 获取已采集的 sample 的数量 +## 获取已采集的 sample 的数量 ``` $ profiler getSamples 23 ``` -### 查看 profiler 状态 +## 查看 profiler 状态 ```bash $ profiler status @@ -48,9 +48,9 @@ $ profiler status 可以查看当前 profiler 在采样哪种`event`和采样时间。 -### 停止 profiler +## 停止 profiler -#### 生成 html 格式结果 +### 生成 html 格式结果 默认情况下,结果文件是`html`格式,也可以用`--format`参数指定: @@ -62,7 +62,7 @@ OK 或者在`--file`参数里用文件名指名格式。比如`--file /tmp/result.html` 。 -### 通过浏览器查看 arthas-output 下面的 profiler 结果 +## 通过浏览器查看 arthas-output 下面的 profiler 结果 默认情况下,arthas 使用 3658 端口,则可以打开: [http://localhost:3658/arthas-output/](http://localhost:3658/arthas-output/) 查看到`arthas-output`目录下面的 profiler 结果: @@ -76,7 +76,7 @@ OK 如果是 chrome 浏览器,可能需要多次刷新。 ::: -### profiler 支持的 events +## profiler 支持的 events 在不同的平台,不同的 OS 下面,支持的 events 各有不同。比如在 macos 下面: @@ -125,7 +125,7 @@ Perf events: $ profiler start --event alloc ``` -### 恢复采样 +## 恢复采样 ```bash $ profiler resume @@ -136,7 +136,7 @@ Started [cpu] profiling 通过执行`profiler getSamples`可以查看 samples 的数量来验证。 -### 使用`execute`来执行复杂的命令 +## 使用`execute`来执行复杂的命令 比如开始采样: @@ -152,14 +152,14 @@ profiler execute 'stop,file=/tmp/result.html' 具体的格式参考: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v2.5/src/arguments.cpp#L50) -### 查看所有支持的 action +## 查看所有支持的 action ```bash $ profiler actions Supported Actions: [resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status] ``` -### 查看版本 +## 查看版本 ```bash $ profiler version @@ -167,7 +167,7 @@ Async-profiler 1.6 built on Sep 9 2019 Copyright 2019 Andrei Pangin ``` -### 配置 framebuf 参数 +## 配置 framebuf 参数 > 如果遇到生成的火焰图有 `[frame_buffer_overflow]`,则需要增大 framebuf(默认值是 1'000'000),可以显式配置,比如: @@ -175,7 +175,7 @@ Copyright 2019 Andrei Pangin profiler start --framebuf 5000000 ``` -### 配置 include/exclude 来过滤数据 +## 配置 include/exclude 来过滤数据 如果应用比较复杂,生成的内容很多,想只关注部分数据,可以通过 include/exclude 来过滤。比如 @@ -185,7 +185,7 @@ profiler start --include 'java/*' --include 'demo/*' --exclude '*Unsafe.park*' > include/exclude 都支持设置多个值 ,但是需要配置在命令行的最后。 -### 指定执行时间 +## 指定执行时间 比如,希望 profiler 执行 300 秒自动结束,可以用 `-d`/`--duration` 参数指定: @@ -193,7 +193,7 @@ profiler start --include 'java/*' --include 'demo/*' --exclude '*Unsafe.park*' profiler start --duration 300 ``` -### 生成 jfr 格式结果 +## 生成 jfr 格式结果 > 注意,jfr 只支持在 `start`时配置。如果是在`stop`时指定,则不会生效。 @@ -211,6 +211,6 @@ profiler start --file /tmp/test.jfr - JDK Mission Control : https://github.com/openjdk/jmc - JProfiler : https://github.com/alibaba/arthas/issues/1416 -### 生成的火焰图里的 unknown +## 生成的火焰图里的 unknown - https://github.com/jvm-profiling-tools/async-profiler/discussions/409 diff --git a/site/docs/doc/pwd.md b/site/docs/doc/pwd.md index d2f0f9b58..4d9aa0553 100644 --- a/site/docs/doc/pwd.md +++ b/site/docs/doc/pwd.md @@ -6,6 +6,8 @@ 返回当前的工作目录,和 linux 命令类似 ::: +## 使用参考 + ```bash $ pwd ``` diff --git a/site/docs/doc/redefine.md b/site/docs/doc/redefine.md index 12cd42b69..3895b13fb 100644 --- a/site/docs/doc/redefine.md +++ b/site/docs/doc/redefine.md @@ -12,7 +12,7 @@ 参考:[Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-) -### 常见问题 +## 常见问题 ::: tip 推荐使用 [retransform](retransform.md) 命令 @@ -37,14 +37,14 @@ 原因是 jdk 本身 redefine 和 Retransform 是不同的机制,同时使用两种机制来更新字节码,只有最后修改的会生效。 ::: -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | --------------------: | :----------------------------------------- | | [c:] | ClassLoader 的 hashcode | | `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name | -### 使用参考 +## 使用参考 ```bash redefine /tmp/Test.class @@ -52,7 +52,7 @@ redefine --classLoaderClass sun.misc.Launcher$AppClassLoader /tmp/Test.class /tmp/Test\$Inner.class ``` -### 结合 jad/mc 命令使用 +## 结合 jad/mc 命令使用 ```bash jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java @@ -66,7 +66,7 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class - mc 命令来内存编译修改过的代码 - 用 redefine 命令加载新的字节码 -### 上传 .class 文件到服务器的技巧 +## 上传 .class 文件到服务器的技巧 使用`mc`命令来编译`jad`的反编译的代码有可能失败。可以在本地修改代码,编译好后再上传到服务器上。有的服务器不允许直接上传文件,可以使用`base64`命令来绕过。 @@ -86,7 +86,7 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class 4. 用 md5 命令计算哈希值,校验是否一致 -### redefine 的限制 +## redefine 的限制 - 不允许新增加 field/method - 正在跑的函数,没有退出不能生效,比如下面新增加的`System.out.println`,只有`run()`函数里的会生效 diff --git a/site/docs/doc/reset.md b/site/docs/doc/reset.md index eea5dd621..e5d0c1267 100644 --- a/site/docs/doc/reset.md +++ b/site/docs/doc/reset.md @@ -1,4 +1,4 @@ -# reset 命令 +# reset [`reset`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=command-reset) @@ -6,7 +6,7 @@ 重置增强类,将被 Arthas 增强过的类全部还原,Arthas 服务端`stop`时会重置所有增强过的类 ::: -### 使用参考 +## 使用参考 ``` $ reset -h @@ -27,7 +27,7 @@ $ reset -h Path and classname of Pattern Matching ``` -### 还原指定类 +## 还原指定类 ``` $ trace Test test @@ -43,7 +43,7 @@ $ reset Test Affect(class-cnt:1 , method-cnt:0) cost in 11 ms. ``` -### 还原所有类 +## 还原所有类 ``` $ trace Test test diff --git a/site/docs/doc/retransform.md b/site/docs/doc/retransform.md index d858127f0..53f421748 100644 --- a/site/docs/doc/retransform.md +++ b/site/docs/doc/retransform.md @@ -8,7 +8,7 @@ 参考:[Instrumentation#retransformClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#retransformClasses-java.lang.Class...-) -### 使用参考 +## 使用参考 ```bash retransform /tmp/Test.class @@ -20,7 +20,7 @@ retransform --classLoaderClass 'sun.misc.Launcher$AppClassLoader' /tmp/Test.class ``` -### retransform 指定的 .class 文件 +## retransform 指定的 .class 文件 ```bash $ retransform /tmp/MathGame.class @@ -34,7 +34,7 @@ demo.MathGame 如果多次执行 retransform 加载同一个 class 文件,则会有多条 retransform entry. ::: -### 查看 retransform entry +## 查看 retransform entry ```bash $ retransform -l @@ -44,7 +44,7 @@ Id ClassName TransformCount LoaderHash LoaderClassName - TransformCount 统计在 ClassFileTransformer#transform 函数里尝试返回 entry 对应的 .class 文件的次数,但并不表明 transform 一定成功。 -### 删除指定 retransform entry +## 删除指定 retransform entry 需要指定 id: @@ -52,13 +52,13 @@ Id ClassName TransformCount LoaderHash LoaderClassName retransform -d 1 ``` -### 删除所有 retransform entry +## 删除所有 retransform entry ```bash retransform --deleteAll ``` -### 显式触发 retransform +## 显式触发 retransform ```bash $ retransform --classPattern demo.MathGame @@ -68,7 +68,7 @@ demo.MathGame > 注意:对于同一个类,当存在多个 retransform entry 时,如果显式触发 retransform ,则最后添加的 entry 生效(id 最大的)。 -### 消除 retransform 的影响 +## 消除 retransform 的影响 如果对某个类执行 retransform 之后,想消除影响,则需要: @@ -79,7 +79,7 @@ demo.MathGame 如果不清除掉所有的 retransform entry,并重新触发 retransform ,则 arthas stop 时,retransform 过的类仍然生效。 ::: -### 结合 jad/mc 命令使用 +## 结合 jad/mc 命令使用 ```bash jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java @@ -93,7 +93,7 @@ retransform /tmp/com/example/demo/arthas/user/UserController.class - mc 命令来内存编译修改过的代码 - 用 retransform 命令加载新的字节码 -### 上传 .class 文件到服务器的技巧 +## 上传 .class 文件到服务器的技巧 使用`mc`命令来编译`jad`的反编译的代码有可能失败。可以在本地修改代码,编译好后再上传到服务器上。有的服务器不允许直接上传文件,可以使用`base64`命令来绕过。 @@ -113,7 +113,7 @@ retransform /tmp/com/example/demo/arthas/user/UserController.class 4. 用 md5 命令计算哈希值,校验是否一致 -### retransform 的限制 +## retransform 的限制 - 不允许新增加 field/method - 正在跑的函数,没有退出不能生效,比如下面新增加的`System.out.println`,只有`run()`函数里的会生效 diff --git a/site/docs/doc/save-log.md b/site/docs/doc/save-log.md index d4d9b93af..805340eca 100644 --- a/site/docs/doc/save-log.md +++ b/site/docs/doc/save-log.md @@ -22,7 +22,7 @@ Affect(row-cnt:1) cost in 3 ms. 结果会异步保存在:`{user.home}/logs/arthas-cache/result.log`,请定期进行清理,以免占据磁盘空间 -### 使用新版本 Arthas 的异步后台任务将结果存日志文件 +## 使用新版本 Arthas 的异步后台任务将结果存日志文件 ```bash $ trace Test t >> & diff --git a/site/docs/doc/sc.md b/site/docs/doc/sc.md index 9c0f258b2..b81e88144 100644 --- a/site/docs/doc/sc.md +++ b/site/docs/doc/sc.md @@ -10,8 +10,6 @@ ## 参数说明 -### 参数说明 - | 参数名称 | 参数说明 | | --------------------: | :---------------------------------------------------------------------------------------------------------------------------------------------------- | | _class-pattern_ | 类名表达式匹配 | @@ -32,7 +30,7 @@ class-pattern 支持全限定名,如 com.taobao.test.AAA,也支持 com/taoba sc 默认开启了子类匹配功能,也就是说所有当前类的子类也会被搜索出来,想要精确的匹配,请打开`options disable-sub-class true`开关 ::: -### 使用参考 +## 使用参考 - 模糊搜索 diff --git a/site/docs/doc/session.md b/site/docs/doc/session.md index 2cdc2df4a..eb4708a08 100644 --- a/site/docs/doc/session.md +++ b/site/docs/doc/session.md @@ -8,7 +8,7 @@ 如果使用了 staturl 做统计,会追加显示 statUrl 地址。 ::: -### 使用参考 +## 使用参考 ``` $ session diff --git a/site/docs/doc/sm.md b/site/docs/doc/sm.md index 06852a854..438213248 100644 --- a/site/docs/doc/sm.md +++ b/site/docs/doc/sm.md @@ -10,7 +10,7 @@ `sm` 命令只能看到由当前类所声明 (declaring) 的方法,父类则无法看到。 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | --------------------: | :------------------------------------------- | @@ -22,7 +22,7 @@ | `[classLoaderClass:]` | 指定执行表达式的 ClassLoader 的 class name | | `[n:]` | 具有详细信息的匹配类的最大数量(默认为 100) | -### 使用参考 +## 使用参考 ```bash $ sm java.lang.String diff --git a/site/docs/doc/spring-boot-starter.md b/site/docs/doc/spring-boot-starter.md index 60be5434a..41f07aca8 100644 --- a/site/docs/doc/spring-boot-starter.md +++ b/site/docs/doc/spring-boot-starter.md @@ -22,7 +22,7 @@ 一键创建包含 Arthas Spring Boot Starter 的工程:点击 ::: -### 配置属性 +## 配置属性 比如,通过配置 tunnel server 实现远程管理: @@ -39,7 +39,7 @@ arthas.tunnel-server=ws://47.75.156.201:7777/ws 参考:[Arthas Properties](arthas-properties.md) -### 查看 Endpoint 信息 +## 查看 Endpoint 信息 ::: tip 需要配置 spring boot 暴露 endpoint:[参考](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints) @@ -58,7 +58,7 @@ http://localhost:8080/actuator/arthas } ``` -### 非 spring boot 应用使用方式 +## 非 spring boot 应用使用方式 非 Spring Boot 应用,可以通过下面的方式来使用: diff --git a/site/docs/doc/stack.md b/site/docs/doc/stack.md index 82c8c6ba0..c5af3b136 100644 --- a/site/docs/doc/stack.md +++ b/site/docs/doc/stack.md @@ -8,7 +8,7 @@ 很多时候我们都知道一个方法被执行,但这个方法被执行的路径非常多,或者你根本就不知道这个方法是从那里被执行了,此时你需要的是 stack 命令。 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | ------------------: | :----------------------------------- | @@ -27,13 +27,13 @@ - 特殊用法请参考:[https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71) - OGNL 表达式官网:[https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html) -### 使用例子 +## 使用例子 -#### 启动 Demo +### 启动 Demo 启动[快速入门](quick-start.md)里的`math-game`。 -#### stack +### stack ```bash $ stack demo.MathGame primeFactors @@ -44,7 +44,7 @@ ts=2018-12-04 01:32:19;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun at demo.MathGame.main(MathGame.java:16) ``` -#### 据条件表达式来过滤 +### 据条件表达式来过滤 ```bash $ stack demo.MathGame primeFactors 'params[0]<0' -n 2 @@ -61,7 +61,7 @@ ts=2018-12-04 01:34:30;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun Command execution times exceed limit: 2, so command will exit. You can set it with -n option. ``` -#### 据执行时间来过滤 +### 据执行时间来过滤 ```bash $ stack demo.MathGame primeFactors '#cost>5' diff --git a/site/docs/doc/stop.md b/site/docs/doc/stop.md index c4f937a2e..b3b04e27b 100644 --- a/site/docs/doc/stop.md +++ b/site/docs/doc/stop.md @@ -1,4 +1,4 @@ -# Stop +# stop 关闭 Arthas 服务端,所有 Arthas 客户端全部退出。 diff --git a/site/docs/doc/sysenv.md b/site/docs/doc/sysenv.md index 16beac538..8a73087a8 100644 --- a/site/docs/doc/sysenv.md +++ b/site/docs/doc/sysenv.md @@ -6,7 +6,7 @@ 查看当前 JVM 的环境属性(`System Environment Variables`) ::: -### 使用参考 +## 使用参考 ``` USAGE: @@ -27,7 +27,7 @@ env name ``` -#### 查看所有环境变量 +### 查看所有环境变量 ``` $ sysenv @@ -65,7 +65,7 @@ $ sysenv AUTOJUMP_ERROR_PATH /Users/admin/Library/autojump/errors.log ``` -#### 查看单个环境变量 +### 查看单个环境变量 ::: tip 支持通过`TAB`键自动补全 diff --git a/site/docs/doc/sysprop.md b/site/docs/doc/sysprop.md index b097625f4..0412b4b62 100644 --- a/site/docs/doc/sysprop.md +++ b/site/docs/doc/sysprop.md @@ -6,7 +6,7 @@ 查看当前 JVM 的系统属性(`System Property`) ::: -### 使用参考 +## 使用参考 ``` USAGE: @@ -29,7 +29,7 @@ property value ``` -#### 查看所有属性 +### 查看所有属性 ``` $ sysprop @@ -104,7 +104,7 @@ $ sysprop sun.cpu.isalist ``` -#### 查看单个属性 +### 查看单个属性 ::: tip 支持通过`TAB`键自动补全 @@ -115,7 +115,7 @@ $ sysprop java.version java.version=1.8.0_51 ``` -#### 修改单个属性 +### 修改单个属性 ``` $ sysprop user.country diff --git a/site/docs/doc/tee.md b/site/docs/doc/tee.md index 2c0c866f5..d86519199 100644 --- a/site/docs/doc/tee.md +++ b/site/docs/doc/tee.md @@ -8,6 +8,8 @@ tee 指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。 ::: +## 使用参考 + ``` USAGE: tee [-a] [-h] [file] diff --git a/site/docs/doc/thread.md b/site/docs/doc/thread.md index 548789aa5..8e9027492 100644 --- a/site/docs/doc/thread.md +++ b/site/docs/doc/thread.md @@ -6,7 +6,7 @@ 查看当前线程信息,查看线程的堆栈 ::: -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | ------------: | :------------------------------------------------------ | @@ -16,11 +16,11 @@ | [i ``] | 指定 cpu 使用率统计的采样间隔,单位为毫秒,默认值为 200 | | [--all] | 显示所有匹配的线程 | -### cpu 使用率是如何统计出来的? +## cpu 使用率是如何统计出来的? 这里的 cpu 使用率与 linux 命令`top -H -p ` 的线程`%CPU`类似,一段采样间隔时间内,当前 JVM 里各个线程的增量 cpu 时间与采样间隔时间的比例。 -#### 工作原理说明: +### 工作原理说明: - 首先第一次采样,获取所有线程的 CPU 时间(调用的是`java.lang.management.ThreadMXBean#getThreadCpuTime()`及`sun.management.HotspotThreadMBean.getInternalThreadCpuTimes()`接口) - 然后睡眠等待一个间隔时间(默认为 200ms,可以通过`-i`指定间隔时间) @@ -35,9 +35,9 @@ 另外一种查看 Java 进程的线程 cpu 使用率方法:可以使用[`show-busy-java-threads`](https://github.com/oldratlee/useful-scripts/blob/dev-2.x/docs/java.md#-show-busy-java-threads)这个脚本。 ::: -### 使用参考 +## 使用参考 -#### 支持一键展示当前最忙的前 N 个线程并打印堆栈: +### 支持一键展示当前最忙的前 N 个线程并打印堆栈: ```shell $ thread -n 3 @@ -73,7 +73,7 @@ $ thread -n 3 注意:线程栈为第二采样结束时获取,不能表明采样间隔时间内该线程都是在处理相同的任务。建议间隔时间不要太长,可能间隔时间越大越不准确。 可以根据具体情况尝试指定不同的间隔时间,观察输出结果。 -#### 当没有参数时,显示第一页线程的信息 +### 当没有参数时,显示第一页线程的信息 默认按照 CPU 增量时间降序排列,只显示第一页数据。 @@ -99,11 +99,11 @@ ID NAME GROUP PRIORITY STATE %CPU 17 arthas-NettyWebsocketTtyBootst system 5 RUNNABLE 0.0 0.000 0:0.001 false true ``` -#### thread --all, 显示所有匹配的线程 +### thread --all, 显示所有匹配的线程 显示所有匹配线程信息,有时需要获取全部 JVM 的线程数据进行分析。 -#### thread id, 显示指定线程的运行堆栈 +### thread id, 显示指定线程的运行堆栈 ```shell $ thread 1 @@ -117,7 +117,7 @@ $ thread 1 at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231) ``` -#### thread -b, 找出当前阻塞其他线程的线程 +### thread -b, 找出当前阻塞其他线程的线程 有时候我们发现应用卡住了, 通常是由于某个线程拿住了某个锁, 并且其他线程都在等待这把锁造成的。 为了排查这类问题, arthas 提供了`thread -b`, 一键找出那个罪魁祸首。 @@ -164,7 +164,7 @@ $ thread -b 注意, 目前只支持找出 synchronized 关键字阻塞住的线程, 如果是`java.util.concurrent.Lock`, 目前还不支持。 ::: -#### thread -i, 指定采样时间间隔 +### thread -i, 指定采样时间间隔 - `thread -i 1000` : 统计最近 1000ms 内的线程 CPU 时间。 @@ -191,7 +191,7 @@ $ thread -n 3 -i 1000 ... ``` -#### thread --state ,查看指定状态的线程 +### thread --state ,查看指定状态的线程 ```bash [arthas@28114]$ thread --state WAITING diff --git a/site/docs/doc/trace.md b/site/docs/doc/trace.md index 7ac9ad93a..09ca573f6 100644 --- a/site/docs/doc/trace.md +++ b/site/docs/doc/trace.md @@ -8,7 +8,7 @@ `trace` 命令能主动搜索 `class-pattern`/`method-pattern` 对应的方法调用路径,渲染和统计整个调用链路上的所有性能开销和追踪调用链路。 -### 参数说明 +## 参数说明 | 参数名称 | 参数说明 | | ------------------: | :----------------------------------- | @@ -34,7 +34,7 @@ watch/stack/trace 这个三个命令都支持`#cost` ::: -### 注意事项 +## 注意事项 - `trace` 能方便的帮助你定位和发现因 RT 高而导致的性能问题缺陷,但其每次只能跟踪一级方法的调用链路。 @@ -44,13 +44,13 @@ watch/stack/trace 这个三个命令都支持`#cost` - 目前不支持 `trace java.lang.Thread getName`,参考 issue: [#1610](https://github.com/alibaba/arthas/issues/1610) ,考虑到不是非常必要场景,且修复有一定难度,因此当前暂不修复 -### 使用参考 +## 使用参考 -#### 启动 Demo +### 启动 Demo 启动[快速入门](quick-start.md)里的`math-game`。 -#### trace 函数 +### trace 函数 ```bash $ trace demo.MathGame run @@ -69,7 +69,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 28 ms. 结果里的 `#24`,表示在 run 函数里,在源文件的第`24`行调用了`primeFactors()`函数。 ::: -#### trace 次数限制 +### trace 次数限制 如果方法调用的次数很多,那么可以用`-n`参数指定捕捉结果的次数。比如下面的例子里,捕捉到一次调用就退出命令。 @@ -85,7 +85,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 20 ms. Command execution times exceed limit: 1, so command will exit. You can set it with -n option. ``` -#### 包含 jdk 的函数 +### 包含 jdk 的函数 - `--skipJDKMethod ` skip jdk method trace, default value true. @@ -120,7 +120,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 60 ms. `---[0.076457ms] java.io.PrintStream:println() #28 ``` -#### 据调用耗时过滤 +### 据调用耗时过滤 ```bash $ trace demo.MathGame run '#cost > 10' @@ -142,7 +142,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 41 ms. - [0,0,0ms,11]xxx:yyy() [throws Exception],对该方法中相同的方法调用进行了合并,`0,0,0ms,11` 表示方法调用耗时,`min,max,total,count`;`throws Exception` 表明该方法调用中存在异常返回 - 这里存在一个统计不准确的问题,就是所有方法耗时加起来可能会小于该监测方法的总耗时,这个是由于 Arthas 本身的逻辑会有一定的耗时 -#### trace 多个类或者多个函数 +### trace 多个类或者多个函数 trace 命令只会 trace 匹配到的函数里的子调用,并不会向下 trace 多层。因为 trace 是代价比较贵的,多层 trace 可能会导致最终要 trace 的类和函数非常多。 @@ -152,7 +152,7 @@ trace 命令只会 trace 匹配到的函数里的子调用,并不会向下 tra trace -E com.test.ClassA|org.test.ClassB method1|method2|method3 ``` -#### 排除掉指定的类 +### 排除掉指定的类 使用 `--exclude-class-pattern` 参数可以排除掉指定的类,比如: @@ -160,7 +160,7 @@ trace -E com.test.ClassA|org.test.ClassB method1|method2|method3 trace javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter ``` -### 动态 trace +## 动态 trace ::: tip 3.3.0 版本后支持。 @@ -210,7 +210,7 @@ Affect(class count: 1 , method count: 1) cost in 34 ms, listenerId: 1 通过指定`listenerId`的方式动态 trace,可以不断深入。另外 `watch`/`tt`/`monitor`等命令也支持类似的功能。 -### trace 结果时间不准确问题 +## trace 结果时间不准确问题 比如下面的结果里:`0.705196 > (0.152743 + 0.145825)` @@ -248,7 +248,7 @@ Affect(class count: 1 , method count: 1) cost in 66 ms, listenerId: 1 3. 在代码执行过程中,JVM 可能出现停顿,比如 GC,进入同步块等。 -#### 使用 -v 参数打印更多信息 +### 使用 -v 参数打印更多信息 ::: tip watch/trace/monitor/stack/tt 命令都支持 `-v` 参数 diff --git a/site/docs/doc/tt.md b/site/docs/doc/tt.md index b72cd29de..3a1cb4205 100644 --- a/site/docs/doc/tt.md +++ b/site/docs/doc/tt.md @@ -12,13 +12,13 @@ 于是乎,TimeTunnel 命令就诞生了。 -### 使用参考 +## 使用参考 -#### 启动 Demo +### 启动 Demo 启动[快速入门](quick-start.md)里的`math-game`。 -#### 记录调用 +### 记录调用 对于一个最基本的使用来说,就是记录下当前方法的每次调用环境现场。 @@ -85,7 +85,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 66 ms. 前边看到了很多条件表达式中,都使用了 `params[0]`,有关这个变量的介绍,请参考[表达式核心变量](advice-class.md) -#### 检索调用记录 +### 检索调用记录 当你用 `tt` 记录了一大片的时间片段之后,你希望能从中筛选出自己需要的时间片段,这个时候你就需要对现有记录进行检索。 @@ -123,7 +123,7 @@ Affect(row-cnt:6) cost in 607 ms. 你需要一个 `-s` 参数。同样的,搜索表达式的核心对象依旧是 `Advice` 对象。 -#### 查看调用信息 +### 查看调用信息 对于具体一个时间片的信息而言,你可以通过 `-i` 参数后边跟着对应的 `INDEX` 编号查看到他的详细信息。 @@ -146,7 +146,7 @@ $ tt -i 1003 Affect(row-cnt:1) cost in 11 ms. ``` -#### 重做一次调用 +### 重做一次调用 当你稍稍做了一些调整之后,你可能需要前端系统重新触发一次你的调用,此时得求爷爷告奶奶的需要前端配合联调的同学再次发起一次调用。而有些场景下,这个调用不是这么好触发的。 @@ -176,7 +176,7 @@ Affect(row-cnt:1) cost in 14 ms. 你会发现结果虽然一样,但调用的路径发生了变化,由原来的程序发起变成了 Arthas 自己的内部线程发起的调用了。 -#### 观察表达式 +### 观察表达式 `-w, --watch-express` 观察时空隧道使用`ognl` 表达式 diff --git a/site/docs/doc/tunnel.md b/site/docs/doc/tunnel.md index efe597b2b..991f38e81 100644 --- a/site/docs/doc/tunnel.md +++ b/site/docs/doc/tunnel.md @@ -11,7 +11,7 @@ - 1: [Web Console](web-console.md) - 2: [Arthas Spring Boot Starter](spring-boot-starter.md) -### 下载部署 arthas tunnel server +## 下载部署 arthas tunnel server [https://github.com/alibaba/arthas/releases](https://github.com/alibaba/arthas/releases) @@ -37,7 +37,7 @@ java -jar arthas-tunnel-server.jar Using generated security password: f1dca050-3777-48f4-a577-6367e55a78a2 ``` -### 启动 arthas 时连接到 tunnel server +## 启动 arthas 时连接到 tunnel server 在启动 arthas,可以传递`--tunnel-server`参数,比如: @@ -87,7 +87,7 @@ id URJZ5L48RPBR2ALI5K4V ![](/images/arthas-tunnel-server.png) -### 最佳实践 +## 最佳实践 ::: tip 注意,agentId 要保持唯一,否则会在 tunnel server 上冲突,不能正常工作。 @@ -103,7 +103,7 @@ Tunnel server 会以`_`做分隔符,提取出`appName`,方便按应用进行 另外,也可以在解压的 arthas 目录下的 `arthas.properties`,或者在 spring boot 应用的`application.properties`里配置`appName`。 ::: -### Tunnel Server 的管理页面 +## Tunnel Server 的管理页面 ::: tip 需要在 spring boot 的`application.properties`里配置 `arthas.enable-detail-pages=true` @@ -147,7 +147,7 @@ id test_PE3LZO9NA9ENJYTPGL9L ![](/images/tunnel-server-agents.png) -### 安全和权限管理 +## 安全和权限管理 ::: tip **强烈建议不要把 tunnel server 直接暴露到公网上。** @@ -158,13 +158,13 @@ id test_PE3LZO9NA9ENJYTPGL9L 1. 用户需要自行开发,对 app name 鉴权。 2. 如果开放管理页面,需要增加安全措施。 -### 集群方式管理 +## 集群方式管理 如果希望部署多台 tunnel server,可以通过 nginx 做转发,redis 来保存 agent 信息。 - nginx 需要配置 sticky session,保证用户 web socket 连接到同一个后端 tunnel server 上。简单的配置方式是用`ip_hash`。 -### Arthas tunnel server 的工作原理 +## Arthas tunnel server 的工作原理 ``` browser <-> arthas tunnel server <-> arthas tunnel client <-> arthas agent diff --git a/site/docs/doc/version.md b/site/docs/doc/version.md index d4dbe2d40..023edcc39 100644 --- a/site/docs/doc/version.md +++ b/site/docs/doc/version.md @@ -2,7 +2,7 @@ 输出当前目标 Java 进程所加载的 Arthas 版本号 -### 使用参考 +## 使用参考 ``` $ version diff --git a/site/docs/doc/vmoption.md b/site/docs/doc/vmoption.md index 08d69bdc4..42690bf06 100644 --- a/site/docs/doc/vmoption.md +++ b/site/docs/doc/vmoption.md @@ -6,9 +6,9 @@ 查看,更新 VM 诊断相关的参数 ::: -### 使用参考 +## 使用参考 -#### 查看所有的 option +### 查看所有的 option ```bash [arthas@56963]$ vmoption @@ -38,7 +38,7 @@ PrintConcurrentLocks false DEFAULT true ``` -#### 查看指定的 option +### 查看指定的 option ```bash $ vmoption PrintGC @@ -47,7 +47,7 @@ $ vmoption PrintGC PrintGC false MANAGEMENT true ``` -#### 更新指定的 option +### 更新指定的 option ```bash $ vmoption PrintGC true diff --git a/site/docs/doc/vmtool.md b/site/docs/doc/vmtool.md index 77d6b749a..21e264107 100644 --- a/site/docs/doc/vmtool.md +++ b/site/docs/doc/vmtool.md @@ -10,7 +10,7 @@ - [JVM Tool Interface](https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html) -### 获取对象 +## 获取对象 ```bash $ vmtool --action getInstances --className java.lang.String --limit 10 @@ -32,13 +32,13 @@ $ vmtool --action getInstances --className java.lang.String --limit 10 通过 `--limit`参数,可以限制返回值数量,避免获取超大数据时对 JVM 造成压力。默认值是 10。 ::: -### 指定 classloader name +## 指定 classloader name ```bash vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext ``` -### 指定 classloader hash +## 指定 classloader hash 可以通过`sc`命令查找到加载 class 的 classloader。 @@ -60,7 +60,7 @@ $ sc -d org.springframework.context.ApplicationContext vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext ``` -### 指定返回结果展开层数 +## 指定返回结果展开层数 ::: tip `getInstances` action 返回结果绑定到`instances`变量上,它是数组。 @@ -72,7 +72,7 @@ vmtool --action getInstances -c 19469ea2 --className org.springframework.context vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext -x 2 ``` -### 执行表达式 +## 执行表达式 ::: tip `getInstances` action 返回结果绑定到`instances`变量上,它是数组。可以通过`--express`参数执行指定的表达式。 @@ -82,7 +82,7 @@ vmtool --action getInstances -c 19469ea2 --className org.springframework.context vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext --express 'instances[0].getBeanDefinitionNames()' ``` -### 强制 GC +## 强制 GC ```bash vmtool --action forceGc diff --git a/site/docs/doc/watch.md b/site/docs/doc/watch.md index ba8e8d730..2f708b207 100644 --- a/site/docs/doc/watch.md +++ b/site/docs/doc/watch.md @@ -8,7 +8,7 @@ 让你能方便的观察到指定函数的调用情况。能观察到的范围为:`返回值`、`抛出异常`、`入参`,通过编写 OGNL 表达式进行对应变量的查看。 -### 参数说明 +## 参数说明 watch 的参数比较多,主要是因为它能在 4 个不同的场景观察对象 @@ -40,13 +40,13 @@ watch 的参数比较多,主要是因为它能在 4 个不同的场景观察 - 当使用 `-b` 时,由于观察事件点是在函数调用前,此时返回值或异常均不存在 - 在 watch 命令的结果里,会打印出`location`信息。`location`有三种可能值:`AtEnter`,`AtExit`,`AtExceptionExit`。对应函数入口,函数正常 return,函数抛出异常。 -### 使用参考 +## 使用参考 -#### 启动 Demo +### 启动 Demo 启动[快速入门](quick-start.md)里的`math-game`。 -#### 观察函数调用返回时的参数、this 对象和返回值 +### 观察函数调用返回时的参数、this 对象和返回值 ::: tip 观察表达式,默认值是`{params, target, returnObj}` @@ -87,7 +87,7 @@ ts=2021-08-31 15:22:58; [cost=1.020982ms] result=@ArrayList[ - 上面的结果里,说明函数被执行了两次,第一次结果是`location=AtExceptionExit`,说明函数抛出异常了,因此`returnObj`是 null - 在第二次结果里是`location=AtExit`,说明函数正常返回,因此可以看到`returnObj`结果是一个 ArrayList -#### 观察函数调用入口的参数和返回值 +### 观察函数调用入口的参数和返回值 ```bash $ watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b @@ -103,7 +103,7 @@ ts=2018-12-03 19:23:23; [cost=0.0353ms] result=@ArrayList[ - 对比前一个例子,返回值为空(事件点为函数执行前,因此获取不到返回值) -#### 同时观察函数调用前和函数返回后 +### 同时观察函数调用前和函数返回后 ```bash $ watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2 @@ -146,7 +146,7 @@ ts=2018-12-03 19:29:54; [cost=4.277392ms] result=@ArrayList[ - 结果的输出顺序和事件发生的先后顺序一致,和命令中 `-s -b` 的顺序无关 -#### 调整`-x`的值,观察具体的函数参数值 +### 调整`-x`的值,观察具体的函数参数值 ```bash $ watch demo.MathGame primeFactors "{params,target}" -x 3 @@ -182,7 +182,7 @@ ts=2018-12-03 19:34:19; [cost=0.587833ms] result=@ArrayList[ - `-x`表示遍历深度,可以调整来打印具体的参数和结果内容,默认值是 1。 - `-x`最大值是 4,防止展开结果占用太多内存。用户可以在`ognl`表达式里指定更具体的 field。 -#### 条件表达式的例子 +### 条件表达式的例子 ```bash $ watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0" @@ -196,7 +196,7 @@ ts=2018-12-03 19:36:04; [cost=0.530255ms] result=@ArrayList[ - 只有满足条件的调用,才会有响应。 -#### 观察异常信息的例子 +### 观察异常信息的例子 ```bash $ watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2 @@ -215,7 +215,7 @@ ts=2018-12-03 19:38:00; [cost=1.414993ms] result=@ArrayList[ - `-e`表示抛出异常时才触发 - express 中,表示异常信息的变量是`throwExp` -#### 按照耗时进行过滤 +### 按照耗时进行过滤 ```bash $ watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2 @@ -234,7 +234,7 @@ ts=2018-12-03 19:40:28; [cost=2112.168897ms] result=@ArrayList[ - `#cost>200`(单位是`ms`)表示只有当耗时大于 200ms 时才会输出,过滤掉执行时间小于 200ms 的调用 -#### 观察当前对象中的属性 +### 观察当前对象中的属性 如果想查看函数运行前后,当前对象中的属性,可以使用`target`关键字,代表当前对象 @@ -258,7 +258,7 @@ ts=2018-12-03 20:04:34; [cost=131.303498ms] result=@Integer[8] ts=2018-12-03 20:04:35; [cost=0.961441ms] result=@Integer[8] ``` -#### 获取类的静态字段、调用类的静态函数的例子 +### 获取类的静态字段、调用类的静态函数的例子 ```bash watch demo.MathGame * '{params,@demo.MathGame@random.nextInt(100)}' -v -n 1 -x 2 @@ -275,7 +275,7 @@ ts=2021-01-05 21:35:20; [cost=0.173966ms] result=@ArrayList[ - 注意这里使用 `Thread.currentThread().getContextClassLoader()` 加载,使用精确`classloader` [ognl](ognl.md)更好。 -#### 排除掉指定的类 +### 排除掉指定的类 ::: tip watch/trace/monitor/stack/tt 命令都支持 `--exclude-class-pattern` 参数 @@ -287,7 +287,7 @@ watch/trace/monitor/stack/tt 命令都支持 `--exclude-class-pattern` 参数 watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter ``` -#### 不匹配子类 +### 不匹配子类 默认情况下 watch/trace/monitor/stack/tt 命令都会匹配子类。如果想不匹配,可以通过全局参数关掉。 @@ -295,7 +295,7 @@ watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter options disable-sub-class true ``` -#### 使用 -v 参数打印更多信息 +### 使用 -v 参数打印更多信息 ::: tip watch/trace/monitor/stack/tt 命令都支持 `-v` 参数 diff --git a/site/docs/doc/web-console.md b/site/docs/doc/web-console.md index b0c636839..755cccd54 100644 --- a/site/docs/doc/web-console.md +++ b/site/docs/doc/web-console.md @@ -2,7 +2,7 @@ [`Web Console`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=case-web-console) -### 通过浏览器连接 arthas +## 通过浏览器连接 arthas Arthas 目前支持 Web Console,用户在 attach 成功之后,可以直接访问:[http://127.0.0.1:8563/](http://127.0.0.1:8563/)。 @@ -21,7 +21,7 @@ Arthas 目前支持 Web Console,用户在 attach 成功之后,可以直接 3.5.4 版本后,在 Web Console 可以鼠标右键复制粘贴。 ::: -### scrollback URL 参数 +## scrollback URL 参数 ::: tip 3.5.5 版本后支持 @@ -31,6 +31,6 @@ Arthas 目前支持 Web Console,用户在 attach 成功之后,可以直接 [http://127.0.0.1:8563/?scrollback=3000](http://127.0.0.1:8563/?scrollback=3000) -### 使用 arthas tunnel server 连接远程 arthas +## 使用 arthas tunnel server 连接远程 arthas 参考:[Arthas Tunnel](tunnel.md) diff --git a/site/docs/en/doc/README.md b/site/docs/en/doc/README.md index 4359e1bee..0bb3f1dea 100644 --- a/site/docs/en/doc/README.md +++ b/site/docs/en/doc/README.md @@ -4,7 +4,7 @@ Arthas is a Java diagnostic tool open-sourced by Alibaba middleware team. It is widely adopted and popular among the developers inside Alibaba. Arthas helps developers in trouble-shooting issues in production environment for Java based applications without modifying code or restarting servers. -### Background +## Background Oftentimes the production system network is inaccessible from local development environment. If issues are encountered in production systems, it is impossible to use IDE to debug the application remotely. What's even worse, debugging in production environment is unacceptable, as it will suspend all the threads, leading to services downtime. @@ -14,7 +14,7 @@ And if you're thinking of adding some logs to your code to help trouble-shoot th Arthas is built to solve these issues. A developer can troubleshoot production issues on the fly. No JVM restart, no additional code changes. Arthas works as an observer, that is, it will never suspend your running threads. -### Key features +## Key features - Check whether a class is loaded? Or where the class is loaded from? (Useful for trouble-shooting jar file conflicts) - Decompile a class to ensure the code is running as expected. @@ -33,6 +33,6 @@ Arthas is built to solve these issues. A developer can troubleshoot production i **If you are using Arthas, please let us know. Your feedback is very important to us: [View](https://github.com/alibaba/arthas/issues/111)** -### Contributors +## Contributors [![](https://opencollective.com/arthas/contributors.svg?width=890&button=false)](https://github.com/alibaba/arthas/graphs/contributors) diff --git a/site/docs/en/doc/auth.md b/site/docs/en/doc/auth.md index ceac8ee9e..9e7580be8 100644 --- a/site/docs/en/doc/auth.md +++ b/site/docs/en/doc/auth.md @@ -4,7 +4,7 @@ Authenticates the current session ::: -### Configure username and password +## Configure username and password When attaching, you can specify a password on the command line. such as: @@ -20,7 +20,7 @@ java -jar arthas-boot.jar --password ppp Using generated security password: 0vUBJpRIppkKuZ7dYzYqOKtranj4unGh ``` -### Local connection does not require authentication +## Local connection does not require authentication By default, there are configurations in the `arthas.properties` file: @@ -30,7 +30,7 @@ arthas.localConnectionNonAuth=true When the password is configured, connect from localhost, the authentication is not required. The default configuration value is true, which is convenient for local connection. Authentication is only required when connecting remotely. -### Authenticate in the telnet console +## Authenticate in the telnet console After connecting to arthas, directly executing the command will prompt for authentication: @@ -48,15 +48,15 @@ Authentication result: true - The user can be specified by the `--username` option, the default value is `arthas`. -### Web console Authentication +## Web console Authentication Open the browser, there will be a pop-up window prompting you to enter your username and password. After success, you can directly connect to the web console. -### HTTP API Authentication +## HTTP API Authentication -#### HTTP Authorization Header(recommended) +### HTTP Authorization Header(recommended) Arthas uses the HTTP standard Basic Authorization. @@ -70,7 +70,7 @@ curl 'http://localhost:8563/api' \ --data-raw '{"action":"exec","command":"version"}' ``` -#### URL parameters +### URL parameters It supports passing username and password in parameters. such as: diff --git a/site/docs/en/doc/base64.md b/site/docs/en/doc/base64.md index fff7d2810..95fe9a263 100644 --- a/site/docs/en/doc/base64.md +++ b/site/docs/en/doc/base64.md @@ -4,7 +4,7 @@ Encode and decode using Base64 representation. ::: -### Encode to base64 +## Encode to base64 ```bash [arthas@70070]$ echo 'abc' > /tmp/test.txt @@ -15,20 +15,20 @@ abc YWJjCg== ``` -### Encode to base64 and save output to file +## Encode to base64 and save output to file ```bash $ base64 --input /tmp/test.txt --output /tmp/result.txt ``` -### Decode from base64 +## Decode from base64 ``` $ base64 -d /tmp/result.txt abc ``` -### Decode from base64 and save output to file +## Decode from base64 and save output to file ```bash $ base64 -d /tmp/result.txt --output /tmp/bbb.txt diff --git a/site/docs/en/doc/batch-support.md b/site/docs/en/doc/batch-support.md index 0a2ea7aed..482b6e137 100644 --- a/site/docs/en/doc/batch-support.md +++ b/site/docs/en/doc/batch-support.md @@ -2,9 +2,9 @@ With the help of Batch Processing, you can run multiple commands in batch and get the final result at the end. -### Usage +## Usage -#### Step 1: Create the script +### Step 1: Create the script Create a `test.as` script suffixed with `as`. Here `as` is suggested for the suffix of the filename, but in fact any suffix is acceptable. @@ -24,7 +24,7 @@ Note: - Commands such as `watch`/`tt`/`trace`/`monitor`/`stack` should include `-n` option to ensure the script can be able to quit. - Also consider to use `async` (for example: `watch c.t.X test returnObj > &`) to put commands run at background and get the output from the log file, see more from [asynchronous job](async.md) -#### Step 2: Run the script +### Step 2: Run the script Use `-f` to specify the script file. By default the result will be output to the standard output, but you can redirect the output to the file like this: @@ -38,7 +38,7 @@ Use `-c` also can specify the commands, like this: ./as.sh -c 'sysprop; thread' 56328 > test.out ``` -#### Step 3: Check the output +### Step 3: Check the output ```bash cat test.out diff --git a/site/docs/en/doc/cat.md b/site/docs/en/doc/cat.md index 12794a525..7179875a7 100644 --- a/site/docs/en/doc/cat.md +++ b/site/docs/en/doc/cat.md @@ -6,6 +6,8 @@ Concatenate and print files ::: +## Usage + ```bash $ cat /tmp/a.txt ``` diff --git a/site/docs/en/doc/classloader.md b/site/docs/en/doc/classloader.md index 9aa0df93e..7ba94174a 100644 --- a/site/docs/en/doc/classloader.md +++ b/site/docs/en/doc/classloader.md @@ -8,7 +8,7 @@ View hierarchy, urls and classes-loading info for the class-loaders. `classloader` can search and print out the URLs for a specified resource from one particular classloader. It is quite handy when analyzing `ResourceNotFoundException`. -### Options +## Options | Name | Specification | | --------------------: | :----------------------------------------------------------------------------------------------------------- | @@ -20,9 +20,9 @@ View hierarchy, urls and classes-loading info for the class-loaders. | `[c: r:]` | using ClassLoader to search resource | | `[c: load:]` | using ClassLoader to load class | -### Usage +## Usage -#### View statistics categorized by class type +### View statistics categorized by class type ```bash $ classloader @@ -35,7 +35,7 @@ $ classloader Affect(row-cnt:5) cost in 3 ms. ``` -#### View statistics categorized by loaded classes number +### View statistics categorized by loaded classes number ```bash $ classloader -l @@ -47,7 +47,7 @@ $ classloader -l Affect(row-cnt:4) cost in 2 ms. ``` -#### View class-loaders hierarchy +### View class-loaders hierarchy ```bash $ classloader -t @@ -58,7 +58,7 @@ $ classloader -t Affect(row-cnt:4) cost in 3 ms. ``` -#### Show the URLs of the URLClassLoader +### Show the URLs of the URLClassLoader ```bash $ classloader -c 3d4eac69 @@ -80,7 +80,7 @@ file:/Users/hengyunabc/.arthas/lib/3.0.5/arthas/arthas-agent.jar Affect(row-cnt:9) cost in 3 ms. ``` -#### Use the classloader to load resource +### Use the classloader to load resource ```bash $ classloader -c 3d4eac69 -r META-INF/MANIFEST.MF @@ -96,7 +96,7 @@ $ classloader -c 1b6d3586 -r java/lang/String.class jar:file:/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk/Contents/Home/jre/lib/rt.jar!/java/lang/String.class ``` -#### Use the classloader to load class +### Use the classloader to load class ```bash $ classloader -c 3d4eac69 --load demo.MathGame @@ -123,7 +123,7 @@ load class success. classLoaderHash 3d4eac69 ``` -#### Statistics ClassLoader actually used URLs and unused URLs +### Statistics ClassLoader actually used URLs and unused URLs ::: warning Note that statistics are based on all classes currently loaded by the JVM. Does not mean that `Unused URLs` can be removed from the application. Because it may be necessary to load classes from `Unused URLs` in the future, or to load `resources`. diff --git a/site/docs/en/doc/commands.md b/site/docs/en/doc/commands.md index 75d603c88..76460b0d5 100644 --- a/site/docs/en/doc/commands.md +++ b/site/docs/en/doc/commands.md @@ -8,6 +8,7 @@ - [jvm](jvm.md) - show JVM information - [logger](logger.md) - print the logger information, update the logger level - [mbean](mbean.md) - show Mbean information +- [memory](memory.md) - show JVM memory information - [ognl](ognl.md) - execute ognl expression - [perfcounter](perfcounter.md) - show JVM Perf Counter information - [sysenv](sysenv.md) — view system environment variables @@ -39,6 +40,10 @@ - [tt](tt.md) - time tunnel, record the arguments and returned value for the methods and replay - [watch](watch.md) - display the input/output parameter, return object, and thrown exception of specified method invocation +## profiler/flame graph + +- [profiler](profiler.md) - use [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) to generate flame graph + ## authentication - [auth](auth.md) - authentication @@ -47,15 +52,11 @@ - [options](options.md) - check/set Arthas global options -## profiler/flame graph - -- [profiler](profiler.md) - use [async-profiler](https://github.com/jvm-profiling-tools/async-profiler) to generate flame graph - ## pipe Arthas provides `pipe` to process the result returned from commands further, e.g. `sm java.lang.String * | grep 'index'`. Commands supported in `pipe`: -- grep - filter the result with the given keyword +- [grep](grep.md)- filter the result with the given keyword - plaintext - remove the ANSI color - wc - count lines diff --git a/site/docs/en/doc/dashboard.md b/site/docs/en/doc/dashboard.md index 2b8fc2e2b..6cd283d1c 100644 --- a/site/docs/en/doc/dashboard.md +++ b/site/docs/en/doc/dashboard.md @@ -8,14 +8,14 @@ This is the real time statistics dashboard for the current system, press `Ctrl+C When running in Apache Tomcat Alibaba edition, the dashboard will also present the real time statistics of the tomcat, including [QPS](https://en.wikipedia.org/wiki/Queries_per_second), RT, error counts, and thread pool, etc. -### Options +## Options | Name | Specification | | ---: | :--------------------------------------------------------------- | | [i:] | The interval (in ms) between two executions, default is 5000 ms. | | [n:] | The number of times this command will be executed. | -### Usage +## Usage ``` $ dashboard @@ -52,7 +52,7 @@ processors 8 uptime 272s ``` -### Notes on column headers +## Notes on column headers - ID: JVM thread ID, pls. note this ID is different from the nativeID in jstack - NAME: thread name @@ -66,7 +66,7 @@ uptime 272s - INTERRUPTED: the thread interruption state - DAEMON: daemon thread or not -#### JVM internal threads +### JVM internal threads After Java 8, it is supported to obtain the CPU time of JVM internal threads. These threads only have the name and CPU time, without ID and status information (display ID is -1). @@ -84,6 +84,6 @@ JVM internal threads include the following: - GC thread: such as `GC Thread0`, `G1 Young RemSet Sampling` - Other internal threads: such as`VM Periodic Task Thread`, `VM Thread`, `Service Thread` -### Screenshot +## Screenshot ![](/images/dashboard.png "dashboard") diff --git a/site/docs/en/doc/dump.md b/site/docs/en/doc/dump.md index d3c0a8791..17965f39c 100644 --- a/site/docs/en/doc/dump.md +++ b/site/docs/en/doc/dump.md @@ -6,7 +6,7 @@ Dump the bytecode for the particular classes to the specified directory. ::: -### Options +## Options | Name | Specification | | --------------------: | :-------------------------------------------------------------------------- | @@ -16,7 +16,7 @@ Dump the bytecode for the particular classes to the specified directory. | `[d:]` | set the destination directory for class files | | `[E]` | turn on regex match, the default behavior is wild card match | -### Usage +## Usage ```bash $ dump java.lang.String diff --git a/site/docs/en/doc/echo.md b/site/docs/en/doc/echo.md index 63335bbcd..90fe16a14 100644 --- a/site/docs/en/doc/echo.md +++ b/site/docs/en/doc/echo.md @@ -6,6 +6,8 @@ write arguments to the standard output. ::: +## Usage + ```bash $ echo 'hello' ``` diff --git a/site/docs/en/doc/getstatic.md b/site/docs/en/doc/getstatic.md index ba49c348f..85826d866 100644 --- a/site/docs/en/doc/getstatic.md +++ b/site/docs/en/doc/getstatic.md @@ -2,6 +2,8 @@ [`getstatic` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=command-getstatic) +## Usage + - It is recommended to use the [OGNL] (ognl.md) command, which will be more flexible. Check the static fields of classes conveniently, the usage is `getstatic class_name field_name`. diff --git a/site/docs/en/doc/grep.md b/site/docs/en/doc/grep.md index 47cb2375e..bea8e58c4 100644 --- a/site/docs/en/doc/grep.md +++ b/site/docs/en/doc/grep.md @@ -6,6 +6,8 @@ Similar to the traditional `grep` command. ::: +## Usage + ``` USAGE: grep [-A ] [-B ] [-C ] [-h] [-i] [-v] [-n] [-m ] [-e] [--trim-end] pattern diff --git a/site/docs/en/doc/heapdump.md b/site/docs/en/doc/heapdump.md index 91f7d82b1..f89c42f66 100644 --- a/site/docs/en/doc/heapdump.md +++ b/site/docs/en/doc/heapdump.md @@ -6,9 +6,9 @@ dump java heap in hprof binary format, like `jmap`. ::: -### Usage +## Usage -#### Dump to file +### Dump to file ```bash [arthas@58205]$ heapdump /tmp/dump.hprof @@ -16,7 +16,7 @@ Dumping heap to /tmp/dump.hprof... Heap dump file created ``` -#### Dump only live objects +### Dump only live objects ```bash [arthas@58205]$ heapdump --live /tmp/dump.hprof @@ -24,7 +24,7 @@ Dumping heap to /tmp/dump.hprof... Heap dump file created ``` -#### Dump to tmp file +### Dump to tmp file ```bash [arthas@58205]$ heapdump diff --git a/site/docs/en/doc/help.md b/site/docs/en/doc/help.md index 60269e3a7..99bf0eda9 100644 --- a/site/docs/en/doc/help.md +++ b/site/docs/en/doc/help.md @@ -6,14 +6,14 @@ show help message, the command can show all the commands that current Arthas ser [help command] equals [command -help],both is to show the detail usage of one command. ::: -### Options +## Options | Name | Specification | | ------: | :-------------------------------------------------------- | | | show all the commands that current Arthas server supports | | [name:] | show the detail usage of one command | -### Usage +## Usage ```bash $ help diff --git a/site/docs/en/doc/history.md b/site/docs/en/doc/history.md index 084efff0d..d866c6463 100644 --- a/site/docs/en/doc/history.md +++ b/site/docs/en/doc/history.md @@ -6,14 +6,14 @@ view command history. history of commands will persisted in a file named history, so the history command can show all the history commands of current Arthas server ,but not only history in current session. ::: -### Options +## Options | Name | Specification | | ---: | :----------------------------- | | [c:] | clear all the history commands | | [n:] | view the nearest 5 commands | -### 使用参考 +## Usage ```bash #view the nearest 3 commands diff --git a/site/docs/en/doc/http-api.md b/site/docs/en/doc/http-api.md index 1ff1ea905..1afbe9175 100644 --- a/site/docs/en/doc/http-api.md +++ b/site/docs/en/doc/http-api.md @@ -2,7 +2,7 @@ [`Http API` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=case-http-api) -### Overview +## Overview Http API provides a RESTful-like interactive interface, and both requests and responses data in JSON format. Compared with @@ -10,7 +10,7 @@ Telnet/WebConsole's output unstructured text data, Http API can provide structured data and support more complex interactive functions, such as a series of diagnostic operations in specific application scenarios. -#### Access address +### Access address The Http API address is: `http://ip:port/api`, the request parameters must be submitted using `POST`. Such as POST @@ -20,7 +20,7 @@ Note: The telnet port `3658` has compatibility issues with the Chrome browser. It is recommended to use the http port `8563` to access the http api. -#### Request data format +### Request data format ```json { @@ -48,7 +48,7 @@ Request data format description: Note: Different actions use different parameters. Set the parameters according to the specific action. -#### Request Actions +### Request Actions Currently supported request actions are as follows: @@ -66,7 +66,7 @@ Currently supported request actions are as follows: sharing the same Arthas session. - `close_session` : Close the session. -#### Response status +### Response status The state attribute in the response indicates the request processing state, and its value is as follows: @@ -80,7 +80,7 @@ state, and its value is as follows: - `REFUSED`: The request is rejected (completed status), usually accompanied by a message explaining the reason; -### One-time command +## One-time command Similar to executing batch commands, the one-time commands are executed synchronously. No need to create a session, no need to set the @@ -184,7 +184,7 @@ Please try to deal with it in the following way: not hit, even if `-n 1` is specified, it will hang and wait until the execution timeout. -### Session interaction +## Session interaction Users create and manage Arthas sessions, which are suitable for complex interactive processes. The access process is as follows: @@ -196,7 +196,7 @@ interactive processes. The access process is as follows: - Interrupt command execution - Close the session -#### Create session +### Create session ```bash curl -Ss -XPOST http://localhost:8563/api -d ' @@ -219,7 +219,7 @@ Response result: The new session ID is: `b09f1353-202c-407b-af24-701b744f971e`, and consumer ID is: `5ae4e5fbab8b4e529ac404f260d4e2d1_1`. -#### Join session +### Join session Specify the session ID to join, and the server will assign a new consumer ID. Multiple consumers can receive the same command results of @@ -248,7 +248,7 @@ Response result: The new consumer ID is `8f7f6ad7bc2d4cb5aa57a530927a95cc_2 ` . -#### Pull command results +### Pull command results The action of pulling the command result message is `pull_results`. Please use the Http long-polling method to periodically pull the result @@ -322,7 +322,7 @@ The response content is as follows: } ``` -#### Execute commands asynchronously +### Execute commands asynchronously ```bash curl -Ss -XPOST http://localhost:8563/api -d ''' @@ -449,7 +449,7 @@ corresponds to the expression in the corresponding order. Please refer to the section "[Make watch command output a map object](#change_watch_value_to_map)". -#### Interrupt command execution +### Interrupt command execution Interrupt the running foreground job of the session: @@ -472,7 +472,7 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` -#### Close session +### Close session Specify the session ID to close the session. @@ -491,11 +491,11 @@ curl -Ss -XPOST http://localhost:8563/api -d ''' } ``` -### Authentication +## Authentication - Reference: [auth](auth.md) -### Web UI +## Web UI ![](/images/arthas-web-ui.png "arthas web ui") @@ -521,9 +521,9 @@ Pending function: -### Special command results +## Special command results -#### status +### status ```json { @@ -551,7 +551,7 @@ When the command execution fails, an error message is generally provided, such a } ``` -#### input_status +### input_status ```json { @@ -577,7 +577,7 @@ Possible values ​​of `inputStatus`: - `DISABLED` : In the disabled state, commands cannot be entered or interrupted. -#### command +### command ```json { @@ -594,7 +594,7 @@ It is used for the interactive UI to echo the commands entered by the user. The pulled session command message history will contain messages of type `command`, which can be processed in order. -#### enhancer +### enhancer ```json { @@ -617,9 +617,9 @@ receive this `enhancer` result. It may happen that the result of `enhancer` is successful, but there is no hit method. The client can prompt the user according to the result of `enhancer`. -### Cases +## Cases -#### Get classpath of Java application +### Get classpath of Java application Get system properties of the Java application through Http api and extract the value of `java.class.path`. @@ -661,7 +661,7 @@ NOTE: -#### Make watch command output a map object +### Make watch command output a map object The result value of `watch` is generated by calculating the `watch-express` ognl expression. You can change the ognl expression to diff --git a/site/docs/en/doc/jad.md b/site/docs/en/doc/jad.md index 8b5de4217..0c611849d 100644 --- a/site/docs/en/doc/jad.md +++ b/site/docs/en/doc/jad.md @@ -11,7 +11,7 @@ Decompile the specified classes. - The decompiled code is syntax highlighted for better readability in Arthas console. - It is possible that there's grammar error in the decompiled code, but it should not affect your interpretation. -### Options +## Options | Name | Specification | | --------------------: | :-------------------------------------------------------------- | @@ -20,9 +20,9 @@ Decompile the specified classes. | `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. | | `[E]` | turn on regex match while the default is wildcard match | -### Usage +## Usage -#### Decompile `java.lang.String` +### Decompile `java.lang.String` ```java $ jad java.lang.String @@ -60,7 +60,7 @@ Location: ... ``` -#### Print source only +### Print source only By default, the decompile result will have the `ClassLoader` information. With the `--source-only` option, you can print only the source code. Conveniently used with the [mc](mc.md)/[retransform](retransform.md) commands. @@ -84,7 +84,7 @@ public class MathGame { ... ``` -#### Decompile the specified method +### Decompile the specified method ```java $ jad demo.MathGame main @@ -105,7 +105,7 @@ Location: } ``` -#### Do not print line numbers +### Do not print line numbers - `--lineNumber`: Output source code contins line numbers, default value true @@ -128,7 +128,7 @@ public static void main(String[] args) throws InterruptedException { } ``` -#### Decompile with specified classLoader +### Decompile with specified classLoader ::: tip If the target class is loaded by multiple classloaders, `jad` outputs the `hashcode` of the corresponding classloaders, then you can re-run `jad` and specify `-c ` to decompile the target class from the specified classloader. diff --git a/site/docs/en/doc/jvm.md b/site/docs/en/doc/jvm.md index 55f62bf0d..5695c8619 100644 --- a/site/docs/en/doc/jvm.md +++ b/site/docs/en/doc/jvm.md @@ -6,7 +6,7 @@ Check the current JVM's info ::: -### Usage +## Usage ``` $ jvm @@ -110,7 +110,7 @@ RUNTIME Affect(row-cnt:0) cost in 88 ms. ``` -### Thread related +## Thread related - COUNT: the count of active threads - DAEMON-COUNT: the count of active daemon threads @@ -118,7 +118,7 @@ Affect(row-cnt:0) cost in 88 ms. - STARTED-COUNT: the total count of the created threads since JVM starts - DEADLOCK-COUNT: the count of deadlocked threads -### File descriptor related +## File descriptor related - MAX-FILE-DESCRIPTOR-COUNT:the count of max file descriptor JVM process can open - OPEN-FILE-DESCRIPTOR-COUNT:the current count of file descriptor JVM process open diff --git a/site/docs/en/doc/keymap.md b/site/docs/en/doc/keymap.md index a1d32d95a..3414c95c9 100644 --- a/site/docs/en/doc/keymap.md +++ b/site/docs/en/doc/keymap.md @@ -1,4 +1,4 @@ -# Arthas Console Keymap +# keymap [`keymap` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=command-keymap) @@ -31,7 +31,7 @@ The default keymap is: - Press `tab` to enable auto-completion prompt at any time. - Enter command and `-` or `--`, then press `tab` to display the concrete options for the current command. -#### Custom shortcuts +## Custom shortcuts Specify customization in `$USER_HOME/.arthas/conf/inputrc` file in the current user home directory. @@ -61,7 +61,7 @@ Vim user may want to map `ctrl+h` to moving the cursor forward one character. To then replace `"\C-h": backward-delete-char` with `"\C-h": backward-char`, then reconnect to Arthas console to take effect. -#### Shortcuts for jobs +## Shortcuts for jobs - `ctrl + c`: Terminates current command - `ctrl + z`: Suspends the current command, you can restore this command with `bg`/`fg`, or `kill` it. diff --git a/site/docs/en/doc/logger.md b/site/docs/en/doc/logger.md index 7f4ba75a8..736ed77e5 100644 --- a/site/docs/en/doc/logger.md +++ b/site/docs/en/doc/logger.md @@ -6,9 +6,9 @@ Print the logger information, update the logger level ::: -### Usage +## Usage -#### Print the logger information +### Print the logger information Take the following `logback.xml` as an example: @@ -82,7 +82,7 @@ In the `appenders` section: - `APPLICATION` logger is `RollingFileAppender`, the file is `app.log` - `ASYNC` its `appenderRef` is `APPLICATION`, which means asynchronous output to the file -#### View logger information for the special name +### View logger information for the special name ```bash [arthas@2062]$ logger -n org.springframework.web @@ -96,7 +96,7 @@ In the `appenders` section: codeSource file:/Users/hengyunabc/.m2/repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar ``` -#### View logger information for the special classloader +### View logger information for the special classloader Note that the hashcode changes, you need to check the current ClassLoader information first, and extract the hashcode corresponding to the ClassLoader. @@ -137,14 +137,14 @@ For classloader with only one instance, it can be specified by `--classLoaderCla The value of `--classloaderclass` is the class name of classloader. It can only work when it matches a unique classloader instance. The purpose is to facilitate the input of general commands. However, `-c ` is dynamic. -#### Update logger level +### Update logger level ```bash [arthas@2062]$ logger --name ROOT --level debug update logger level success. ``` -#### Speecify classloader to update logger level +### Speecify classloader to update logger level By default,logger command will be executed under SystemClassloader, if the application is a traditional `war`, or using spring boot fat jar, then it needs to specify classloader。 @@ -154,7 +154,7 @@ You can first use `sc -d yourClassName` to check specified classloader hashcode [arthas@2062]$ logger -c 2a139a55 --name ROOT --level debug ``` -#### View the logger information without appenders +### View the logger information without appenders By default, the `logger` command only prints information about the logger with appenders. If you want to see information about loggers without `appender`, you can use the parameter `--include-no-appender`. diff --git a/site/docs/en/doc/mbean.md b/site/docs/en/doc/mbean.md index 7880407ea..630ac2a75 100644 --- a/site/docs/en/doc/mbean.md +++ b/site/docs/en/doc/mbean.md @@ -8,7 +8,7 @@ show Mbean information This command can show or monitor Mbean attribute information. -### Parameters +## Parameters | Name | Specification | | ------------------: | :---------------------------------------------------------------------------------------------------- | @@ -19,7 +19,7 @@ This command can show or monitor Mbean attribute information. | [n:] | execution times | | [E] | turn on regex matching while the default mode is wildcard matching. Only effect on the attribute name | -### Usage +## Usage show all Mbean names: diff --git a/site/docs/en/doc/mc.md b/site/docs/en/doc/mc.md index fc93c8b90..c5d179142 100644 --- a/site/docs/en/doc/mc.md +++ b/site/docs/en/doc/mc.md @@ -2,6 +2,8 @@ [`mc-retransform` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials?language=en&id=command-mc-retransform) +## Usage + ::: tip Memory compiler, compiles `.java` files into `.class` files in memory. ::: diff --git a/site/docs/en/doc/memory.md b/site/docs/en/doc/memory.md index f2c66d81e..38c493b43 100644 --- a/site/docs/en/doc/memory.md +++ b/site/docs/en/doc/memory.md @@ -2,7 +2,7 @@ View the JVM memory information. -### Usage +## Usage ```bash $ memory diff --git a/site/docs/en/doc/monitor.md b/site/docs/en/doc/monitor.md index 8d04094b2..e47a598cf 100644 --- a/site/docs/en/doc/monitor.md +++ b/site/docs/en/doc/monitor.md @@ -14,7 +14,7 @@ A command returning immediately is a command immediately returns with the result On Arthas's server side, the command is running as a background job, but the weaved code will not take further effect once the job is terminated, therefore, it will not impact the performance after the job quits. Furthermore, Arthas is designed to have no side effect to the business logic. -### Items to monitor +## Items to monitor | Item | Specification | | --------: | :--------------------------------------- | @@ -27,7 +27,7 @@ On Arthas's server side, the command is running as a background job, but the wea | rt | average RT | | fail-rate | failure ratio | -### Parameters +## Parameters Parameter `[c:]` stands for cycles of statistics. Its value is an integer value in seconds. @@ -40,7 +40,7 @@ Parameter `[c:]` stands for cycles of statistics. Its value is an integer value | `[c:]` | cycle of statistics, the default value: `120`s | | `[b]` | evaluate the condition-expression before method invoke | -### Usage +## Usage ```bash $ monitor -c 5 demo.MathGame primeFactors @@ -71,7 +71,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 94 ms. 2018-12-03 19:07:03 demo.MathGame primeFactors 2 2 0 3182.72 0.00% ``` -#### Evaluate condition-express to filter method (after method call) +### Evaluate condition-express to filter method (after method call) ```bash monitor -c 5 demo.MathGame primeFactors "params[0] <= 2" @@ -98,7 +98,7 @@ Affect(class count: 1 , method count: 1) cost in 19 ms, listenerId: 5 2020-09-02 09:42:56 demo.MathGame primeFactors 5 3 2 0.15 40.00% ``` -#### Evaluate condition-express to filter method (before method call) +### Evaluate condition-express to filter method (before method call) ```bash monitor -b -c 5 com.test.testes.MathGame primeFactors "params[0] <= 2" diff --git a/site/docs/en/doc/ognl.md b/site/docs/en/doc/ognl.md index d9d13ca6b..2ce1fb44c 100644 --- a/site/docs/en/doc/ognl.md +++ b/site/docs/en/doc/ognl.md @@ -8,7 +8,7 @@ Execute ognl expression. Since 3.0.5. -### Parameters +## Parameters | Name | Specification | | --------------------: | :------------------------------------------------------------------------------------------------------ | @@ -17,7 +17,7 @@ Since 3.0.5. | `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. | | [x] | Expand level of object (1 by default). | -### Usage +## Usage - [Special usages](https://github.com/alibaba/arthas/issues/71) - [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html) diff --git a/site/docs/en/doc/options.md b/site/docs/en/doc/options.md index 2f985e5a2..59c380701 100644 --- a/site/docs/en/doc/options.md +++ b/site/docs/en/doc/options.md @@ -7,7 +7,7 @@ Global options ::: | Name | Default Value | Description | -| ---------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------- | ---- | -------------------------------------------------------------------- | +| ---------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | unsafe | false | whether to enhance to system-level class. Use it with caution since JVM may hang | | dump | false | whether to dump enhanced class to the external files. If it's on, enhanced class will be dumped into `/${application dir}/arthas-class-dump/`, the specific output path will be output in the console | | batch-re-transform | true | whether to re-transform matched classes in batch | @@ -15,11 +15,12 @@ Global options | disable-sub-class | false | whether to enable matching child classes. The default value is `true`. If exact match is desire, turn off this flag | | support-default-method | true | whether to enable matching default method in interface. The default value is `true`. Refer to [#1105](https://github.com/alibaba/arthas/issues/1105) | | save-result | false | whether to save execution result. All execution results will be saved to `~/logs/arthas-cache/result.log` when it's turned on | -| job-timeout | 1d | default timeout for background jobs. Background job will be terminated once it's timed out (i.e. 1d, 2h, 3m, 25s) | print-parent-fields | true | This option enables print files in parent class, default value true. | +| job-timeout | 1d | default timeout for background jobs. Background job will be terminated once it's timed out (i.e. 1d, 2h, 3m, 25s) | +| print-parent-fields | true | This option enables print files in parent class, default value true. | | verbose | false | This option enables print verbose information | | strict | true | whether to enable strict mode | -### View all options +## View all options ```bash $ options @@ -63,7 +64,7 @@ $ options false` ``` -### Get special option value +## Get special option value ``` $ options json-format @@ -78,7 +79,7 @@ $ options json-format By default, `json-format` is false. When set `json-format` to true, commands like `wathc`/`tt` will print result with `json` format. ::: -### Set special option value +## Set special option value For example, to enable saving command execution result, input the command below: @@ -89,7 +90,7 @@ $ options save-result true save-result false true ``` -### Set `unsafe` to true to enhance the classes under the `java.*` package +## Set `unsafe` to true to enhance the classes under the `java.*` package By default, `watch`/`trace`/`tt`/`trace`/`monitor` command do not support classes under `java.*` package. You can set `unsafe` to true to enhance the classes under the `java.*` package. @@ -106,7 +107,7 @@ Press Q or Ctrl+C to abort. Affect(class count: 1 , method count: 1) cost in 61 ms, listenerId: 1 ``` -### Turn off strict mode, allow setting object properties in ognl expressions +## Turn off strict mode, allow setting object properties in ognl expressions ::: tip since 3.6.0 diff --git a/site/docs/en/doc/perfcounter.md b/site/docs/en/doc/perfcounter.md index f72c77852..788423ce3 100644 --- a/site/docs/en/doc/perfcounter.md +++ b/site/docs/en/doc/perfcounter.md @@ -6,7 +6,7 @@ Check the current JVM Perf Counter information. ::: -### Usage +## Usage ``` $ perfcounter @@ -34,7 +34,7 @@ $ perfcounter -d java.cls.unloadedClasses Monotonic Events 0 ``` -### JVM above JDK9 +## JVM above JDK9 If the information is not printed, when the application starts, add the following parameters: diff --git a/site/docs/en/doc/profiler.md b/site/docs/en/doc/profiler.md index 554f78398..031aed182 100644 --- a/site/docs/en/doc/profiler.md +++ b/site/docs/en/doc/profiler.md @@ -10,7 +10,7 @@ The `profiler` command supports generate flame graph for application hotspots. The basic usage of the `profiler` command is `profiler action [actionArg]` -### Supported Options +## Supported Options | Name | Specification | | ----------: | :------------------------------------------------------------------------------- | @@ -21,7 +21,7 @@ The basic usage of the `profiler` command is `profiler action [actionArg]` | [d:] | run profiling for specified seconds | | [e:] | which event to trace (cpu, alloc, lock, cache-misses etc.), default value is cpu | -### Start profiler +## Start profiler ``` $ profiler start @@ -32,14 +32,14 @@ Started [cpu] profiling By default, the sample event is `cpu`. Can be specified with the `--event` parameter. ::: -### Get the number of samples collected +## Get the number of samples collected ``` $ profiler getSamples 23 ``` -### View profiler status +## View profiler status ```bash $ profiler status @@ -48,9 +48,9 @@ $ profiler status Can view which `event` and sampling time. -### Stop profiler +## Stop profiler -#### Generating html format results +### Generating html format results By default, the result file is `html` format. You can also specify it with the `--format` parameter: @@ -62,7 +62,7 @@ OK Or use the file name name format in the `--file` parameter. For example, `--file /tmp/result.html`. -### View profiler results under arthas-output via browser +## View profiler results under arthas-output via browser By default, arthas uses port 3658, which can be opened: [http://localhost:3658/arthas-output/](http://localhost:3658/arthas-output/) View the `arthas-output` directory below Profiler results: @@ -76,7 +76,7 @@ Click to view specific results: If using the chrome browser, may need to be refreshed multiple times. ::: -### Profiler supported events +## Profiler supported events Under different platforms and different OSs, the supported events are different. For example, under macos: @@ -125,7 +125,7 @@ You can use the `--event` parameter to specify the event to sample, such as samp $ profiler start --event alloc ``` -### Resume sampling +## Resume sampling ```bash $ profiler resume @@ -136,7 +136,7 @@ The difference between `start` and `resume` is: `start` is the new start samplin You can verify the number of samples by executing `profiler getSamples`. -### Use `execute` action to execute complex commands +## Use `execute` action to execute complex commands For example, start sampling: @@ -152,14 +152,14 @@ profiler execute 'stop,file=/tmp/result.html' Specific format reference: [arguments.cpp](https://github.com/jvm-profiling-tools/async-profiler/blob/v2.5/src/arguments.cpp#L50) -### View all supported actions +## View all supported actions ```bash $ profiler actions Supported Actions: [resume, dumpCollapsed, getSamples, start, list, execute, version, stop, load, dumpFlat, actions, dumpTraces, status] ``` -### View version +## View version ```bash $ profiler version @@ -167,7 +167,7 @@ Async-profiler 1.6 built on Sep 9 2019 Copyright 2019 Andrei Pangin ``` -### Configure framebuf option +## Configure framebuf option ::: tip you encounter `[frame_buffer_overflow]` in the generated result, you need to increase the framebuf (the default value is 1'000'000), which can be configured explicitly, such as: @@ -177,7 +177,7 @@ you encounter `[frame_buffer_overflow]` in the generated result, you need to inc profiler start --framebuf 5000000 ``` -### Configure include/exclude to filter data +## Configure include/exclude to filter data If the application is complex and generates a lot of content, and you want to focus on only part of the data, you can filter by include/exclude. such as @@ -187,7 +187,7 @@ profiler start --include'java/*' --include'demo/*' --exclude'*Unsafe.park*' > Both include/exclude support setting multiple values, but need to be configured at the end of the command line. -### Specify execution time +## Specify execution time For example, if you want the profiler to automatically end after 300 seconds, you can specify it with the `-d`/`--duration` parameter: @@ -195,7 +195,7 @@ For example, if you want the profiler to automatically end after 300 seconds, yo profiler start --duration 300 ``` -### Generate jfr format result +## Generate jfr format result > Note that jfr only supports configuration at `start`. If it is specified at `stop`, it will not take effect. @@ -213,6 +213,6 @@ The generated results can be viewed with tools that support the jfr format. such - JDK Mission Control: https://github.com/openjdk/jmc - JProfiler: https://github.com/alibaba/arthas/issues/1416 -### The 'unknown' in profiler result +## The 'unknown' in profiler result - https://github.com/jvm-profiling-tools/async-profiler/discussions/409 diff --git a/site/docs/en/doc/pwd.md b/site/docs/en/doc/pwd.md index 022e56ea5..a53a811c4 100644 --- a/site/docs/en/doc/pwd.md +++ b/site/docs/en/doc/pwd.md @@ -6,6 +6,8 @@ Return working directory name ::: +## Usage + ```bash $ pwd ``` diff --git a/site/docs/en/doc/redefine.md b/site/docs/en/doc/redefine.md index 42c33716e..dc35bd8c7 100644 --- a/site/docs/en/doc/redefine.md +++ b/site/docs/en/doc/redefine.md @@ -12,7 +12,7 @@ Load the external `*.class` files to re-define the loaded classes in JVM. Reference: [Instrumentation#redefineClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#redefineClasses-java.lang.instrument.ClassDefinition...-) -### Frequently asked questions +## Frequently asked questions ::: tip Recommend to use the [retransform](retransform.md) command. @@ -37,14 +37,14 @@ The `redefine` command will conflict with the `jad`/`watch`/`trace`/`monitor`/`t The reason is that in the JDK `redefine` and `retransform` are different mechanisms. When two mechanisms are both used to update the bytecode, only the last modified will take effect. ::: -### Options +## Options | Name | Specification | | --------------------: | :-------------------------------------------------------------- | | `[c:]` | hashcode of the class loader | | `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. | -### Usage +## Usage ```bash redefine /tmp/Test.class @@ -52,7 +52,7 @@ redefine -c 327a647b /tmp/Test.class /tmp/Test\$Inner.class redefine --classLoaderClass sun.misc.Launcher$AppClassLoader /tmp/Test.class /tmp/Test\$Inner.class ``` -### Use with the jad/mc command +## Use with the jad/mc command ```bash jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java @@ -66,7 +66,7 @@ redefine /tmp/com/example/demo/arthas/user/UserController.class - `mc` command to compile the modified code - Load new bytecode with `redefine` command -### Tips for uploading .class files to the server +## Tips for uploading .class files to the server The `mc` command may fail. You can modify the code locally, compile it, and upload it to the server. Some servers do not allow direct uploading files, you can use the `base64` command to bypass. @@ -86,7 +86,7 @@ The `mc` command may fail. You can modify the code locally, compile it, and uplo 4. Use the md5 command to verify that the `.class` files are consistent. -### Restrictions of the redefine command +## Restrictions of the redefine command - New field/method is not allowed - The function that is running, no exit can not take effect, such as the new `System.out.println` added below, only the `run()` function will take effect. diff --git a/site/docs/en/doc/reset.md b/site/docs/en/doc/reset.md index c4b08c5f6..39c2357f3 100644 --- a/site/docs/en/doc/reset.md +++ b/site/docs/en/doc/reset.md @@ -6,7 +6,7 @@ Reset all classes that have been enhanced by Arthas. These enhanced classes will also be reset when Arthas server is `stop`. ::: -### Usage +## Usage ``` $ reset -h @@ -27,7 +27,7 @@ $ reset -h Path and classname of Pattern Matching ``` -### Reset specified class +## Reset specified class ``` $ trace Test test @@ -43,7 +43,7 @@ $ reset Test Affect(class-cnt:1 , method-cnt:0) cost in 11 ms. ``` -### Reset all classes +## Reset all classes ``` $ trace Test test diff --git a/site/docs/en/doc/retransform.md b/site/docs/en/doc/retransform.md index 69a0bd325..888fad26e 100644 --- a/site/docs/en/doc/retransform.md +++ b/site/docs/en/doc/retransform.md @@ -8,7 +8,7 @@ Load the external `*.class` files to retransform the loaded classes in JVM. Reference: [Instrumentation#retransformClasses](https://docs.oracle.com/javase/8/docs/api/java/lang/instrument/Instrumentation.html#retransformClasses-java.lang.Class...-) -### Usage +## Usage ```bash retransform /tmp/Test.class @@ -20,7 +20,7 @@ Reference: [Instrumentation#retransformClasses](https://docs.oracle.com/javase/8 retransform --classLoaderClass 'sun.misc.Launcher$AppClassLoader' /tmp/Test.class ``` -### retransform the specified .class file +## retransform the specified .class file ```bash $ retransform /tmp/MathGame.class @@ -34,7 +34,7 @@ Load the specified .class file, then parse out the class name, and then retransf If retransform is executed multiple times to load the same class file, there will be multiple retransform entries. ::: -### View retransform entry +## View retransform entry ```bash $ retransform -l @@ -44,7 +44,7 @@ Id ClassName TransformCount LoaderHash LoaderClassName - TransformCount counts the times of attempts to return the .class file corresponding to the entry in the ClassFileTransformer#transform method, but it does not mean that the transform must be successful. -### Delete the specified retransform entry +## Delete the specified retransform entry Need to specify id: @@ -52,13 +52,13 @@ Need to specify id: retransform -d 1 ``` -### Delete all retransform entries +## Delete all retransform entries ```bash retransform --deleteAll ``` -### Explicitly trigger retransform +## Explicitly trigger retransform ```bash $ retransform --classPattern demo.MathGame @@ -70,7 +70,7 @@ demo.MathGame Note: For the same class, when there are multiple retransform entries, if retransform is explicitly triggered, the entry added last will take effect (the one with the largest id). ::: -### Eliminate the influence of retransform +## Eliminate the influence of retransform If you want to eliminate the impact after performing retransform on a class, you need to: @@ -81,7 +81,7 @@ If you want to eliminate the impact after performing retransform on a class, you If you do not clear all retransform entries and trigger retransform again, the retransformed classes will still take effect when arthas stop. ::: -### Use with the jad/mc command +## Use with the jad/mc command ```bash jad --source-only com.example.demo.arthas.user.UserController > /tmp/UserController.java @@ -95,7 +95,7 @@ retransform /tmp/com/example/demo/arthas/user/UserController.class - `mc` command to compile the modified code - Load new bytecode with `retransform` command -### Tips for uploading .class files to the server +## Tips for uploading .class files to the server The `mc` command may fail. You can modify the code locally, compile it, and upload it to the server. Some servers do not allow direct uploading files, you can use the `base64` command to bypass. @@ -115,7 +115,7 @@ The `mc` command may fail. You can modify the code locally, compile it, and uplo 4. Use the md5 command to verify that the `.class` files are consistent. -### Restrictions of the retransform command +## Restrictions of the retransform command - New field/method is not allowed - The function that is running, no exit can not take effect, such as the new `System.out.println` added below, only the `run()` function will take effect. diff --git a/site/docs/en/doc/save-log.md b/site/docs/en/doc/save-log.md index 9373284f8..8806ad721 100644 --- a/site/docs/en/doc/save-log.md +++ b/site/docs/en/doc/save-log.md @@ -22,7 +22,7 @@ Log command outputs for later analysis The command execution result will be save in `{user.home}/logs/arthas-cache/result.log`. Pls. clean it up regularly to save disk space. -### Use asynchronous job to log +## Use asynchronous job to log ```bash $ trace Test t >> & diff --git a/site/docs/en/doc/sc.md b/site/docs/en/doc/sc.md index 431a9923e..89c26e4ad 100644 --- a/site/docs/en/doc/sc.md +++ b/site/docs/en/doc/sc.md @@ -8,7 +8,7 @@ Search classes loaded by JVM. `sc` stands for search class. This command can search all possible classes loaded by JVM and show their information. The supported options are: `[d]`、`[E]`、`[f]` and `[x:]`. -### Supported Options +## Supported Options | Name | Specification | | --------------------: | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -30,7 +30,7 @@ _class-patten_ supports full qualified class name, e.g. com.taobao.test.AAA and `sc` turns on matching sub-class match by default, that is, `sc` will also search the sub classes of the target class too. If exact-match is desired, pls. use `options disable-sub-class true`. ::: -### Usage +## Usage - Wildcards match search diff --git a/site/docs/en/doc/session.md b/site/docs/en/doc/session.md index c8bce31f4..00807a732 100644 --- a/site/docs/en/doc/session.md +++ b/site/docs/en/doc/session.md @@ -7,7 +7,7 @@ if exits tunnel server,it will also show agentId、tunnelServerUrl、connected if exits statUrl,it will also show statUrl. ::: -### Usage +## Usage ```bash $ session diff --git a/site/docs/en/doc/sm.md b/site/docs/en/doc/sm.md index 2e2c40003..68f7d0def 100644 --- a/site/docs/en/doc/sm.md +++ b/site/docs/en/doc/sm.md @@ -8,7 +8,7 @@ Search method from the loaded classes. `sm` stands for search method. This command can search and show method information from all loaded classes. `sm` can only view the methods declared on the target class, that is, methods from its parent classes are invisible. -### Options +## Options | Name | Specification | | --------------------: | :----------------------------------------------------------------- | @@ -20,7 +20,7 @@ Search method from the loaded classes. | `[classLoaderClass:]` | The class name of the ClassLoader that executes the expression. | | `[n:]` | Maximum number of matching classes with details (100 by default) | -### Usage +## Usage View methods of `java.lang.String`: diff --git a/site/docs/en/doc/spring-boot-starter.md b/site/docs/en/doc/spring-boot-starter.md index 3b0b2da99..65b5cd2a1 100644 --- a/site/docs/en/doc/spring-boot-starter.md +++ b/site/docs/en/doc/spring-boot-starter.md @@ -18,7 +18,7 @@ Add maven dependency: When the application is started, spring will start arthas and attach its own process. -### Configuration properties +## Configuration properties For example, by configuring the tunnel server for remote management. @@ -35,7 +35,7 @@ By default, arthas-spring-boot-starter will disable the `stop` command. Reference: [Arthas Properties](arthas-properties.md) -### View Endpoint Information +## View Endpoint Information ::: tip Need to configure spring boot to expose endpoint: [Reference](https://docs.spring.io/spring-boot/docs/current/reference/html/production-ready-features.html#production-ready-endpoints). @@ -54,7 +54,7 @@ http://localhost:8080/actuator/arthas } ``` -### Non-spring boot application usage +## Non-spring boot application usage Non-Spring Boot applications can be used in the following ways. diff --git a/site/docs/en/doc/stack.md b/site/docs/en/doc/stack.md index 59d07369e..623a6b45a 100644 --- a/site/docs/en/doc/stack.md +++ b/site/docs/en/doc/stack.md @@ -8,7 +8,7 @@ Print out the full call stack of the current method. Most often we know one method gets called, but we have no idea on which code path gets executed or when the method gets called since there are so many code paths to the target method. The command `stack` comes to rescue in this difficult situation. -### Parameters +## Parameters | Name | Specification | | ---------------------: | :---------------------------------------------------------- | @@ -27,13 +27,13 @@ Pls. refer to [core parameters in expression](advice-class.md) for more details. - Pls. also refer to [https://github.com/alibaba/arthas/issues/71](https://github.com/alibaba/arthas/issues/71) for more advanced usage - OGNL official site: [https://commons.apache.org/proper/commons-ognl/language-guide.html](https://commons.apache.org/proper/commons-ognl/language-guide.html) -### Usage +## Usage -#### Start Demo +### Start Demo Start `math-game` in [Quick Start](quick-start.md). -#### stack +### stack ```bash $ stack demo.MathGame primeFactors @@ -44,7 +44,7 @@ ts=2018-12-04 01:32:19;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun at demo.MathGame.main(MathGame.java:16) ``` -#### Filtering by condition expression +### Filtering by condition expression ```bash $ stack demo.MathGame primeFactors 'params[0]<0' -n 2 @@ -61,7 +61,7 @@ ts=2018-12-04 01:34:30;thread_name=main;id=1;is_daemon=false;priority=5;TCCL=sun Command execution times exceed limit: 2, so command will exit. You can set it with -n option. ``` -#### Filtering by cost +### Filtering by cost ```bash $ stack demo.MathGame primeFactors '#cost>5' diff --git a/site/docs/en/doc/stop.md b/site/docs/en/doc/stop.md index 86589bbec..f28ac9ddf 100644 --- a/site/docs/en/doc/stop.md +++ b/site/docs/en/doc/stop.md @@ -1,4 +1,4 @@ -# Stop +# stop terminates the Arthas server, all the Arthas clients connecting to this server will be disconnected. diff --git a/site/docs/en/doc/sysenv.md b/site/docs/en/doc/sysenv.md index 40962c1dd..378ea38c9 100644 --- a/site/docs/en/doc/sysenv.md +++ b/site/docs/en/doc/sysenv.md @@ -6,7 +6,7 @@ View the current JVM environment variables. ::: -### Usage +## Usage ``` USAGE: @@ -27,7 +27,7 @@ View the current JVM environment variables. env name ``` -#### View all environment variables +### View all environment variables ``` $ sysenv @@ -65,7 +65,7 @@ $ sysenv AUTOJUMP_ERROR_PATH /Users/admin/Library/autojump/errors.log ``` -#### View individual environment variables +### View individual environment variables ::: tip Use `tab` for auto-completion diff --git a/site/docs/en/doc/sysprop.md b/site/docs/en/doc/sysprop.md index ae614ff99..08990e8bd 100644 --- a/site/docs/en/doc/sysprop.md +++ b/site/docs/en/doc/sysprop.md @@ -6,7 +6,7 @@ Examine the system properties from the target JVM ::: -### Usage +## Usage ``` USAGE: @@ -29,7 +29,7 @@ Examine the system properties from the target JVM property value ``` -#### Check all properties +### Check all properties ``` $ sysprop @@ -104,7 +104,7 @@ $ sysprop sun.cpu.isalist ``` -#### Check One Single Property +### Check One Single Property ::: tip Use `tab` for auto-completion @@ -115,7 +115,7 @@ $ sysprop java.version java.version=1.8.0_51 ``` -#### Modify Single Property +### Modify Single Property ``` $ sysprop user.country diff --git a/site/docs/en/doc/tee.md b/site/docs/en/doc/tee.md index c337240ad..2b9d4a6f0 100644 --- a/site/docs/en/doc/tee.md +++ b/site/docs/en/doc/tee.md @@ -8,6 +8,8 @@ Similar to the traditional `tee` command, it is used to read standard input data `tee` will read data from standard input device, output its content to standard output device, and save it as a file. ::: +## Usage + ``` USAGE: tee [-a] [-h] [file] diff --git a/site/docs/en/doc/thread.md b/site/docs/en/doc/thread.md index 889862ed7..d3a4007c1 100644 --- a/site/docs/en/doc/thread.md +++ b/site/docs/en/doc/thread.md @@ -6,7 +6,7 @@ Check the basic info and stack trace of the target thread. ::: -### Parameters +## Parameters | Name | Specification | | ------------: | :-------------------------------------------------------------- | @@ -16,12 +16,12 @@ Check the basic info and stack trace of the target thread. | [i ``] | specify the interval to collect data to compute CPU ratios (ms) | | [--all] | Show all matching threads | -### How the CPU ratios are calculated? +## How the CPU ratios are calculated? The cpu ratios here is similar to the thread `%CPU` of the linux command `top -H -p `. During a sampling interval, the ratio of the incremental cpu time of each thread in the current JVM to the sampling interval time. -#### Working principle description: +### Working principle description: - Do the first sampling, get the CPU time of all threads ( by calling `java.lang.management.ThreadMXBean#getThreadCpuTime()` and `sun.management.HotspotThreadMBean.getInternalThreadCpuTimes()` ) @@ -33,9 +33,9 @@ the ratio of the incremental cpu time of each thread in the current JVM to the s > Another way to view the thread cpu usage of the Java process, [`show-busy-java-threads`](https://github.com/oldratlee/useful-scripts/blob/dev-2.x/docs/java.md#-show-busy-java-threads) can come to help. -### Usage +## Usage -#### List the top n busiest threads with detailed stack trace +### List the top n busiest threads with detailed stack trace ```shell $ thread -n 3 @@ -74,7 +74,7 @@ The larger the interval time, the more inaccurate. You can try to specify different intervals according to the specific situation and observe the output results. -#### List first page threads' info when no options provided +### List first page threads' info when no options provided By default, they are arranged in descending order of CPU increment time, and only the first page of data is displayed. @@ -100,11 +100,11 @@ ID NAME GROUP PRIORITY STATE %CPU 17 arthas-NettyWebsocketTtyBootst system 5 RUNNABLE 0.0 0.000 0:0.001 false true ``` -#### thread --all, show all matching threads +### thread --all, show all matching threads Display all matching threads. Sometimes it is necessary to obtain all the thread data of the JVM for analysis. -#### thread id, show the running stack for the target thread +### thread id, show the running stack for the target thread ```shell $ thread 1 @@ -118,7 +118,7 @@ $ thread 1 at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231) ``` -#### thread -b, locate the thread bocking the others +### thread -b, locate the thread bocking the others In some occasions, we experience the whole application is stuck because there's one particular thread hold one lock that other threads are relying on. To diagnose such an issue, Arthas provides `thread -b` to find the problematic thread in one single command. @@ -163,7 +163,7 @@ $ thread -b > Note: By now Arthas only supports to locate the thread blocked by `synchronzied`, while `java.util.concurrent.Lock` is not supported yet. -#### thread -i, specify the sampling interval +### thread -i, specify the sampling interval - `thread -i 1000`: Count the thread cpu time of the last 1000ms. @@ -190,7 +190,7 @@ $ thread -n 3 -i 1000 ... ``` -#### thread --state , view the special state theads +### thread --state , view the special state theads ```bash [arthas@28114]$ thread --state WAITING diff --git a/site/docs/en/doc/trace.md b/site/docs/en/doc/trace.md index 35c4d2a74..fa4c0672b 100644 --- a/site/docs/en/doc/trace.md +++ b/site/docs/en/doc/trace.md @@ -8,7 +8,7 @@ Trace method calling path, and output the time cost for each node in the path. `trace` can track the calling path specified by `class-pattern` / `method-pattern`, and calculate the time cost on the whole path. -### Parameters +## Parameters | Name | Specification | | ------------------: | :---------------------------------------------------------- | @@ -34,7 +34,7 @@ Many times what we are interested is the exact trace result when the method call `watch`/`stack`/`trace`, these three commands all support `#cost`. ::: -### Notice +## Notice - `trace` is handy to help discovering and locating the performance flaws in your system, but pls. note Arthas can only trace the first level method call each time. @@ -42,13 +42,13 @@ Many times what we are interested is the exact trace result when the method call - Currently `trace java.lang.Thread getName` is not supported, please refer to issue: [#1610](https://github.com/alibaba/arthas/issues/1610), considering that it is not very necessary and it is difficult to repair , So it won’t be fixed for now -### Usage +## Usage -#### Start Demo +### Start Demo Start `math-game` in [Quick Start](quick-start.md). -#### Trace method +### Trace method ```bash $ trace demo.MathGame run @@ -67,7 +67,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 28 ms. The `#24` in the result indicates that in the run function, the `primeFactors()` function was called on line `24` of the source file. ::: -#### Trace times limit +### Trace times limit If the method invoked many times, use `-n` options to specify trace times. For example, the command will exit when received a trace result. @@ -83,7 +83,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 20 ms. Command execution times exceed limit: 1, so command will exit. You can set it with -n option. ``` -#### Include jdk method +### Include jdk method - `--skipJDKMethod ` skip jdk method trace, default value true. @@ -116,7 +116,7 @@ Affect(class-cnt:1 , method-cnt:1) cost in 60 ms. `---[0.076457ms] java.io.PrintStream:println() #28 ``` -#### Filtering by cost +### Filtering by cost ```bash $ trace demo.MathGame run '#cost > 10' @@ -138,7 +138,7 @@ Only the call path which's time cost is higher than `10ms` will be shown. This f - "[min=0.005428ms,max=0.094064ms,total=0.105228ms,count=3] demo:call()" means aggregating all same method calls into one single line. The minimum time cost is `0.005428` ms, the maximum time cost is `0.094064` ms, and the total time cost for all method calls (`3` times in total) to "demo:call()" is `0.105228ms`. If "throws Exception" appears in this line, it means some exceptions have been thrown from this method calls. - The total time cost may not equal to the sum of the time costs each sub method call takes, this is because Arthas instrumented code takes time too. -#### Trace multiple classes or multiple methods +### Trace multiple classes or multiple methods The trace command will only trace the subcalls in the method to the trace, and will not trace down multiple layers. Because traces are expensive, multi-layer traces can lead to a lot of classes and methods that ultimately have to be traced. @@ -148,7 +148,7 @@ You can use the regular expression to match multiple classes and methods on the Trace -E com.test.ClassA|org.test.ClassB method1|method2|method3 ``` -#### Exclude the specified class +### Exclude the specified class ::: tip The watch/trace/monitor/stack/tt commands all support the `--exclude-class-pattern` parameter @@ -160,7 +160,7 @@ Use the `--exclude-class-pattern` parameter to exclude the specified class, for watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter ``` -#### Dynamic trace +### Dynamic trace ::: tip Supported since version 3.3.0. @@ -210,7 +210,7 @@ At terminal 1, you can see that the trace result has increased by one layer: Dynamic trace by specifying `listenerId`, you can go deeper and deeper. In addition, commands such as `watch`/`tt`/`monitor` also support similar functionality. -### Trace result time inaccuracy problem +## Trace result time inaccuracy problem For example, in the following result: `0.705196 > (0.152743 + 0.145825)` @@ -248,7 +248,7 @@ So where is the rest of the time consumed? 3. Possible JVM pause during code execution, such as GC, entering synchronization blocks, etc. -#### Use the -v parameter to print more information +### Use the -v parameter to print more information ::: tip The watch/trace/monitor/stack/tt commands all support the `-v` parameter. diff --git a/site/docs/en/doc/tt.md b/site/docs/en/doc/tt.md index 834b3d242..b0e229fb9 100644 --- a/site/docs/en/doc/tt.md +++ b/site/docs/en/doc/tt.md @@ -10,13 +10,13 @@ In such difficulties, `tt` comes into play. With the help of `tt` (_TimeTunnel_), you can check the contexts of the methods at different times in execution history. -### Usage +## Usage -#### Start Demo +### Start Demo Start `math-game` in [Quick Start](quick-start.md). -#### Record method calls +### Record method calls ```bash $ tt -t demo.MathGame primeFactors @@ -66,7 +66,7 @@ Advanced: - [Special usage](https://github.com/alibaba/arthas/issues/71) - [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html) -#### List all records +### List all records ```bash $ tt -l @@ -82,7 +82,7 @@ $ tt -l Affect(row-cnt:6) cost in 4 ms. ``` -#### Searching for records +### Searching for records ```bash $ tt -s 'method.name=="primeFactors"' @@ -102,7 +102,7 @@ Advanced: - [Critical fields in expression](advice-class.md) -#### Check context of the call +### Check context of the call Using `tt -i ` to check a specific calling details. @@ -125,7 +125,7 @@ $ tt -i 1003 Affect(row-cnt:1) cost in 11 ms. ``` -#### Replay record +### Replay record Since Arthas stores the context of the call, you can even _replay_ the method calling afterwards with extra option `-p` to replay the issue for advanced troubleshooting, option `--replay-times` define the replay execution times, option `--replay-interval` define the interval(unit in ms,with default value 1000) of replays @@ -150,7 +150,7 @@ Time fragment[1004] successfully replayed. Affect(row-cnt:1) cost in 14 ms. ``` -#### Watch express +### Watch express `-w, --watch-express` watch the time fragment by ognl express. diff --git a/site/docs/en/doc/tunnel.md b/site/docs/en/doc/tunnel.md index 549667ddc..2319ffd44 100644 --- a/site/docs/en/doc/tunnel.md +++ b/site/docs/en/doc/tunnel.md @@ -11,7 +11,7 @@ Reference: - 1: [Web Console](web-console.md) - 2: [Arthas Spring Boot Starter](spring-boot-starter.md) -### Download and deploy arthas tunnel server +## Download and deploy arthas tunnel server [https://github.com/alibaba/arthas/releases](https://github.com/alibaba/arthas/releases) @@ -33,7 +33,7 @@ Through Spring Boot's Endpoint, you can view the specific connection information Using generated security password: f1dca050-3777-48f4-a577-6367e55a78a2 ``` -### Connecting to the tunnel server when starting arthas +## Connecting to the tunnel server when starting arthas When starting arthas, you can use the `--tunnel-server` parameter, for example: @@ -83,7 +83,7 @@ For the above example, go to [http://47.75.156.201/arthas/?port=80](http://47.75 ![](/images/arthas-tunnel-server.png) -### Best practices +## Best practices ::: warning Note that the agentId must be unique, otherwise it will conflict on the tunnel server and not work properly. @@ -99,7 +99,7 @@ Tunnel server will use `_` as a delimiter to extract `appName`, which is conveni Alternatively, you can configure `appName` in `arthas.properties` in the unzipped arthas directory, or in `application.properties` of the spring boot application. ::: -### Tunnel Server Management Page +## Tunnel Server Management Page ::: tip Need to configure `arthas.enable-detail-pages=true` in `application.properties` of spring boot @@ -143,7 +143,7 @@ Then open the details, you can see a list of all connected agents: ![](/images/tunnel-server-agents.png) -### Security and Privilege Management +## Security and Privilege Management ::: tip **It is strongly recommended not to expose the tunnel server directly to the public network.** @@ -154,13 +154,13 @@ Currently tunnel server does not have special permission management 1. Users need to develop by themselves and authenticate the app name. 2. If the management page is opened, security measures need to be added. -### Cluster Management +## Cluster Management If you want to deploy multiple tunnel servers, you can use nginx for forwarding and redis to store agent information. Nginx needs to configure sticky session to ensure that the user's web socket is connected to the same back-end tunnel server. The simple configuration method is to use `ip_hash`. -### How arthas tunnel server works +## How arthas tunnel server works ``` browser <-> arthas tunnel server <-> arthas tunnel client <-> arthas agent diff --git a/site/docs/en/doc/version.md b/site/docs/en/doc/version.md index 8b4b4c701..5f88a2962 100644 --- a/site/docs/en/doc/version.md +++ b/site/docs/en/doc/version.md @@ -2,7 +2,7 @@ prints out Arthas's version. -### Usage +## Usage ```bash $ version diff --git a/site/docs/en/doc/vmoption.md b/site/docs/en/doc/vmoption.md index 93c044857..1ee117700 100644 --- a/site/docs/en/doc/vmoption.md +++ b/site/docs/en/doc/vmoption.md @@ -6,9 +6,9 @@ Display, and update the vm diagnostic options. ::: -### Usage +## Usage -#### View all options +### View all options ```bash [arthas@56963]$ vmoption @@ -38,7 +38,7 @@ Display, and update the vm diagnostic options. PrintConcurrentLocks false DEFAULT true ``` -#### View individual option +### View individual option ```bash $ vmoption PrintGC @@ -47,7 +47,7 @@ $ vmoption PrintGC PrintGC false MANAGEMENT true ``` -#### Update individual option +### Update individual option ```bash $ vmoption PrintGC true diff --git a/site/docs/en/doc/vmtool.md b/site/docs/en/doc/vmtool.md index e2f97f29c..bd7390244 100644 --- a/site/docs/en/doc/vmtool.md +++ b/site/docs/en/doc/vmtool.md @@ -10,7 +10,7 @@ - [JVM Tool Interface](https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html) -### getInstances +## getInstances ```bash $ vmtool --action getInstances --className java.lang.String --limit 10 @@ -32,13 +32,13 @@ $ vmtool --action getInstances --className java.lang.String --limit 10 Through the `--limit` parameter, you can limit the number of return values to avoid pressure on the JVM when obtaining large data. The default value of limit is 10. ::: -### Specify classloader name +## Specify classloader name ```bash vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext ``` -### Specify classloader hash +## Specify classloader hash The classloader that loads the class can be found through the `sc` command. @@ -60,7 +60,7 @@ Then use the `-c`/`--classloader` parameter to specify: vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext ``` -### Specify the number of expanded layers of returned results +## Specify the number of expanded layers of returned results ::: tip The return result of the `getInstances` action is bound to the `instances` variable, which is an array. @@ -72,7 +72,7 @@ The expansion level of the result can be specified by the `-x`/`--expand` parame vmtool --action getInstances -c 19469ea2 --className org.springframework.context.ApplicationContext -x 2 ``` -### Execute expression +## Execute expression ::: tip The return result of the `getInstances` action is bound to the `instances` variable, which is an array. The specified expression can be executed through the `--express` parameter. @@ -82,7 +82,7 @@ The return result of the `getInstances` action is bound to the `instances` varia vmtool --action getInstances --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader --className org.springframework.context.ApplicationContext --express'instances[0].getBeanDefinitionNames()' ``` -### Force GC +## Force GC ```bash vmtool --action forceGc diff --git a/site/docs/en/doc/watch.md b/site/docs/en/doc/watch.md index 01697687f..9d8fbd432 100644 --- a/site/docs/en/doc/watch.md +++ b/site/docs/en/doc/watch.md @@ -6,7 +6,7 @@ Monitor methods in data aspect including `return values`, `exceptions` and `para With the help of [OGNL](https://commons.apache.org/proper/commons-ognl/index.html), you can easily check the details of variables when methods being invoked. -### Parameters & Options +## Parameters & Options There are four different scenarios for `watch` command, which makes it rather complicated. @@ -38,13 +38,13 @@ Advanced: - [Special usages](https://github.com/alibaba/arthas/issues/71) - [OGNL official guide](https://commons.apache.org/proper/commons-ognl/language-guide.html) -### Usage +## Usage -#### Start Demo +### Start Demo Start `math-game` in [Quick Start](quick-start.md). -#### Check the `out parameters`, `this` and `return value` +### Check the `out parameters`, `this` and `return value` ::: tip The expression to watch, default value `{params, target, returnObj}` @@ -85,7 +85,7 @@ ts=2021-08-31 15:22:58; [cost=1.020982ms] result=@ArrayList[ - In the above result, the method is executed twice, the first result is `location=AtExceptionExit`, indicating that the method throws an exception, so `returnObj` is null - In the second result is `location=AtExit`, indicating that the method returns normally, so you can see that the result of `returnObj` is an ArrayList -#### Check `in parameters` +### Check `in parameters` ```bash $ watch demo.MathGame primeFactors "{params,returnObj}" -x 2 -b @@ -103,7 +103,7 @@ Compared to the previous _check_: - `return value` is `null` since it's `-b`. -#### Check _before_ and _after_ at the same time +### Check _before_ and _after_ at the same time ```bash $ watch demo.MathGame primeFactors "{params,target,returnObj}" -x 2 -b -s -n 2 @@ -146,7 +146,7 @@ F.Y.I - the first block of output is the _before watching_ point; - *the order of the output determined by the *watching\* order itself (nothing to do with the order of the options `-b -s`). -#### Use `-x` to check more details +### Use `-x` to check more details ```bash $ watch demo.MathGame primeFactors "{params,target}" -x 3 @@ -182,7 +182,7 @@ ts=2018-12-03 19:34:19; [cost=0.587833ms] result=@ArrayList[ - `-x`: Expand level of object (1 by default) - The max value of `-x` is 4, to prevent the expansion result taking up too much memory. Users can specify the field in the `ognl` expression. -#### Use condition expressions to locate specific call +### Use condition expressions to locate specific call ```bash $ watch demo.MathGame primeFactors "{params[0],target}" "params[0]<0" @@ -194,7 +194,7 @@ ts=2018-12-03 19:36:04; [cost=0.530255ms] result=@ArrayList[ ] ``` -#### Check `exceptions` +### Check `exceptions` ```bash $ watch demo.MathGame primeFactors "{params[0],throwExp}" -e -x 2 @@ -213,7 +213,7 @@ ts=2018-12-03 19:38:00; [cost=1.414993ms] result=@ArrayList[ - `-e`: Trigger when an exception is thrown - `throwExp`: the exception object -#### Filter by time cost +### Filter by time cost ```bash $ watch demo.MathGame primeFactors '{params, returnObj}' '#cost>200' -x 2 @@ -232,7 +232,7 @@ ts=2018-12-03 19:40:28; [cost=2112.168897ms] result=@ArrayList[ - `#cost>200` (`ms`) filter out all invokings that take less than `200ms`. -#### Check the field of the target object +### Check the field of the target object - `target` is the `this` object in java. @@ -256,7 +256,7 @@ ts=2018-12-03 20:04:34; [cost=131.303498ms] result=@Integer[8] ts=2018-12-03 20:04:35; [cost=0.961441ms] result=@Integer[8] ``` -#### Get a static field and calling a static method +### Get a static field and calling a static method ```bash watch demo.MathGame * '{params,@demo.MathGame@random.nextInt(100)}' -v -n 1 -x 2 @@ -273,7 +273,7 @@ ts=2021-01-05 21:35:20; [cost=0.173966ms] result=@ArrayList[ - Note that here you use `Thread.currentThread().getContextClassLoader()` to load, and it is better to use the exact `classloader` [ognl](ognl.md). -#### Exclude the specified class +### Exclude the specified class ::: tip The watch/trace/monitor/stack/tt commands all support the `--exclude-class-pattern` parameter @@ -285,7 +285,7 @@ Use the `--exclude-class-pattern` parameter to exclude the specified class, for watch javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilter ``` -#### Does not match subclass +### Does not match subclass By default, the watch/trace/monitor/stack/tt commands will match subclass. If you don't want to match, you can turn it off. @@ -293,7 +293,7 @@ By default, the watch/trace/monitor/stack/tt commands will match subclass. If yo options disable-sub-class true ``` -#### Use the -v parameter to print more information +### Use the -v parameter to print more information > The watch/trace/monitor/stack/tt commands all support the `-v` parameter. diff --git a/site/docs/en/doc/web-console.md b/site/docs/en/doc/web-console.md index 6d8dbe28a..29eac2d92 100644 --- a/site/docs/en/doc/web-console.md +++ b/site/docs/en/doc/web-console.md @@ -2,7 +2,7 @@ [`Web Console` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=case-web-console) -### Connect arthas through the browser +## Connect arthas through the browser Arthas supports the Web Console. After attach success, the user can access: [http://127.0.0.1:8563/](http://127.0.0.1:8563/). @@ -22,7 +22,7 @@ If you have suggestions for the Web Console, please leave a message here: [https Since 3.5.4, you can right-click to copy and paste in the Web Console. ::: -### scrollback URL parameters +## scrollback URL parameters ::: tip Since 3.5.5 @@ -32,6 +32,6 @@ By default, the number of rows that the Web Console supports to roll back upward [http://127.0.0.1:8563/?scrollback=3000](http://127.0.0.1:8563/?scrollback=3000) -### Connect remote arthas through arthas tunnel server +## Connect remote arthas through arthas tunnel server Reference: [Arthas Tunnel](tunnel.md)