Search in sources :

Example 1 with ResponseTimeHistogramServiceOption

use of com.navercorp.pinpoint.web.service.ResponseTimeHistogramServiceOption in project pinpoint by naver.

the class MapController method getResponseTimeHistogramDataV2.

@GetMapping(value = "/getResponseTimeHistogramDataV2")
public NodeHistogramSummary getResponseTimeHistogramDataV2(@RequestParam("applicationName") String applicationName, @RequestParam("serviceTypeCode") Short serviceTypeCode, @RequestParam("from") long from, @RequestParam("to") long to, @RequestParam(value = "fromApplicationNames", defaultValue = "", required = false) List<String> fromApplicationNames, @RequestParam(value = "fromServiceTypeCodes", defaultValue = "", required = false) List<Short> fromServiceTypeCodes, @RequestParam(value = "toApplicationNames", defaultValue = "", required = false) List<String> toApplicationNames, @RequestParam(value = "toServiceTypeCodes", defaultValue = "", required = false) List<Short> toServiceTypeCodes, @RequestParam(value = "useStatisticsAgentState", defaultValue = "false", required = false) boolean useStatisticsAgentState, @RequestParam(value = "useLoadHistogramFormat", defaultValue = "false", required = false) boolean useLoadHistogramFormat) {
    final Range range = Range.newRange(from, to);
    dateLimit.limit(range);
    if (fromApplicationNames.size() != fromServiceTypeCodes.size()) {
        throw new IllegalArgumentException("fromApplicationNames and fromServiceTypeCodes must have the same number of elements");
    }
    if (toApplicationNames.size() != toServiceTypeCodes.size()) {
        throw new IllegalArgumentException("toApplicationNames and toServiceTypeCodes must have the same number of elements");
    }
    Application application = applicationFactory.createApplication(applicationName, serviceTypeCode);
    List<Application> fromApplications = new ArrayList<>(fromApplicationNames.size());
    for (int i = 0; i < fromApplicationNames.size(); i++) {
        Application fromApplication = applicationFactory.createApplication(fromApplicationNames.get(i), fromServiceTypeCodes.get(i));
        fromApplications.add(fromApplication);
    }
    List<Application> toApplications = new ArrayList<>(toApplicationNames.size());
    for (int i = 0; i < toApplicationNames.size(); i++) {
        Application toApplication = applicationFactory.createApplication(toApplicationNames.get(i), toServiceTypeCodes.get(i));
        toApplications.add(toApplication);
    }
    final ResponseTimeHistogramServiceOption option = new ResponseTimeHistogramServiceOption.Builder(application, range, fromApplications, toApplications).setUseStatisticsAgentState(useStatisticsAgentState).build();
    final NodeHistogramSummary nodeHistogramSummary = responseTimeHistogramService.selectNodeHistogramData(option);
    if (useLoadHistogramFormat) {
        nodeHistogramSummary.setTimeHistogramFormat(TimeHistogramFormat.V2);
    }
    return nodeHistogramSummary;
}
Also used : NodeHistogramSummary(com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary) ArrayList(java.util.ArrayList) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeHistogramServiceOption(com.navercorp.pinpoint.web.service.ResponseTimeHistogramServiceOption) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with ResponseTimeHistogramServiceOption

use of com.navercorp.pinpoint.web.service.ResponseTimeHistogramServiceOption in project pinpoint by naver.

the class MapController method postResponseTimeHistogramDataV2.

@PostMapping(value = "/getResponseTimeHistogramDataV2")
public NodeHistogramSummary postResponseTimeHistogramDataV2(@RequestParam("applicationName") String applicationName, @RequestParam("serviceTypeCode") Short serviceTypeCode, @RequestParam("from") long from, @RequestParam("to") long to, @RequestBody ApplicationPairs applicationPairs, @RequestParam(value = "useStatisticsAgentState", defaultValue = "false", required = false) boolean useStatisticsAgentState, @RequestParam(value = "useLoadHistogramFormat", defaultValue = "false", required = false) boolean useLoadHistogramFormat) {
    final Range range = Range.newRange(from, to);
    dateLimit.limit(range);
    Application application = applicationFactory.createApplication(applicationName, serviceTypeCode);
    List<Application> fromApplications = mapApplicationPairsToApplications(applicationPairs.getFromApplications());
    List<Application> toApplications = mapApplicationPairsToApplications(applicationPairs.getToApplications());
    final ResponseTimeHistogramServiceOption option = new ResponseTimeHistogramServiceOption.Builder(application, range, fromApplications, toApplications).setUseStatisticsAgentState(useStatisticsAgentState).build();
    final NodeHistogramSummary nodeHistogramSummary = responseTimeHistogramService.selectNodeHistogramData(option);
    if (useLoadHistogramFormat) {
        nodeHistogramSummary.setTimeHistogramFormat(TimeHistogramFormat.V2);
    }
    return nodeHistogramSummary;
}
Also used : NodeHistogramSummary(com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary) Range(com.navercorp.pinpoint.web.vo.Range) Application(com.navercorp.pinpoint.web.vo.Application) ResponseTimeHistogramServiceOption(com.navercorp.pinpoint.web.service.ResponseTimeHistogramServiceOption) PostMapping(org.springframework.web.bind.annotation.PostMapping)

Aggregations

NodeHistogramSummary (com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary)2 ResponseTimeHistogramServiceOption (com.navercorp.pinpoint.web.service.ResponseTimeHistogramServiceOption)2 Application (com.navercorp.pinpoint.web.vo.Application)2 Range (com.navercorp.pinpoint.web.vo.Range)2 ArrayList (java.util.ArrayList)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 PostMapping (org.springframework.web.bind.annotation.PostMapping)1