Search in sources :

Example 6 with TActiveThreadLightDump

use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.

the class AgentActiveThreadDumpFactory method create2.

public AgentActiveThreadDumpList create2(List<TActiveThreadLightDump> tActiveThreadLightDumpList) {
    if (CollectionUtils.isEmpty(tActiveThreadLightDumpList)) {
        return AgentActiveThreadDumpList.EMPTY_INSTANCE;
    }
    AgentActiveThreadDumpList result = new AgentActiveThreadDumpList(tActiveThreadLightDumpList.size());
    for (TActiveThreadLightDump activeThreadLightDump : tActiveThreadLightDumpList) {
        try {
            AgentActiveThreadDump agentActiveThreadDump = create2(activeThreadLightDump);
            result.add(agentActiveThreadDump);
        } catch (Exception e) {
            logger.warn("create AgentActiveThreadDump fail. arguments(TActiveThreadDump:{})", activeThreadLightDump);
        }
    }
    return result;
}
Also used : TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)

Example 7 with TActiveThreadLightDump

use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.

the class AgentActiveThreadDumpListTest method createThreadLightDumpList.

private AgentActiveThreadDumpList createThreadLightDumpList(Thread[] threads) {
    List<TActiveThreadLightDump> activeThreadLightDumpList = new ArrayList<>();
    for (Thread thread : threads) {
        TActiveThreadLightDump tActiveThreadDump = new TActiveThreadLightDump();
        tActiveThreadDump.setStartTime(System.currentTimeMillis() - ThreadLocalRandom.current().nextLong(100000));
        tActiveThreadDump.setThreadDump(createTThreadLightDump(thread));
        activeThreadLightDumpList.add(tActiveThreadDump);
    }
    AgentActiveThreadDumpFactory factory = new AgentActiveThreadDumpFactory();
    return factory.create2(activeThreadLightDumpList);
}
Also used : ArrayList(java.util.ArrayList) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)

Example 8 with TActiveThreadLightDump

use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.

the class ActiveThreadLightDumpService method requestCommandService.

@Override
public TBase<?, ?> requestCommandService(TBase tBase) {
    TCmdActiveThreadLightDump request = (TCmdActiveThreadLightDump) tBase;
    List<TActiveThreadLightDump> activeThreadDumpList = getActiveThreadDumpList(request);
    TCmdActiveThreadLightDumpRes response = new TCmdActiveThreadLightDumpRes();
    response.setType("JAVA");
    response.setSubType(JvmUtils.getType().name());
    response.setVersion(JvmUtils.getVersion().name());
    response.setThreadDumps(activeThreadDumpList);
    return response;
}
Also used : TCmdActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump) TCmdActiveThreadLightDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)

Example 9 with TActiveThreadLightDump

use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.

the class ActiveThreadLightDumpService method getTActiveThreadDumpList.

private List<TActiveThreadLightDump> getTActiveThreadDumpList(TCmdActiveThreadLightDump request, int limit, List<ActiveTraceInfo> activeTraceInfoList) {
    int targetThreadNameListSize = request.getThreadNameListSize();
    int localTraceIdListSize = request.getLocalTraceIdListSize();
    boolean filterEnable = (targetThreadNameListSize + localTraceIdListSize) > 0;
    List<TActiveThreadLightDump> activeThreadDumpList = new ArrayList<TActiveThreadLightDump>(Math.min(limit, activeTraceInfoList.size()));
    if (filterEnable) {
        for (ActiveTraceInfo activeTraceInfo : activeTraceInfoList) {
            if (!ActiveThreadDumpUtils.isTraceThread(activeTraceInfo, request.getThreadNameList(), request.getLocalTraceIdList())) {
                continue;
            }
            TActiveThreadLightDump activeThreadDump = createActiveLightThreadDump(activeTraceInfo);
            if (activeThreadDump != null) {
                if (limit > activeThreadDumpList.size()) {
                    activeThreadDumpList.add(activeThreadDump);
                }
            }
        }
    } else {
        for (ActiveTraceInfo activeTraceInfo : activeTraceInfoList) {
            TActiveThreadLightDump activeThreadDump = createActiveLightThreadDump(activeTraceInfo);
            if (activeThreadDump != null) {
                if (limit > activeThreadDumpList.size()) {
                    activeThreadDumpList.add(activeThreadDump);
                }
            }
        }
    }
    return activeThreadDumpList;
}
Also used : ArrayList(java.util.ArrayList) ActiveTraceInfo(com.navercorp.pinpoint.profiler.context.active.ActiveTraceInfo) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)

Example 10 with TActiveThreadLightDump

use of com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump in project pinpoint by naver.

the class ActiveThreadLightDumpServiceTest method basicFunctionTest5.

@Test
public void basicFunctionTest5() throws Exception {
    List<WaitingJob> waitingJobList = this.waitingJobListFactory.createList(CREATE_SIZE, JOB_TIMEOUT);
    List<ActiveTraceSnapshot> activeTraceInfoList = createMockActiveTraceInfoList(CREATE_SIZE, DEFAULT_TIME_MILLIS, TIME_DIFF_INTERVAL, waitingJobList);
    int limit = 3;
    List<Long> oldTimeList = getOldTimeList(limit);
    TCmdActiveThreadLightDump tCmdActiveThreadDump = createRequest(limit, null, null);
    ActiveThreadLightDumpService service = createService(activeTraceInfoList);
    TCmdActiveThreadLightDumpRes response = (TCmdActiveThreadLightDumpRes) service.requestCommandService(tCmdActiveThreadDump);
    Assert.assertEquals(limit, response.getThreadDumpsSize());
    for (TActiveThreadLightDump dump : response.getThreadDumps()) {
        Assert.assertTrue(oldTimeList.contains(dump.getStartTime()));
    }
}
Also used : TCmdActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump) TCmdActiveThreadLightDumpRes(com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes) UnsampledActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot) ActiveTraceSnapshot(com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot) TActiveThreadLightDump(com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump) Test(org.junit.Test)

Aggregations

TActiveThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TActiveThreadLightDump)12 TCmdActiveThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDump)5 TCmdActiveThreadLightDumpRes (com.navercorp.pinpoint.thrift.dto.command.TCmdActiveThreadLightDumpRes)5 ArrayList (java.util.ArrayList)3 ActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.ActiveTraceSnapshot)2 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)2 AgentActiveThreadDumpFactory (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpFactory)2 AgentActiveThreadDumpList (com.navercorp.pinpoint.web.vo.AgentActiveThreadDumpList)2 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)2 TException (org.apache.thrift.TException)2 ActiveTraceInfo (com.navercorp.pinpoint.profiler.context.active.ActiveTraceInfo)1 UnsampledActiveTraceSnapshot (com.navercorp.pinpoint.profiler.context.active.UnsampledActiveTraceSnapshot)1 TThreadLightDump (com.navercorp.pinpoint.thrift.dto.command.TThreadLightDump)1 CodeResult (com.navercorp.pinpoint.web.vo.CodeResult)1 ThreadInfo (java.lang.management.ThreadInfo)1 Test (org.junit.Test)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1