mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
session command support print agent id/tunnel server. #835
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.taobao.arthas.core.command.basic1000;
|
||||
|
||||
import com.taobao.arthas.core.server.ArthasBootstrap;
|
||||
import com.taobao.arthas.core.shell.command.AnnotatedCommand;
|
||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
||||
import com.taobao.arthas.core.shell.session.Session;
|
||||
@@ -12,6 +13,8 @@ import com.taobao.text.util.RenderUtil;
|
||||
|
||||
import static com.taobao.text.ui.Element.label;
|
||||
|
||||
import com.alibaba.arthas.tunnel.client.TunnelClient;
|
||||
|
||||
/**
|
||||
* 查看会话状态命令
|
||||
*
|
||||
@@ -32,6 +35,14 @@ public class SessionCommand extends AnnotatedCommand {
|
||||
TableElement table = new TableElement().leftCellPadding(1).rightCellPadding(1);
|
||||
table.row(true, label("Name").style(Decoration.bold.bold()), label("Value").style(Decoration.bold.bold()));
|
||||
table.row("JAVA_PID", "" + session.getPid()).row("SESSION_ID", "" + session.getSessionId());
|
||||
TunnelClient tunnelClient = ArthasBootstrap.getInstance().getTunnelClient();
|
||||
if (tunnelClient != null) {
|
||||
String id = tunnelClient.getId();
|
||||
if (id != null) {
|
||||
table.row("AGENT_ID", "" + id);
|
||||
}
|
||||
table.row("TUNNEL_SERVER", "" + tunnelClient.getTunnelServerUrl());
|
||||
}
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -232,4 +232,8 @@ public class ArthasBootstrap {
|
||||
logger.error(null, "Spy destroy failed: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
public TunnelClient getTunnelClient() {
|
||||
return tunnelClient;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user