mirror of
https://gitee.com/arthas/arthas.git
synced 2024-11-29 18:58:37 +08:00
UserStat support agentId (#2501)
This commit is contained in:
parent
243ffacf88
commit
fa1d2bd30a
@ -456,6 +456,7 @@ public class ArthasBootstrap {
|
||||
logger().info("arthas stat url: {}", configure.getStatUrl());
|
||||
}
|
||||
UserStatUtil.setStatUrl(configure.getStatUrl());
|
||||
UserStatUtil.setAgentId(configure.getAgentId());
|
||||
UserStatUtil.arthasStart();
|
||||
|
||||
try {
|
||||
|
@ -35,6 +35,8 @@ public class UserStatUtil {
|
||||
|
||||
private static volatile String statUrl = null;
|
||||
|
||||
private static volatile String agentId = null;
|
||||
|
||||
public static String getStatUrl() {
|
||||
return statUrl;
|
||||
}
|
||||
@ -43,10 +45,21 @@ public class UserStatUtil {
|
||||
statUrl = url;
|
||||
}
|
||||
|
||||
public static String getAgentId() {
|
||||
return agentId;
|
||||
}
|
||||
|
||||
public static void setAgentId(String id) {
|
||||
agentId = id;
|
||||
}
|
||||
|
||||
public static void arthasStart() {
|
||||
RemoteJob job = new RemoteJob();
|
||||
job.appendQueryData("ip", ip);
|
||||
job.appendQueryData("version", version);
|
||||
if (agentId != null) {
|
||||
job.appendQueryData("agentId", agentId);
|
||||
}
|
||||
job.appendQueryData("command", "start");
|
||||
|
||||
try {
|
||||
@ -60,6 +73,9 @@ public class UserStatUtil {
|
||||
RemoteJob job = new RemoteJob();
|
||||
job.appendQueryData("ip", ip);
|
||||
job.appendQueryData("version", version);
|
||||
if (agentId != null) {
|
||||
job.appendQueryData("agentId", agentId);
|
||||
}
|
||||
job.appendQueryData("command", URLEncoder.encode(cmd));
|
||||
if (detail != null) {
|
||||
job.appendQueryData("arguments", URLEncoder.encode(detail));
|
||||
|
@ -23,10 +23,11 @@ public class StatController {
|
||||
@ResponseBody
|
||||
public Map<String, Object> execute(@RequestParam(value = "ip", required = true) String ip,
|
||||
@RequestParam(value = "version", required = true) String version,
|
||||
@RequestParam(value = "agentId", required = false) String agentId,
|
||||
@RequestParam(value = "command", required = true) String command,
|
||||
@RequestParam(value = "arguments", required = false, defaultValue = "") String arguments) {
|
||||
|
||||
logger.info("arthas stat, ip: {}, version: {}, command: {}, arguments: {}", ip, version, command, arguments);
|
||||
logger.info("arthas stat, ip: {}, version: {}, agentId: {}, command: {}, arguments: {}", ip, version, agentId, command, arguments);
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user