Search in sources :

Example 1 with AgentResponseTimeViewModel

use of com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel in project pinpoint by naver.

the class AgentTimeHistogram method createAgentResponseTimeViewModel.

private AgentResponseTimeViewModel createAgentResponseTimeViewModel(Application agentName, List<TimeHistogram> timeHistogramList) {
    List<ResponseTimeViewModel> responseTimeViewModel = createResponseTimeViewModel(timeHistogramList);
    AgentResponseTimeViewModel agentResponseTimeViewModel = new AgentResponseTimeViewModel(agentName, responseTimeViewModel);
    return agentResponseTimeViewModel;
}
Also used : AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) ResponseTimeViewModel(com.navercorp.pinpoint.web.view.ResponseTimeViewModel)

Example 2 with AgentResponseTimeViewModel

use of com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel in project pinpoint by naver.

the class AgentTimeHistogram method createViewModel.

public List<AgentResponseTimeViewModel> createViewModel(TimeHistogramFormat timeHistogramFormat) {
    final List<AgentResponseTimeViewModel> result = new ArrayList<>();
    for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
        Application agentId = agentHistogram.getAgentId();
        List<TimeHistogram> timeList = sortTimeHistogram(agentHistogram.getTimeHistogram());
        AgentResponseTimeViewModel model = createAgentResponseTimeViewModel(agentId, timeList, timeHistogramFormat);
        result.add(model);
    }
    result.sort(Comparator.comparing(AgentResponseTimeViewModel::getAgentName));
    return result;
}
Also used : AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) Application(com.navercorp.pinpoint.web.vo.Application) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)

Example 3 with AgentResponseTimeViewModel

use of com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel 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, Range.newRange(0, 1000 * 60));
    List<ResponseTime> responseHistogramList = createResponseTime(app, "test1", "test2");
    AgentTimeHistogram histogram = builder.build(responseHistogramList);
    List<AgentResponseTimeViewModel> viewModel = histogram.createViewModel(TimeHistogramFormat.V1);
    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 : 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) Application(com.navercorp.pinpoint.web.vo.Application) Test(org.junit.Test)

Example 4 with AgentResponseTimeViewModel

use of com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel in project pinpoint by naver.

the class AgentTimeHistogram method createViewModel.

public List<AgentResponseTimeViewModel> createViewModel() {
    final List<AgentResponseTimeViewModel> result = new ArrayList<>();
    for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
        Application agentId = agentHistogram.getAgentId();
        List<TimeHistogram> timeList = sortTimeHistogram(agentHistogram.getTimeHistogram());
        AgentResponseTimeViewModel model = createAgentResponseTimeViewModel(agentId, timeList);
        result.add(model);
    }
    Collections.sort(result, new Comparator<AgentResponseTimeViewModel>() {

        @Override
        public int compare(AgentResponseTimeViewModel o1, AgentResponseTimeViewModel o2) {
            return o1.getAgentName().compareTo(o2.getAgentName());
        }
    });
    return result;
}
Also used : AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) Application(com.navercorp.pinpoint.web.vo.Application) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)

Example 5 with AgentResponseTimeViewModel

use of com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel in project pinpoint by naver.

the class AgentTimeHistogram method createAgentResponseTimeViewModel.

private AgentResponseTimeViewModel createAgentResponseTimeViewModel(Application agentName, List<TimeHistogram> timeHistogramList, TimeHistogramFormat timeHistogramFormat) {
    List<TimeViewModel> responseTimeViewModel = createResponseTimeViewModel(timeHistogramList, timeHistogramFormat);
    AgentResponseTimeViewModel agentResponseTimeViewModel = new AgentResponseTimeViewModel(agentName, responseTimeViewModel);
    return agentResponseTimeViewModel;
}
Also used : AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel) TimeViewModel(com.navercorp.pinpoint.web.view.TimeViewModel) AgentResponseTimeViewModel(com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel)

Aggregations

AgentResponseTimeViewModel (com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel)5 Application (com.navercorp.pinpoint.web.vo.Application)3 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)2 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 ResponseTimeViewModel (com.navercorp.pinpoint.web.view.ResponseTimeViewModel)1 TimeViewModel (com.navercorp.pinpoint.web.view.TimeViewModel)1 ResponseTime (com.navercorp.pinpoint.web.vo.ResponseTime)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1