use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump in project pinpoint by naver.
the class AgentActiveThreadDumpListSerializerTest method createThreadDumpList.
private AgentActiveThreadDumpList createThreadDumpList(ThreadInfo[] allThreadInfo) {
List<TActiveThreadDump> activeThreadDumpList = new ArrayList<>();
for (ThreadInfo threadInfo : allThreadInfo) {
TActiveThreadDump tActiveThreadDump = new TActiveThreadDump();
tActiveThreadDump.setStartTime(System.currentTimeMillis() - 1000);
final ThreadDumpMetricSnapshot threadDumpMetricSnapshot = ThreadDumpUtils.createThreadDump(threadInfo);
final TThreadDump threadDump = this.threadDumpThriftMessageConverter.toMessage(threadDumpMetricSnapshot);
tActiveThreadDump.setThreadDump(threadDump);
activeThreadDumpList.add(tActiveThreadDump);
}
AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
return factory.create1(activeThreadDumpList);
}
use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump in project pinpoint by naver.
the class CommandGrpcToThriftMessageConverter method buildTActiveThreadDump.
private TActiveThreadDump buildTActiveThreadDump(PActiveThreadDump pActiveThreadDump) {
TActiveThreadDump tActiveThreadDump = new TActiveThreadDump();
tActiveThreadDump.setStartTime(pActiveThreadDump.getStartTime());
tActiveThreadDump.setSampled(pActiveThreadDump.getSampled());
if (pActiveThreadDump.getSampled()) {
tActiveThreadDump.setLocalTraceId(pActiveThreadDump.getLocalTraceId());
tActiveThreadDump.setTransactionId(pActiveThreadDump.getTransactionId());
tActiveThreadDump.setEntryPoint(pActiveThreadDump.getEntryPoint());
}
tActiveThreadDump.setThreadDump(buildTThreadDump(pActiveThreadDump.getThreadDump()));
return tActiveThreadDump;
}
use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadDump in project pinpoint by naver.
the class AgentCommandController method getActiveThreadDump.
@GetMapping(value = "/activeThreadDump")
public CodeResult getActiveThreadDump(@RequestParam(value = "applicationName") String applicationName, @RequestParam(value = "agentId") String agentId, @RequestParam(value = "limit", required = false, defaultValue = "-1") int limit, @RequestParam(value = "threadName", required = false) String[] threadNameList, @RequestParam(value = "localTraceId", required = false) Long[] localTraceIdList) throws TException {
if (!webProperties.isEnableActiveThreadDump()) {
return new CodeResult(CODE_FAIL, "Disable activeThreadDump option. 'config.enable.activeThreadDump=false'");
}
AgentInfo agentInfo = agentService.getAgentInfo(applicationName, agentId);
if (agentInfo == null) {
return new CodeResult(CODE_FAIL, String.format("Can't find suitable Agent(%s/%s)", applicationName, agentId));
}
TCmdActiveThreadDump threadDump = new TCmdActiveThreadDump();
if (limit > 0) {
threadDump.setLimit(limit);
}
if (threadNameList != null) {
threadDump.setThreadNameList(Arrays.asList(threadNameList));
}
if (localTraceIdList != null) {
threadDump.setLocalTraceIdList(Arrays.asList(localTraceIdList));
}
try {
PinpointRouteResponse pinpointRouteResponse = agentService.invoke(agentInfo, threadDump);
if (isSuccessResponse(pinpointRouteResponse)) {
TBase<?, ?> result = pinpointRouteResponse.getResponse();
if (result instanceof TCmdActiveThreadDumpRes) {
TCmdActiveThreadDumpRes activeThreadDumpResponse = (TCmdActiveThreadDumpRes) result;
List<TActiveThreadDump> activeThreadDumps = activeThreadDumpResponse.getThreadDumps();
AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
AgentActiveThreadDumpList activeThreadDumpList = factory.create1(activeThreadDumps);
Map<String, Object> responseData = createResponseData(activeThreadDumpList, activeThreadDumpResponse.getType(), activeThreadDumpResponse.getSubType(), activeThreadDumpResponse.getVersion());
return new CodeResult(CODE_SUCCESS, responseData);
}
}
return handleFailedResponse(pinpointRouteResponse);
} catch (TException e) {
return new CodeResult(CODE_FAIL, e.getMessage());
}
}
Aggregations