Search in sources :

Example 1 with NodeHistogramSummary

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary 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 NodeHistogramSummary

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary 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)

Example 3 with NodeHistogramSummary

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary in project pinpoint by naver.

the class ResponseTimeHistogramServiceImpl method createEmptyNodeHistogramSummary.

private NodeHistogramSummary createEmptyNodeHistogramSummary(ServerInstanceListFactory serverInstanceListFactory, Application application, Range range) {
    ServerInstanceList serverInstanceList = serverInstanceListFactory.createEmptyNodeInstanceList();
    NodeHistogram emptyNodeHistogram = new NodeHistogram(application, range);
    return new NodeHistogramSummary(serverInstanceList, emptyNodeHistogram);
}
Also used : NodeHistogramSummary(com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)

Example 4 with NodeHistogramSummary

use of com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary in project pinpoint by naver.

the class ResponseTimeHistogramServiceImpl method selectNodeHistogramData.

@Override
public NodeHistogramSummary selectNodeHistogramData(ResponseTimeHistogramServiceOption option) {
    Node node = new Node(option.getApplication());
    ServiceType applicationServiceType = option.getApplication().getServiceType();
    List<Application> sourceApplications = option.getFromApplications();
    List<Application> destinationApplications = option.getToApplications();
    final NodeHistogramFactory nodeHistogramFactory = createNodeHistogramFactory();
    final ServerInstanceListFactory serverInstanceListFactory = createServerInstanceListFactory(option);
    if (applicationServiceType.isWas()) {
        NodeHistogram nodeHistogram = nodeHistogramFactory.createWasNodeHistogram(option.getApplication(), option.getRange());
        node.setNodeHistogram(nodeHistogram);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createWasNodeInstanceList(node, option.getRange().getTo());
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else if (applicationServiceType.isTerminal() || applicationServiceType.isUnknown() || applicationServiceType.isAlias()) {
        if (sourceApplications.isEmpty()) {
            return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
        }
        LinkDataMapProcessor destinationApplicationFilter = new DestinationApplicationFilter(option.getApplication());
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplicationFilter, LinkDataMapProcessor.NO_OP);
        LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 1, 0);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createEmptyNodeInstanceList();
        if (applicationServiceType.isTerminal() || applicationServiceType.isAlias()) {
            serverInstanceList = serverInstanceListFactory.createTerminalNodeInstanceList(node, linkDataDuplexMap);
        }
        NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
        LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
        NodeHistogram nodeHistogram = nodeHistogramFactory.createTerminalNodeHistogram(option.getApplication(), option.getRange(), linkList);
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else if (applicationServiceType.isQueue()) {
        LinkDataMapProcessor destinationApplicationFilter = new DestinationApplicationFilter(option.getApplication());
        if (sourceApplications.isEmpty()) {
            if (destinationApplications.isEmpty()) {
                return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
            }
            // Retrieve callers
            LinkDataMapProcessor applicationFilter = new ApplicationFilter(option.getApplication());
            LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, applicationFilter);
            LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 0, 2);
            LinkDataMap linkDataMap = destinationApplicationFilter.processLinkDataMap(linkDataDuplexMap.getTargetLinkDataMap(), option.getRange());
            for (LinkData linkData : linkDataMap.getLinkDataList()) {
                sourceApplications.add(linkData.getFromApplication());
            }
        }
        // Check using from applications first for caller's link data
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, destinationApplicationFilter, LinkDataMapProcessor.NO_OP);
        LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(sourceApplications, option.getRange(), 1, 0);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createQueueNodeInstanceList(node, linkDataDuplexMap);
        NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
        LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
        NodeHistogram nodeHistogram = nodeHistogramFactory.createQueueNodeHistogram(option.getApplication(), option.getRange(), linkList);
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else if (applicationServiceType.isUser()) {
        if (destinationApplications.isEmpty()) {
            return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
        }
        LinkDataMapProcessor sourceApplicationFilter = new SourceApplicationFilter(option.getApplication());
        LinkSelector linkSelector = linkSelectorFactory.createLinkSelector(LinkSelectorType.UNIDIRECTIONAL, LinkDataMapProcessor.NO_OP, sourceApplicationFilter);
        LinkDataDuplexMap linkDataDuplexMap = linkSelector.select(destinationApplications, option.getRange(), 0, 1);
        ServerInstanceList serverInstanceList = serverInstanceListFactory.createUserNodeInstanceList();
        NodeList nodeList = NodeListFactory.createNodeList(NodeType.DETAILED, linkDataDuplexMap);
        LinkList linkList = LinkListFactory.createLinkList(LinkType.DETAILED, nodeList, linkDataDuplexMap, option.getRange());
        NodeHistogram nodeHistogram = nodeHistogramFactory.createUserNodeHistogram(option.getApplication(), option.getRange(), linkList);
        return new NodeHistogramSummary(serverInstanceList, nodeHistogram);
    } else {
        return createEmptyNodeHistogramSummary(serverInstanceListFactory, option.getApplication(), option.getRange());
    }
}
Also used : SourceApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.SourceApplicationFilter) ServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInstanceListFactory) DefaultServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.DefaultServerInstanceListFactory) StatisticsServerInstanceListFactory(com.navercorp.pinpoint.web.applicationmap.appender.server.StatisticsServerInstanceListFactory) LinkData(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData) NodeHistogramSummary(com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary) Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList) NodeList(com.navercorp.pinpoint.web.applicationmap.nodes.NodeList) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) LinkSelector(com.navercorp.pinpoint.web.service.map.LinkSelector) LinkDataDuplexMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap) DestinationApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.DestinationApplicationFilter) DefaultNodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.DefaultNodeHistogramFactory) NodeHistogramFactory(com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) LinkDataMapProcessor(com.navercorp.pinpoint.web.service.map.processor.LinkDataMapProcessor) DestinationApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.DestinationApplicationFilter) SourceApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.SourceApplicationFilter) ApplicationFilter(com.navercorp.pinpoint.web.service.map.processor.ApplicationFilter) LinkList(com.navercorp.pinpoint.web.applicationmap.link.LinkList) Application(com.navercorp.pinpoint.web.vo.Application) LinkDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)

