mirror of https://github.com/alibaba/arthas.git
add case-ognl-practise-cn
parent
1a809d2a96
commit
5c606a62f3
@ -0,0 +1,25 @@
|
|||||||
|
# Katacoda Hello World
|
||||||
|
This is an example repository. Starting building your own scenario by editing the files in this directory. Create additional scenarios by adding additional directories to the top level folder.
|
||||||
|
|
||||||
|
|
||||||
|
## index.json
|
||||||
|
The file _index.json_ contains all the information about the scenario. It has the title, description and a heading for each step.
|
||||||
|
|
||||||
|
The file also contains an imageid. This refers to the Katacoda environment. Here are some environment image IDs you may find useful:
|
||||||
|
|
||||||
|
| **Environment** | **Image ID** |
|
||||||
|
|------------------|---------------|
|
||||||
|
| Docker | docker |
|
||||||
|
| Kubernetes | kubernetes |
|
||||||
|
| CoreOS | coreos |
|
||||||
|
| Node.js v6 | node6 |
|
||||||
|
| Go | go |
|
||||||
|
| C# | c# |
|
||||||
|
| Java | java8 |
|
||||||
|
| Bash | bash |
|
||||||
|
|
||||||
|
## Pro Author Accounts
|
||||||
|
Interested in metrics, private repositories and environments for classroom teaching? Update to become a Pro Author at https://katacoda.com/teach
|
||||||
|
|
||||||
|
## Interactive Developer Portals
|
||||||
|
Want to take your scenarios to the next level? Visit https://katacoda.com/embed
|
@ -0,0 +1,32 @@
|
|||||||
|
{
|
||||||
|
"noindex": true,
|
||||||
|
"title": "调试 Arthas 的 ognl 表达式",
|
||||||
|
"description": "调试 Arthas 的 ognl 表达式",
|
||||||
|
"details": {
|
||||||
|
"steps": [
|
||||||
|
{
|
||||||
|
"text": "step1.md",
|
||||||
|
"code": "setup.sh"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"intro": {
|
||||||
|
"text": "intro.md",
|
||||||
|
"credits": ""
|
||||||
|
},
|
||||||
|
"finish": {
|
||||||
|
"text": "finish.md"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
],
|
||||||
|
"environment": {
|
||||||
|
"hidefinish": true,
|
||||||
|
"hideHiddenFiles": true,
|
||||||
|
"uilayout": "editor-terminal",
|
||||||
|
"uisettings": "javascript",
|
||||||
|
"uieditorpath": "/root/example/ognl-demo"
|
||||||
|
},
|
||||||
|
"backend": {
|
||||||
|
"imageid": "openjdk:15"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
mkdir -p example; cd example/; git clone https://github.com/hengyunabc/ognl-demo.git ; cd ognl-demo
|
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
演示Arthas里`watch`命令中`ognl`表达式的工作流程。用户可以自己修改`Demo.java`里的表达式,再执行验证。
|
||||||
|
|
||||||
|
项目地址: https://github.com/hengyunabc/ognl-demo
|
||||||
|
# 打开Demo.java文件
|
||||||
|
|
||||||
|
`src/main/java/com/example/ognl/Demo.java`{{open}}
|
||||||
|
|
||||||
|
# 编译运行代码
|
||||||
|
|
||||||
|
`mvn compile exec:java`{{execute}}
|
||||||
|
|
||||||
|
代码里的表达式:
|
||||||
|
|
||||||
|
```java
|
||||||
|
String watchExpress = "{target, params, returnObj, #cost}";
|
||||||
|
String conditionExpress = "params[0] > 1 && #cost > 0.1";
|
||||||
|
```
|
||||||
|
|
||||||
|
结果类似下面的表达式:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
watch com.example.ognl.TestService test "{target, params, returnObj, #cost}" "params[0] > 1 && #cost > 0.1" -x 3
|
||||||
|
```
|
||||||
|
|
||||||
|
# 查看函数抛出异常时的表达式结果
|
||||||
|
|
||||||
|
`mvn compile exec:java -DexceptionCase=true`{{execute}}
|
||||||
|
|
||||||
|
代码里的表达式:
|
||||||
|
|
||||||
|
```java
|
||||||
|
String watchExpress = "{target, params, throwExp}";
|
||||||
|
String conditionExpress = "params[0] > 1";
|
||||||
|
```
|
||||||
|
|
||||||
|
结果类似下面的表达式:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
watch com.example.ognl.TestService test "{target, params, throwExp}" "params[0] > 1" -e -x 2
|
||||||
|
```
|
Loading…
Reference in New Issue