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);
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class LegacyAgentStatChartCompatibilityService method selectAgentStatList.
@Override
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
if (agentId == null) {
throw new NullPointerException("agentId must not be null");
}
if (timeWindow == null) {
throw new NullPointerException("timeWindow must not be null");
}
List<SampledJvmGc> jvmGcs = sampledJvmGcDao.getSampledAgentStatList(agentId, timeWindow);
if (CollectionUtils.isNotEmpty(jvmGcs)) {
List<SampledCpuLoad> cpuLoads = sampledCpuLoadDao.getSampledAgentStatList(agentId, timeWindow);
List<SampledTransaction> transactions = sampledTransactionDao.getSampledAgentStatList(agentId, timeWindow);
List<SampledActiveTrace> activeTraces = sampledActiveTraceDao.getSampledAgentStatList(agentId, timeWindow);
LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder builder = new LegacyAgentStatChartGroup.LegacyAgentStatChartGroupBuilder(timeWindow);
builder.jvmGcs(jvmGcs);
builder.cpuLoads(cpuLoads);
builder.transactions(transactions);
builder.activeTraces(activeTraces);
return builder.build();
} else {
long scanFrom = timeWindow.getWindowRange().getFrom();
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
Range rangeToScan = new Range(scanFrom, scanTo);
List<AgentStat> agentStats = legacyAgentStatDao.getAgentStatList(agentId, rangeToScan);
LegacyAgentStatChartGroup chartGroup = new LegacyAgentStatChartGroup(timeWindow);
chartGroup.addAgentStats(agentStats);
chartGroup.buildCharts();
return chartGroup;
}
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class LegacyAgentStatChartV1Service method selectAgentStatList.
@Override
public LegacyAgentStatChartGroup selectAgentStatList(String agentId, TimeWindow timeWindow) {
if (agentId == null) {
throw new NullPointerException("agentId must not be null");
}
if (timeWindow == null) {
throw new NullPointerException("timeWindow must not be null");
}
long scanFrom = timeWindow.getWindowRange().getFrom();
long scanTo = timeWindow.getWindowRange().getTo() + timeWindow.getWindowSlotSize();
Range rangeToScan = new Range(scanFrom, scanTo);
List<AgentStat> agentStats = legacyAgentStatDao.getAgentStatList(agentId, rangeToScan);
LegacyAgentStatChartGroup chartGroup = new LegacyAgentStatChartGroup(timeWindow);
chartGroup.addAgentStats(agentStats);
chartGroup.buildCharts();
return chartGroup;
}
use of com.navercorp.pinpoint.web.vo.Range in project pinpoint by naver.
the class GcCountCheckerTest 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 = 36; i > 0; i--) {
JvmGcBo jvmGc = new JvmGcBo();
jvmGc.setGcOldCount(i);
jvmGcs.add(jvmGc);
}
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();
}
};
}
Aggregations