use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class MemoryAgentStatisticsDaoTest method simpleTest.
@Test
public void simpleTest() throws Exception {
MemoryAgentStatisticsDao dao = new MemoryAgentStatisticsDao();
for (AgentCountStatistics testData : testDataList) {
dao.insertAgentCount(testData);
}
Range range = new Range(660L, 1320L);
List<AgentCountStatistics> agentCountStatisticses = dao.selectAgentCount(range);
Assert.assertEquals(7, agentCountStatisticses.size());
range = new Range(7100L, System.currentTimeMillis());
agentCountStatisticses = dao.selectAgentCount(range);
Assert.assertEquals(30, agentCountStatisticses.size());
range = new Range(0L, System.currentTimeMillis());
agentCountStatisticses = dao.selectAgentCount(range);
Assert.assertEquals(100, agentCountStatisticses.size());
long currentTime = System.currentTimeMillis();
range = new Range(currentTime, currentTime + 100);
agentCountStatisticses = dao.selectAgentCount(range);
Assert.assertEquals(0, agentCountStatisticses.size());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class HeapUsageRateCheckerTest method before.
@BeforeClass
public static void before() {
jvmGcDao = new AgentStatDao<JvmGcBo>() {
@Override
public List<JvmGcBo> getAgentStatList(String agentId, Range range) {
List<JvmGcBo> jvmGcs = new LinkedList<>();
for (int i = 0; i < 36; i++) {
JvmGcBo jvmGcBo = new JvmGcBo();
jvmGcBo.setHeapUsed(70L);
jvmGcBo.setHeapMax(100L);
jvmGcs.add(jvmGcBo);
}
return jvmGcs;
}
@Override
public boolean agentStatExists(String agentId, Range range) {
return true;
}
};
cpuLoadDao = new AgentStatDao<CpuLoadBo>() {
@Override
public List<CpuLoadBo> getAgentStatList(String agentId, Range range) {
return Collections.emptyList();
}
@Override
public boolean agentStatExists(String agentId, Range range) {
return false;
}
};
applicationIndexDao = new ApplicationIndexDao() {
@Override
public List<Application> selectAllApplicationNames() {
throw new UnsupportedOperationException();
}
@Override
public List<String> selectAgentIds(String applicationName) {
if (SERVICE_NAME.equals(applicationName)) {
List<String> agentIds = new LinkedList<String>();
agentIds.add("local_tomcat");
return agentIds;
}
throw new IllegalArgumentException();
}
@Override
public void deleteApplicationName(String applicationName) {
throw new UnsupportedOperationException();
}
@Override
public void deleteAgentIds(Map<String, List<String>> applicationAgentIdMap) {
throw new UnsupportedOperationException();
}
@Override
public void deleteAgentId(String applicationName, String agentId) {
throw new UnsupportedOperationException();
}
};
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class LinkCallDataTest method addCallData.
@Test
public void addCallData() {
LinkKey key = new LinkKey("fromApplication", ServiceType.STAND_ALONE, "toApplication", ServiceType.STAND_ALONE);
long currentTime = System.currentTimeMillis();
LinkCallData data1 = new LinkCallData(key);
data1.addCallData(currentTime, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data1.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
logger.debug("{}", data1.getTimeHistogram().size());
Range range = new Range(currentTime, currentTime + SIX_HOURS);
TimeWindow window = new TimeWindow(range, TimeWindowDownSampler.SAMPLER);
LinkCallData data2 = new LinkCallData(key, window);
data2.addCallData(currentTime, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
data2.addCallData(currentTime + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE + ONE_MINUTE, (short) 100, 1L);
logger.debug("{}", data2.getTimeHistogram().size());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class AgentTimeHistogramTest method testViewModel.
@Test
public void testViewModel() throws IOException {
Application app = new Application("test", ServiceType.STAND_ALONE);
AgentTimeHistogramBuilder builder = new AgentTimeHistogramBuilder(app, new Range(0, 1000 * 60));
List<ResponseTime> responseHistogramList = createResponseTime(app, "test1", "test2");
AgentTimeHistogram histogram = builder.build(responseHistogramList);
List<AgentResponseTimeViewModel> viewModel = histogram.createViewModel();
logger.debug("{}", viewModel);
JsonFactory jsonFactory = mapper.getFactory();
StringWriter stringWriter = new StringWriter();
JsonGenerator jsonGenerator = jsonFactory.createGenerator(stringWriter);
jsonGenerator.writeStartObject();
for (AgentResponseTimeViewModel agentResponseTimeViewModel : viewModel) {
jsonGenerator.writeObject(agentResponseTimeViewModel);
}
jsonGenerator.writeEndObject();
jsonGenerator.flush();
jsonGenerator.close();
logger.debug(stringWriter.toString());
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class FilteredMapServiceImpl method selectApplicationMap.
@Override
public ApplicationMap selectApplicationMap(TransactionId transactionId) {
if (transactionId == null) {
throw new NullPointerException("transactionId must not be null");
}
List<TransactionId> transactionIdList = new ArrayList<>();
transactionIdList.add(transactionId);
// FIXME from,to -1
Range range = new Range(-1, -1);
return selectApplicationMap(transactionIdList, range, range, Filter.NONE);
}
Aggregations