Search in sources :

Example 6 with ResponseTime

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);
}
Also used : ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) Application(com.navercorp.pinpoint.web.vo.Application)

Example 7 with ResponseTime

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;
}
Also used : ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime)

Example 8 with ResponseTime

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;
}
Also used : ArrayList(java.util.ArrayList) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime)

Example 9 with ResponseTime

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());
}
Also used : AgentTimeHistogramBuilder(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder) AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) StringWriter(java.io.StringWriter) JsonFactory(com.fasterxml.jackson.core.JsonFactory) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 10 with ResponseTime

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;
}
Also used : ArrayList(java.util.ArrayList) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime)

Aggregations

ResponseTime (com.navercorp.pinpoint.web.vo.ResponseTime)12 Application (com.navercorp.pinpoint.web.vo.Application)4 Range (com.navercorp.pinpoint.web.vo.Range)3 Test (org.junit.Test)3 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)2 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 ArrayList (java.util.ArrayList)2 Cell (org.apache.hadoop.hbase.Cell)2 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 HistogramSlot (com.navercorp.pinpoint.common.trace.HistogramSlot)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)1 AgentTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder)1 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)1 ApplicationTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder)1 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)1