Search in sources :

Example 6 with AgentCountStatistics

use of com.navercorp.pinpoint.web.vo.AgentCountStatistics in project pinpoint by naver.

the class MemoryAgentStatisticsDaoTest method createTestData.

private static List<AgentCountStatistics> createTestData(int size) {
    List<AgentCountStatistics> data = new ArrayList<>(size);
    for (int i = 0; i < size; i++) {
        AgentCountStatistics agentCountStatistics = new AgentCountStatistics(ThreadLocalRandom.current().nextInt(0, Integer.MAX_VALUE), (i * 100) + 100);
        data.add(agentCountStatistics);
    }
    return data;
}
Also used : ArrayList(java.util.ArrayList) AgentCountStatistics(com.navercorp.pinpoint.web.vo.AgentCountStatistics)

Example 7 with AgentCountStatistics

use of com.navercorp.pinpoint.web.vo.AgentCountStatistics in project pinpoint by naver.

the class AgentCountWriter method write.

@Override
public void write(List<? extends AgentCountStatistics> items) throws Exception {
    if (items.size() == 1) {
        AgentCountStatistics agentCountStatistics = items.get(0);
        if (agentCountStatistics == null || agentCountStatistics.getAgentCount() < 0) {
            throw new JobExecutionException("Bad parameter");
        }
        boolean success = agentStatisticsDao.insertAgentCount(agentCountStatistics);
        if (!success) {
            throw new JobExecutionException("insert AgentCount failed.");
        }
    } else {
        throw new JobExecutionException("Bad parameter");
    }
}
Also used : JobExecutionException(org.springframework.batch.core.JobExecutionException) AgentCountStatistics(com.navercorp.pinpoint.web.vo.AgentCountStatistics)

Aggregations

AgentCountStatistics (com.navercorp.pinpoint.web.vo.AgentCountStatistics)7 Range (com.navercorp.pinpoint.web.vo.Range)2 ArrayList (java.util.ArrayList)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TreeMap (java.util.TreeMap)1 Test (org.junit.Test)1 JobExecutionException (org.springframework.batch.core.JobExecutionException)1