feat: update online tutorials, switch to killercoda (#2633)

pull/2642/head
Fatpandac 1 year ago committed by GitHub
parent 8d3080f13e
commit 4efc7dbb73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -14,7 +14,7 @@ Welcome to use [issue tracker](https://github.com/alibaba/arthas/issues) to give
## Online Tutorials
Please refer to [README.MD at tutorials/katacoda](tutorials/katacoda/README.md#contribution-guide)
Please refer to [README.MD at killercoda branch](https://github.com/alibaba/arthas/tree/killercoda/README.md#contribution-guide)
## Developer
@ -79,7 +79,7 @@ Tip: you can use `--versions` to list all available versions.
## 改进在线教程
请参考[tutorials/katacoda下的说明](tutorials/katacoda/README_CN.md#贡献指南)
请参考[killercoda 分支下的说明](https://github.com/alibaba/arthas/tree/killercoda/README_CN.md#贡献指南)
## 开发者相关

@ -14,7 +14,7 @@ const addOldDocsContributors = () => {
return contributors.find(
(contributor) =>
contributor.name === oldContributor.name &&
contributor.email === oldContributor.email
contributor.email === oldContributor.email,
);
};

@ -91,7 +91,7 @@ export default defineUserConfig({
.map((page) => [
page.path.replace(/^\/en\/doc\//, "/doc/en/"),
page.path,
])
]),
);
delete redirects["/doc/en/"];

@ -7,89 +7,78 @@ export const sidebarEN = {
"/en/doc/quick-start.md",
"/en/doc/install-detail.md",
"/en/doc/download.md",
"/en/doc/advanced-use.md",
{
text: "Other features",
collapsible: true,
children: [
"/en/doc/async.md",
"/en/doc/save-log.md",
"/en/doc/batch-support.md",
{
text: "How to use ognl",
link: "",
children: [
{
text: "Basic ognl example",
link: "https://github.com/alibaba/arthas/issues/11",
},
{
text: "Ognl special uses",
link: "https://github.com/alibaba/arthas/issues/71",
},
],
},
],
},
"/en/doc/advice-class.html",
{
text: "All Commands",
link: "/en/doc/commands.md",
collapsible: true,
children: [
"/en/doc/auth.md",
"/en/doc/base64.md",
"/en/doc/cat.md",
"/en/doc/classloader.md",
"/en/doc/cls.md",
"/en/doc/dashboard.md",
"/en/doc/dump.md",
"/en/doc/echo.md",
"/en/doc/getstatic.md",
"/en/doc/grep.md",
"/en/doc/heapdump.md",
"/en/doc/help.md",
"/en/doc/history.md",
"/en/doc/jad.md",
"/en/doc/jfr.md",
"/en/doc/jvm.md",
"/en/doc/keymap.md",
"/en/doc/logger.md",
"/en/doc/mbean.md",
"/en/doc/mc.md",
"/en/doc/memory.md",
"/en/doc/monitor.md",
"/en/doc/ognl.md",
"/en/doc/options.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/jfr.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/redefine.md",
"/en/doc/reset.md",
"/en/doc/retransform.md",
"/en/doc/sc.md",
"/en/doc/session.md",
"/en/doc/sm.md",
"/en/doc/stack.md",
"/en/doc/stop.md",
"/en/doc/sysenv.md",
"/en/doc/sysprop.md",
"/en/doc/tee.md",
"/en/doc/thread.md",
"/en/doc/trace.md",
"/en/doc/tt.md",
"/en/doc/version.md",
"/en/doc/vmoption.md",
"/en/doc/vmtool.md",
"/en/doc/watch.md",
],
},
{
text: "Other features",
link: "/en/doc/advanced-use.md",
collapsible: true,
children: [
"/en/doc/async.md",
"/en/doc/save-log.md",
"/en/doc/docker.md",
"/en/doc/web-console.md",
"/en/doc/tunnel.md",
"/en/doc/idea-plugin.md",
"/en/doc/arthas-properties.html",
"/en/doc/agent.html",
"/en/doc/spring-boot-starter.md",
"/en/doc/http-api.md",
"/en/doc/batch-support.md",
],
},
"/en/doc/web-console.md",
"/en/doc/tunnel.md",
"/en/doc/http-api.md",
"/en/doc/docker.md",
"/en/doc/spring-boot-starter.md",
"/en/doc/idea-plugin.md",
"/en/doc/faq.md",
{
text: "User cases",

@ -7,89 +7,78 @@ export const sidebarZH = {
"/doc/quick-start.md",
"/doc/install-detail.md",
"/doc/download.md",
"/doc/advanced-use.md",
{
text: "其他特性",
collapsible: true,
children: [
"/doc/async.md",
"/doc/save-log.md",
"/doc/batch-support.md",
{
text: "ognl 表达式用法",
link: "",
children: [
{
text: "活用ognl表达式",
link: "https://github.com/alibaba/arthas/issues/11",
},
{
text: "一些ognl特殊用法",
link: "https://github.com/alibaba/arthas/issues/71",
},
],
},
],
},
"/doc/advice-class.html",
{
text: "命令列表",
link: "/doc/commands.md",
collapsible: true,
children: [
"/doc/auth.md",
"/doc/base64.md",
"/doc/cat.md",
"/doc/classloader.md",
"/doc/cls.md",
"/doc/dashboard.md",
"/doc/dump.md",
"/doc/echo.md",
"/doc/getstatic.md",
"/doc/grep.md",
"/doc/heapdump.md",
"/doc/help.md",
"/doc/history.md",
"/doc/jad.md",
"/doc/jfr.md",
"/doc/jvm.md",
"/doc/keymap.md",
"/doc/logger.md",
"/doc/mbean.md",
"/doc/mc.md",
"/doc/memory.md",
"/doc/monitor.md",
"/doc/ognl.md",
"/doc/options.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/jfr.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/redefine.md",
"/doc/reset.md",
"/doc/retransform.md",
"/doc/sc.md",
"/doc/session.md",
"/doc/sm.md",
"/doc/stack.md",
"/doc/stop.md",
"/doc/sysenv.md",
"/doc/sysprop.md",
"/doc/tee.md",
"/doc/thread.md",
"/doc/trace.md",
"/doc/tt.md",
"/doc/version.md",
"/doc/vmoption.md",
"/doc/vmtool.md",
"/doc/watch.md",
],
},
{
text: "其他特性",
link: "/doc/advanced-use.md",
collapsible: true,
children: [
"/doc/async.md",
"/doc/save-log.md",
"/doc/docker.md",
"/doc/web-console.md",
"/doc/tunnel.md",
"/doc/idea-plugin.md",
"/doc/arthas-properties.html",
"/doc/agent.html",
"/doc/spring-boot-starter.md",
"/doc/http-api.md",
"/doc/batch-support.md",
],
},
"/doc/web-console.md",
"/doc/tunnel.md",
"/doc/http-api.md",
"/doc/docker.md",
"/doc/spring-boot-starter.md",
"/doc/idea-plugin.md",
"/doc/faq.md",
{
text: "用户案例",
@ -108,7 +97,7 @@ export const sidebarZH = {
link: "https://github.com/alibaba/arthas/releases",
},
{
text: "QQ群/钉钉群",
text: "QQ 群/钉钉群",
link: "/doc/contact-us.md",
},
],

@ -8,7 +8,7 @@ export function loadVersionPlugin() {
const getVersionByMaven = async () => {
return await fetch(
"https://search.maven.org/solrsearch/select?q=arthas&rows=1&wt=json"
"https://search.maven.org/solrsearch/select?q=arthas&rows=1&wt=json",
)
.then((res) => res.json())
.then((res) => res.response.docs[0].latestVersion);

@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
@ -67,7 +67,7 @@
<script src="https://katacoda.com/embed.js"></script>
<div id="app">
<div id="app" style="height: 100vh; overflow: hidden">
<nav
class="navbar navbar-expand navbar-light bg-light flex-column flex-md-row bd-navbar"
>
@ -276,14 +276,41 @@
</div>
</form>
</nav>
<div
class="alert alert-danger alert-dismissible fade show"
v-if="isSafari()"
role="alert"
>
<span v-html="alertChangeBrowser[language]"></span>
</div>
<div id="kata-container" class="container-fluid px-0">
<div
id="katacoda-scenario-1"
v-bind:data-katacoda-id="currentKatacodaId()"
data-katacoda-color="004d7f"
v-bind:style="{height: (calculateKataSize().height - 5) + 'px' }"
></div>
<div
class="alert alert-warning alert-dismissible fade show position-fixed w-25"
v-if="!getCookie('alert') && !isSafari()"
style="bottom: 2rem; right: 1rem"
role="alert"
>
<span v-html="alertLoginContent[language]"></span>
<button
type="button"
class="close"
data-dismiss="alert"
aria-label="Close"
>
<span aria-hidden="true">&times;</span>
</button>
</div>
<div id="kata-container" class="container-fluid px-0 py-0">
<iframe
style="width: 100vw"
v-bind:style="{height: `${iframeHeight}px` }"
v-if="!isSafari()"
frameborder="0"
scrolling="no"
sandbox="allow-scripts allow-same-origin allow-popups"
:src="`https://killercoda.com/arthas/course/arthas-tutorials-${language}/${currentKatacodaId().replace('case-', '').replace('command-', '').replace('-en', '').replace('-cn', '')}`"
></iframe>
</div>
</div>
</body>
@ -300,15 +327,47 @@
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(";");
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == " ") {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function setCookie(cname, cvalue, exdays) {
const d = new Date();
d.setTime(d.getTime() + exdays * 24 * 60 * 60 * 1000);
let expires = "expires=" + d.toUTCString();
document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
var app = new Vue({
el: "#app",
data: {
message: "Hello Vue!",
language: "en",
iframeHeight: 0,
languages: [
{ text: "English", value: "en" },
{ text: "中文", value: "cn" },
],
alertLoginContent: {
en: "If you havent logged in to killercoda, please click the link to navigate to <a href='https://killercoda.com'>killercoda.com</a> and log in before continuing with the tutorial",
cn: "如果没有登陆 killercoda 请先点击链接跳转到 <a href='https://killercoda.com'>killercoda.com</a> 登录后继续使用教程",
},
alertChangeBrowser: {
en: "Please use Firefox or Chrome to open the tutorial or visit <a href='https://killercoda.com/arthas'>killercoda.com/arthas</a>",
cn: "请使用 Firefox 或 Chrome 打开教程或访问 <a href='https://killercoda.com/arthas'>killercoda.com/arthas</a>",
},
tutorialId: "arthas-basics",
tutorials: [
{
@ -316,7 +375,7 @@
type: "TUTORIAL",
names: {
en: "Arthas Basics",
cn: "Arthas基础教程",
cn: "Arthas 基础教程",
},
ids: {
en: "arthas-basics-en",
@ -328,7 +387,7 @@
type: "TUTORIAL",
names: {
en: "Arthas Advanced",
cn: "Arthas进阶教程",
cn: "Arthas 进阶教程",
},
ids: {
en: "arthas-advanced-en",
@ -904,7 +963,7 @@
type: "USERCASE",
names: {
en: "Debug ognl express",
cn: "调试ognl表达式",
cn: "调试 ognl 表达式",
},
ids: {
en: "case-ognl-practise-en",
@ -916,7 +975,7 @@
type: "USERCASE",
names: {
en: "Find CPU usage Top N threads",
cn: "查找Top N线程",
cn: "查找 Top N 线程",
},
ids: {
en: "case-thread-en",
@ -928,7 +987,7 @@
type: "USERCASE",
names: {
en: "Change Logger Level",
cn: "动态更新应用Logger Level",
cn: "动态更新应用 Logger Level",
},
ids: {
en: "case-ognl-update-logger-level-en",
@ -940,7 +999,7 @@
type: "USERCASE",
names: {
en: "Troubleshoot logger conflicts",
cn: "排查logger冲突问题",
cn: "排查 logger 冲突问题",
},
ids: {
en: "case-logger-config-problem-en",
@ -959,24 +1018,12 @@
cn: "case-jad-mc-redefine-cn",
},
},
{
id: "case-http-404",
type: "USERCASE",
names: {
en: "Troubleshooting HTTP request returns 404",
cn: "排查HTTP请求返回404",
},
ids: {
en: "case-http-404-en",
cn: "case-http-404-cn",
},
},
{
id: "case-http-401",
type: "USERCASE",
names: {
en: "Troubleshooting HTTP request returns 401",
cn: "排查HTTP请求返回401",
cn: "排查 HTTP 请求返回 401",
},
ids: {
en: "case-http-401-en",
@ -988,7 +1035,7 @@
type: "USERCASE",
names: {
en: "Get the Spring Context",
cn: "获取Spring Context",
cn: "获取 Spring Context",
},
ids: {
en: "case-get-spring-context-en",
@ -1000,7 +1047,7 @@
type: "USERCASE",
names: {
en: "The ClassLoaders in Spring Boot application",
cn: "理解Spring Boot应用的ClassLoader结构",
cn: "理解 Spring Boot 应用的 ClassLoader 结构",
},
ids: {
en: "case-classloader-en",
@ -1012,7 +1059,7 @@
type: "USERCASE",
names: {
en: "Arthas boot supported options",
cn: " arthas-boot支持的参数",
cn: " arthas-boot 支持的参数",
},
ids: {
en: "case-boot-details-en",
@ -1035,7 +1082,9 @@
},
methods: {
getTutorials: function (type) {
return this.tutorials.filter((v) => v.type === type);
return this.tutorials
.filter((v) => v.type === type)
.sort((a, b) => a.id.charCodeAt(0) - b.id.charCodeAt(0));
},
languageChange: function (event) {
// alert(event.target.value)
@ -1107,7 +1156,7 @@
// https://katacoda.com/embed/arthas/arthas-advanced-cn/?embed=true
for (index in this.tutorials) {
if (this.tutorials[index].id == this.tutorialId) {
return "arthas/" + this.tutorials[index].ids[this.language];
return this.tutorials[index].id;
}
}
},
@ -1125,25 +1174,41 @@
height: e[a + "Height"] - terminalDivRect.top,
};
},
isSafari: function () {
return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
},
},
beforeMount() {
var l = getUrlParam("language");
let l = getUrlParam("language");
if (l != null) {
this.language = l;
}
var id = getUrlParam("id");
let id = getUrlParam("id");
if (id != null) {
this.tutorialId = id;
}
},
mounted() {
let _this = this;
// set an alert cookie when the alert is closed
$("div.alert.alert-warning").on("closed.bs.alert", () => {
setCookie("alert", "closed", 60);
});
this.iframeHeight = this.calculateKataSize().height;
window.onresize = () => {
_this.iframeHeight = _this.calculateKataSize().height;
};
},
});
</script>
<script type="text/javascript">
document.write(
unescape(
"%3Cspan style='display:none;' id='cnzz_stat_icon_1279151497'%3E%3C/span%3E%3Cscript src='https://s4.cnzz.com/z_stat.php%3Fid%3D1279151497' type='text/javascript'%3E%3C/script%3E"
)
"%3Cspan style='display:none;' id='cnzz_stat_icon_1279151497'%3E%3C/span%3E%3Cscript src='https://s4.cnzz.com/z_stat.php%3Fid%3D1279151497' type='text/javascript'%3E%3C/script%3E",
),
);
</script>

@ -31,7 +31,7 @@ const { item } = toRefs(props);
const hasHttpProtocol = computed(() => isLinkHttp(item.value.link));
// if the link has non-http protocol
const hasNonHttpProtocol = computed(
() => isLinkMailto(item.value.link) || isLinkTel(item.value.link)
() => isLinkMailto(item.value.link) || isLinkTel(item.value.link),
);
// resolve the `target` attr
const linkTarget = computed(() => {
@ -45,7 +45,7 @@ const isBlankTarget = computed(() => linkTarget.value === "_blank");
// is `<RouterLink>` or not
const isRouterLink = computed(
() =>
!hasHttpProtocol.value && !hasNonHttpProtocol.value && !isBlankTarget.value
!hasHttpProtocol.value && !hasNonHttpProtocol.value && !isBlankTarget.value,
);
// resolve the `rel` attr
const linkRel = computed(() => {

@ -17,11 +17,11 @@ const fork = ref(6494);
const getStarForkData = async () => {
const stars = await fetch("https://arthas.aliyun.com/api/starCount").then(
(res) => res.json()
(res) => res.json(),
);
const forks = await fetch("https://arthas.aliyun.com/api/forkCount").then(
(res) => res.json()
(res) => res.json(),
);
star.value = stars || star.value;

@ -31,7 +31,7 @@ const heroText = computed(() => {
});
const heroAlt = computed(
() => frontmatter.value.heroAlt || heroText.value || "hero"
() => frontmatter.value.heroAlt || heroText.value || "hero",
);
const tagline = computed(() => {

@ -19,7 +19,7 @@ const themeLocale = useThemeLocaleData();
const version = ref(pageData.value.version);
const navbarBrandLink = computed(
() => themeLocale.value.home || routeLocale.value
() => themeLocale.value.home || routeLocale.value,
);
const navbarBrandTitle = computed(() => siteLocale.value.title);
const navbarBrandLogo = computed(() => {
@ -35,7 +35,7 @@ const NavbarBrandVersion = () =>
{
class: "navbar-version",
},
`v${version.value}`
`v${version.value}`,
);
const NavbarBrandLogo = () => {

@ -16,7 +16,7 @@ const props = defineProps({
const { item } = toRefs(props);
const dropdownAriaLabel = computed(
() => item.value.ariaLabel || item.value.text
() => item.value.ariaLabel || item.value.text,
);
const open = ref(false);
@ -25,7 +25,7 @@ watch(
() => route.path,
() => {
open.value = false;
}
},
);
/**

@ -18,7 +18,7 @@ SRC: https://github.com/xugaoyi/vuepress-theme-vdoing/blob/master/vdoing/compone
>
<a
:href="'#' + item.slug"
v-if="item.title.replace(/[^\x00-\xff]/g, '01').length >= 27"
v-if="item.title.replace(/[^\x00-\xff]/g, '01').length >= 36"
:title="item.title"
>{{ item.title }}</a
>
@ -35,7 +35,7 @@ SRC: https://github.com/xugaoyi/vuepress-theme-vdoing/blob/master/vdoing/compone
>
<a
:href="'#' + subItem.slug"
v-if="subItem.title.replace(/[^\x00-\xff]/g, '01').length >= 27"
v-if="subItem.title.replace(/[^\x00-\xff]/g, '01').length >= 35"
:title="subItem.title"
>{{ subItem.title }}</a
>
@ -82,7 +82,7 @@ watch(useRoute(), () => {
</script>
<style lang="scss" scoped>
$rightMenuWidth: 230px;
$rightMenuWidth: 280px;
.theme-default-content {
.right-menu-wrapper {
@ -138,7 +138,7 @@ $rightMenuWidth: 230px;
padding-right: 0;
}
.right-menu-item {
padding: 4px 15px;
padding: 4px 0px 0px 15px;
overflow: hidden;
white-space: nowrap;

@ -12,13 +12,13 @@ export function localTheme(options) {
"@theme/Home.vue": path.resolve(__dirname, "components/Home.vue"),
"@theme/NavbarDropdown.vue": path.resolve(
__dirname,
"components/NavbarDropdown.vue"
"components/NavbarDropdown.vue",
),
"@theme/AutoLink.vue": path.resolve(__dirname, "components/AutoLink.vue"),
"@theme/Page.vue": path.resolve(__dirname, "components/Page.vue"),
"@theme/NavbarBrand.vue": path.resolve(
__dirname,
"components/NavbarBrand.vue"
"components/NavbarBrand.vue",
),
},
};

@ -1,4 +1,22 @@
# 进阶使用
# 其他特性
## Arthas 后台异步任务
当需要排查一个问题,但是这个问题的出现时间不能确定,那我们就可以把检测命令挂在后台运行,并将保存到输出日志。
- [Arthas 后台异步任务](async.md)
## 执行结果存日志
所有执行记录的结果完整保存在日志文件中,便于后续进行分析。
- [执行结果存日志](save-log.md)
## Docker
Arthas 在 docker 容器中使用配置参考。
- [Docker](docker.md)
## Web Console
@ -6,14 +24,51 @@
- [Web Console](web-console.md)
## Arthas Tunnel
通过 Arthas Tunnel Server/Client 来远程管理/连接多个服务器下的Java服务。
- [Arthas Tunnel](tunnel.md)
## ognl 表达式用法
- [ognl 表达式的用法说明](https://github.com/alibaba/arthas/issues/11)
- [一些 ognl 特殊用法](https://github.com/alibaba/arthas/issues/71)
## IDEA Plugin
IntelliJ IDEA 编译器中更加快捷构建 arhtas 命令。
- [IDEA Plugin](idea-plugin.md)
## Arthas Properties
Arthas 支持配置项参考。
- [Arthas Properties](arthas-properties.md)
## 以 java agent 方式启动
- [以 java agent 方式启动](agent.md)
## Arthas Spring Boot Starter
随应用一起启动。
- [Arthas Spring Boot Starter](spring-boot-starter.md)
## HTTP API
Http API 提供结构化的数据,支持更复杂的交互功能,方便自定义界面集成 arthas。
- [HTTP API](http-api.md)
## 批处理功能
方便自定义脚本一次性批量运行多个命令,可结合 `--select` 参数可以指定进程名字一起使用。
- [批处理功能](batch-support.md)
## as.sh 和 arthas-boot 技巧
- 通过`select`功能选择 attach 的进程。
@ -68,10 +123,3 @@ pid 58883
在 tunnel server 里有一个示例的回报代码,用户可以自己在服务器上实现。
[StatController.java](https://github.com/alibaba/arthas/blob/master/tunnel-server/src/main/java/com/alibaba/arthas/tunnel/server/app/web/StatController.java)
## 其他特性
- [异步命令支持](async.md)
- [执行结果存日志](save-log.md)
- [批处理的支持](batch-support.md)
- [ognl 表达式的用法说明](https://github.com/alibaba/arthas/issues/11)

@ -1,20 +1,20 @@
# 批处理功能
::: tip
通过批处理功能arthas 支持一次性批量运行多个命令,并取得命令执行的结果。
通过批处理功能arthas 支持一次性批量运行多个命令,并取得命令执行的结果。可结合 `--select` 参数可以指定进程名字一起使用。
:::
## 使用方法
### 第一步: 创建你的批处理脚本
### 第一步:创建你的批处理脚本
这里我们新建了一个`test.as`脚本,为了规范,我们采用了.as 后缀名,但事实上任意的文本文件都 ok。
::: tip
- 目前需要每个命令占一行
- dashboard 务必指定执行次数(`-n`),否则会导致批处理脚本无法终止
- watch/tt/trace/monitor/stack 等命令务必指定执行次数(`-n`),否则会导致批处理脚本无法终止
- dashboard 务必指定执行次数 (`-n`),否则会导致批处理脚本无法终止
- watch/tt/trace/monitor/stack 等命令务必指定执行次数 (`-n`),否则会导致批处理脚本无法终止
- 可以使用异步后台任务,如 `watch c.t.X test returnObj > &`,让命令一直在后台运行,通过日志获取结果,[获取更多异步任务的信息](async.md)
:::
@ -27,9 +27,9 @@ thread
sc -d org.apache.commons.lang.StringUtils
```
### 第二步: 运行你的批处理脚本
### 第二步:运行你的批处理脚本
通过`-f`执行脚本文件, 批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。
通过`-f`执行脚本文件,批处理脚本默认会输出到标准输出中,可以将结果重定向到文件中。
```bash
./as.sh -f /var/tmp/test.as <pid> > test.out # pid 可以通过 jps 命令查看
@ -41,7 +41,7 @@ sc -d org.apache.commons.lang.StringUtils
./as.sh -c 'sysprop; thread' <pid> > test.out # pid 可以通过 jps 命令查看
```
### 第三步: 查看运行结果
### 第三步:查看运行结果
```bash
cat test.out

@ -6,6 +6,8 @@
dump 已加载类的 bytecode 到特定目录
:::
dump 命令将 JVM 中实际运行的 class 的 byte code dump 到指定目录,适用场景批量下载指定包目录的 class 字节码;如需反编译单一类、实时查看类信息,可参考 [jad](/doc/jad.md)。
## 参数说明
| 参数名称 | 参数说明 |
@ -60,6 +62,6 @@ $ dump --classLoaderClass sun.misc.Launcher$AppClassLoader demo.*
Affect(row-cnt:1) cost in 39 ms.
```
- 注: 这里 classLoaderClass 在 java 8 是 sun.misc.Launcher$AppClassLoader而java 11的classloader是jdk.internal.loader.ClassLoaders$AppClassLoaderkatacoda 目前环境是 java8。
- 注这里 classLoaderClass 在 java 8 是 sun.misc.Launcher$AppClassLoader java 11 classloader jdk.internal.loader.ClassLoaders$AppClassLoaderkatacoda 目前环境是 java8。
`--classLoaderClass` 的值是 ClassLoader 的类名,只有匹配到唯一的 ClassLoader 实例时才能工作,目的是方便输入通用命令,而`-c <hashcode>`是动态变化的。

@ -6,7 +6,7 @@
反编译指定已加载类的源码
:::
`jad` 命令将 JVM 中实际运行的 class 的 byte code 反编译成 java 代码,便于你理解业务逻辑;
`jad` 命令将 JVM 中实际运行的 class 的 byte code 反编译成 java 代码,便于你理解业务逻辑;如需批量下载指定包的目录的 class 字节码可以参考 [dump](/doc/dump.md)。
- 在 Arthas Console 上,反编译出来的源码是带语法高亮的,阅读更方便
- 当然,反编译出来的 java 代码可能会存在语法错误,但不影响你进行阅读理解

@ -74,6 +74,7 @@ Recording: recording=2 name=myRecording duration=PT1M (closed)
## dump jfr 记录
`jfr dump`{{}} 会输出从开始到运行该命令这段时间内的记录到 JFR 文件,且不会停止 `jfr`{{}} 的记录
指定记录输出路径
```bash

@ -1,5 +1,7 @@
# 快速入门
可以通过下面的方式自己动手实践,也可以通过我们的[在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=arthas-basics),跟随教程快速入门。
## 1. 启动 math-game
```bash
@ -221,7 +223,7 @@ ts=2018-11-28 19:22:35; [cost=29.969732ms] result=@ArrayList[
]
```
更多的功能可以查看[进阶使用](advanced-use.md)。
更多的功能可以查看[进阶教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=arthas-advanced)。
## 7. 退出 arthas

@ -1,6 +1,6 @@
# 执行结果存日志
[`执行结果存日志`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials?language=cn&id=case-save-log)
[`执行结果存日志`在线教程](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=cn&id=save-log)
::: tip
将命令的结果完整保存在日志文件中,便于后续进行分析

@ -1,4 +1,22 @@
# Advanced Usage
# Other features
## Arthas Async Jobs
If you need to investigate an issue, but you are unsure about the exact time it occurs, you can run the monitoring command in the background and save the output to a log file.
- [Arthas Async Jobs](async.md)
## Log the output
All execution records are fully saved in the log file for subsequent analysis.
- [log the output](save-log.md)
## Docker
Arthas configuration reference for using in Docker containers.
- [Docker](docker.md)
## Web Console
@ -6,14 +24,51 @@ Arthas supports living inside a browser. The communication between arthas and br
- [Web Console](web-console.md)
## Arthas Tunnel
Arthas Tunnel Server/Client enables remote management/connection to Java services across multiple servers.
- [Arthas Tunnel](tunnel.md)
## How to use ognl
- [Basic ognl example](https://github.com/alibaba/arthas/issues/11)
- [Ognl special uses](https://github.com/alibaba/arthas/issues/71)
## IDEA Plugin
Build arthas commands more efficiently in the IntelliJ IDEA compiler.
- [IDEA Plugin](idea-plugin.md)
## Arthas Properties
Arthas supports configuration options reference.
- [Arthas Properties](arthas-properties.md)
## Start as a Java Agent
- [Start as a Java Agent](agent.md)
## Arthas Spring Boot Starter
Starting with the application.
- [Arthas Spring Boot Starter](spring-boot-starter.md)
## HTTP API
The Http API provides structured data and supports more complex interactive functions, making it easier to integrate Arthas into custom interfaces.
- [HTTP API](http-api.md)
## Batch Processing
It is convenient for running multiple commands in bulk with custom scripts. It can be used in conjunction with the `--select` parameter to specify the process name.
- [Batch Processing](batch-support.md)
## as.sh and arthas-boot tips
- Select the process to be attached via the `select` option.
@ -68,10 +123,3 @@ At startup, use the `stat-url` option, such as: `./as.sh --stat-url 'http://192.
There is a sample data report in the tunnel server that users can implement on their own.
[StatController.java](https://github.com/alibaba/arthas/blob/master/tunnel-server/src/main/java/com/alibaba/arthas/tunnel/server/app/web/StatController.java)
## Other features
- [Async support](async.md)
- [log the output](logger.md)
- [batch](batch-support.md)
- [how to use ognl](https://github.com/alibaba/arthas/issues/11)

@ -1,6 +1,7 @@
# Batch Processing
With the help of Batch Processing, you can run multiple commands in batch and get the final result at the end.
The process name can be specified using the “select” parameter.
## Usage

@ -6,6 +6,8 @@
Dump the bytecode for the particular classes to the specified directory.
:::
The dump command is used to dump the bytecode of classes actually running in the JVM to a specified directory. It is suitable for bulk downloading the bytecode of classes in a specific package directory. If you need to decompile a single class or view class information in real-time, you can refer to [jad](/en/doc/jad.md).
## Options
| Name | Specification |

@ -6,7 +6,7 @@
Decompile the specified classes.
:::
`jad` helps to decompile the byte code running in JVM to the source code to assist you to understand the logic behind better.
`jad` helps to decompile the byte code running in JVM to the source code to assist you to understand the logic behind better. If you need to download the bytecode of classes in a specific package directory in bulk, you can refer to the [dump](/en/doc/dump.md) tool for assistance.
- 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.

@ -74,6 +74,7 @@ Recording: recording=2 name=myRecording duration=PT1M (closed)
## dump jfr recording
The `jfr dump`{{}} command will output the recordings from the start until the execution of the command to a JFR file, without stopping the recording.
Specifies the record output path.
```bash

@ -1,5 +1,7 @@
# Quick Start
You can practice it yourself by following the instructions below, or you can use our [online tutorials](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=arthas-basics) to get started quickly.
## 1. Start math-game
```bash
@ -222,7 +224,7 @@ ts=2018-11-28 19:22:35; [cost=29.969732ms] result=@ArrayList[
]
```
Pls. refer to [advanced usages](advanced-use.md) for more information.
Pls. refer to [Arthas advanced](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=arthas-advanced) for more information.
## 7. Exit Arthas

@ -1,6 +1,6 @@
# Log command outputs
[`Log command outputs` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials?language=en&id=case-save-log)
[`Log command outputs` online tutorial](https://arthas.aliyun.com/doc/arthas-tutorials.html?language=en&id=save-log)
::: tip
Log command outputs for later analysis
@ -24,4 +24,4 @@ Log command outputs for later analysis
## Use asynchronous job to log
Reference: [async] (async.md)
Reference: [async](async.md)

Loading…
Cancel
Save