Aggregations

NodeHistogramSummary (com.navercorp.pinpoint.web.applicationmap.nodes.NodeHistogramSummary)4 Application (com.navercorp.pinpoint.web.vo.Application)3 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 ServerInstanceList (com.navercorp.pinpoint.web.applicationmap.nodes.ServerInstanceList)2 ResponseTimeHistogramServiceOption (com.navercorp.pinpoint.web.service.ResponseTimeHistogramServiceOption)2 Range (com.navercorp.pinpoint.web.vo.Range)2 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 DefaultNodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.DefaultNodeHistogramFactory)1 NodeHistogramFactory (com.navercorp.pinpoint.web.applicationmap.appender.histogram.NodeHistogramFactory)1 DefaultServerInstanceListFactory (com.navercorp.pinpoint.web.applicationmap.appender.server.DefaultServerInstanceListFactory)1 ServerInstanceListFactory (com.navercorp.pinpoint.web.applicationmap.appender.server.ServerInstanceListFactory)1 StatisticsServerInstanceListFactory (com.navercorp.pinpoint.web.applicationmap.appender.server.StatisticsServerInstanceListFactory)1 LinkList (com.navercorp.pinpoint.web.applicationmap.link.LinkList)1 Node (com.navercorp.pinpoint.web.applicationmap.nodes.Node)1 NodeList (com.navercorp.pinpoint.web.applicationmap.nodes.NodeList)1 LinkData (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkData)1 LinkDataDuplexMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataDuplexMap)1 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)1 LinkSelector (com.navercorp.pinpoint.web.service.map.LinkSelector)1 ApplicationFilter (com.navercorp.pinpoint.web.service.map.processor.ApplicationFilter)1