use of com.navercorp.pinpoint.web.vo.ResponseTime in project pinpoint by naver.
the class ApplicationMapBuilder method build.
public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, final AgentInfoService agentInfoService, final MapResponseDao mapResponseDao) {
AgentInfoPopulator agentInfoPopulator = new AgentInfoPopulator() {
@Override
public void addAgentInfos(Node node) {
ServerInstanceList serverInstanceList = getServerInstanceList(node, agentInfoService);
node.setServerInstanceList(serverInstanceList);
}
};
NodeHistogramDataSource responseSource = new NodeHistogramDataSource() {
@Override
public NodeHistogram createNodeHistogram(Application application) {
final List<ResponseTime> responseHistogram = mapResponseDao.selectResponseTime(application, range);
final NodeHistogram nodeHistogram = new NodeHistogram(application, range, responseHistogram);
return nodeHistogram;
}
};
return this.build(linkDataDuplexMap, agentInfoPopulator, responseSource);
}
use of com.navercorp.pinpoint.web.vo.ResponseTime in project pinpoint by naver.
the class ApplicationTimeHistogramBuilder method build.
public ApplicationTimeHistogram build(List<ResponseTime> responseHistogramList) {
if (responseHistogramList == null) {
throw new NullPointerException("responseHistogramList must not be null");
}
Map<Long, TimeHistogram> applicationLevelHistogram = new HashMap<>();
for (ResponseTime responseTime : responseHistogramList) {
final Long timeStamp = responseTime.getTimeStamp();
TimeHistogram timeHistogram = applicationLevelHistogram.get(timeStamp);
if (timeHistogram == null) {
timeHistogram = new TimeHistogram(application.getServiceType(), timeStamp);
applicationLevelHistogram.put(timeStamp, timeHistogram);
}
// add each agent-level data
Histogram applicationResponseHistogram = responseTime.getApplicationResponseHistogram();
timeHistogram.add(applicationResponseHistogram);
}
// Collections.sort(histogramList, TimeHistogram.TIME_STAMP_ASC_COMPARATOR);
List<TimeHistogram> histogramList = interpolation(applicationLevelHistogram.values());
if (logger.isTraceEnabled()) {
for (TimeHistogram histogram : histogramList) {
logger.trace("applicationLevel histogram:{}", histogram);
}
}
ApplicationTimeHistogram applicationTimeHistogram = new ApplicationTimeHistogram(application, range, histogramList);
return applicationTimeHistogram;
}
use of com.navercorp.pinpoint.web.vo.ResponseTime in project pinpoint by naver.
the class AgentTimeHistogramTest method createResponseTime.
private List<ResponseTime> createResponseTime(Application app, String agentName1, String agentName2) {
List<ResponseTime> responseTimeList = new ArrayList<ResponseTime>();
ResponseTime one = new ResponseTime(app.getName(), app.getServiceType(), 0);
one.addResponseTime(agentName1, (short) 1000, 1);
responseTimeList.add(one);
ResponseTime two = new ResponseTime(app.getName(), app.getServiceType(), 1000 * 60);
two.addResponseTime(agentName1, (short) 3000, 1);
responseTimeList.add(two);
ResponseTime three = new ResponseTime(app.getName(), app.getServiceType(), 0);
three.addResponseTime(agentName2, (short) 1000, 1);
responseTimeList.add(three);
ResponseTime four = new ResponseTime(app.getName(), app.getServiceType(), 1000 * 60);
four.addResponseTime(agentName2, (short) 3000, 1);
responseTimeList.add(four);
return responseTimeList;
}
use of com.navercorp.pinpoint.web.vo.ResponseTime 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.ResponseTime in project pinpoint by naver.
the class ApplicationTimeHistogramTest method createResponseTime.
private List<ResponseTime> createResponseTime(Application app) {
List<ResponseTime> responseTimeList = new ArrayList<ResponseTime>();
ResponseTime one = new ResponseTime(app.getName(), app.getServiceType(), 0);
one.addResponseTime("test", (short) 1000, 1);
responseTimeList.add(one);
ResponseTime two = new ResponseTime(app.getName(), app.getServiceType(), 1000 * 60);
two.addResponseTime("test", (short) 3000, 1);
responseTimeList.add(two);
return responseTimeList;
}
Aggregations