Search in sources :

Example 1 with NodeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.

the class ApplicationMapBuilder method build.

public ApplicationMap build(LinkDataDuplexMap linkDataDuplexMap, final AgentInfoService agentInfoService, final ResponseHistogramBuilder mapHistogramSummary) {
    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) {
            List<ResponseTime> responseHistogram = mapHistogramSummary.getResponseTimeList(application);
            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 2 with NodeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.

the class ApplicationMapBuilder method filterAgentInfoByResponseData.

/**
     * Filters AgentInfo by whether they actually have response data.
     * For agents that do not have response data, check their status and include those that were alive.
     */
private Set<AgentInfo> filterAgentInfoByResponseData(Set<AgentInfo> agentList, long timestamp, Node node, AgentInfoService agentInfoService) {
    Set<AgentInfo> filteredAgentInfo = new HashSet<>();
    NodeHistogram nodeHistogram = node.getNodeHistogram();
    Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
    for (AgentInfo agentInfo : agentList) {
        String agentId = agentInfo.getAgentId();
        if (agentHistogramMap.containsKey(agentId)) {
            filteredAgentInfo.add(agentInfo);
        } else {
            AgentStatus status = agentInfoService.getAgentStatus(agentId, timestamp);
            agentInfo.setStatus(status);
            if (isAgentRunning(agentInfo)) {
                filteredAgentInfo.add(agentInfo);
            }
        }
    }
    return filteredAgentInfo;
}
Also used : AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) HashSet(java.util.HashSet)

Example 3 with NodeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.

the class ApplicationMapBuilder method appendNodeResponseTime.

public void appendNodeResponseTime(NodeList nodeList, LinkList linkList, NodeHistogramDataSource nodeHistogramDataSource) {
    if (nodeHistogramDataSource == null) {
        throw new NullPointerException("nodeHistogramDataSource must not be null");
    }
    final Collection<Node> nodes = nodeList.getNodeList();
    for (Node node : nodes) {
        final ServiceType nodeType = node.getServiceType();
        if (nodeType.isWas()) {
            // for WAS nodes, set their own response time histogram
            final Application wasNode = node.getApplication();
            final NodeHistogram nodeHistogram = nodeHistogramDataSource.createNodeHistogram(wasNode);
            node.setNodeHistogram(nodeHistogram);
        } else if (nodeType.isTerminal() || nodeType.isUnknown()) {
            final NodeHistogram nodeHistogram = createTerminalNodeHistogram(node, linkList);
            node.setNodeHistogram(nodeHistogram);
        } else if (nodeType.isQueue()) {
            // Virtual queue node - queues with agent installed will be handled above as a WAS node
            final NodeHistogram nodeHistogram = createTerminalNodeHistogram(node, linkList);
            node.setNodeHistogram(nodeHistogram);
        } else if (nodeType.isUser()) {
            // for User nodes, find its source link and create the histogram
            Application userNode = node.getApplication();
            final NodeHistogram nodeHistogram = new NodeHistogram(userNode, range);
            final List<Link> fromLink = linkList.findFromLink(userNode);
            if (fromLink.size() > 1) {
                // used first(0) link.
                logger.warn("Invalid from UserNode:{}", linkList.getLinkList());
            } else if (fromLink.isEmpty()) {
                logger.warn("from UserNode not found:{}", userNode);
                continue;
            }
            final Link sourceLink = fromLink.get(0);
            nodeHistogram.setApplicationHistogram(sourceLink.getHistogram());
            ApplicationTimeHistogram histogramData = sourceLink.getTargetApplicationTimeSeriesHistogramData();
            nodeHistogram.setApplicationTimeHistogram(histogramData);
            node.setNodeHistogram(nodeHistogram);
        } else {
            // dummy data
            NodeHistogram dummy = new NodeHistogram(node.getApplication(), range);
            node.setNodeHistogram(dummy);
        }
    }
}
Also used : ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) List(java.util.List) AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList) Application(com.navercorp.pinpoint.web.vo.Application)

Example 4 with NodeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram 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 5 with NodeHistogram

use of com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram in project pinpoint by naver.

the class NodeSerializer method writeHistogram.

private void writeHistogram(JsonGenerator jgen, Node node) throws IOException {
    final ServiceType serviceType = node.getServiceType();
    final NodeHistogram nodeHistogram = node.getNodeHistogram();
    // FIXME isn't this all ServiceTypes that can be a node?
    if (serviceType.isWas() || serviceType.isTerminal() || serviceType.isUnknown() || serviceType.isUser() || serviceType.isQueue()) {
        Histogram applicationHistogram = nodeHistogram.getApplicationHistogram();
        if (applicationHistogram == null) {
            writeEmptyObject(jgen, "histogram");
            // for go.js
            jgen.writeBooleanField("hasAlert", false);
        } else {
            jgen.writeObjectField("histogram", applicationHistogram);
            // for go.js
            jgen.writeNumberField("totalCount", applicationHistogram.getTotalCount());
            jgen.writeNumberField("errorCount", applicationHistogram.getTotalErrorCount());
            jgen.writeNumberField("slowCount", applicationHistogram.getSlowCount());
            if (applicationHistogram.getTotalCount() == 0) {
                // for go.js
                jgen.writeBooleanField("hasAlert", false);
            } else {
                long error = applicationHistogram.getTotalErrorCount() / applicationHistogram.getTotalCount();
                if (error * 100 > 10) {
                    // for go.js
                    jgen.writeBooleanField("hasAlert", true);
                } else {
                    // for go.js
                    jgen.writeBooleanField("hasAlert", false);
                }
            }
        }
        Map<String, Histogram> agentHistogramMap = nodeHistogram.getAgentHistogramMap();
        if (agentHistogramMap == null) {
            writeEmptyObject(jgen, "agentHistogram");
        } else {
            jgen.writeObjectField("agentHistogram", agentHistogramMap);
        }
    } else {
        // for go.js
        jgen.writeBooleanField("hasAlert", false);
    }
    // FIXME isn't this all ServiceTypes that can be a node?
    if (serviceType.isWas() || serviceType.isUser() || serviceType.isTerminal() || serviceType.isUnknown() || serviceType.isQueue()) {
        List<ResponseTimeViewModel> applicationTimeSeriesHistogram = nodeHistogram.getApplicationTimeHistogram();
        if (applicationTimeSeriesHistogram == null) {
            writeEmptyArray(jgen, "timeSeriesHistogram");
        } else {
            jgen.writeObjectField("timeSeriesHistogram", applicationTimeSeriesHistogram);
        }
        AgentResponseTimeViewModelList agentTimeSeriesHistogram = nodeHistogram.getAgentTimeHistogram();
        jgen.writeObject(agentTimeSeriesHistogram);
    }
}
Also used : Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)

Aggregations

NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)7 Application (com.navercorp.pinpoint.web.vo.Application)4 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)3 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)3 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)2 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)2 AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)2 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)2 AgentInfo (com.navercorp.pinpoint.web.vo.AgentInfo)2 ResponseTime (com.navercorp.pinpoint.web.vo.ResponseTime)2 HashSet (java.util.HashSet)2 AgentTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder)1 ApplicationTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder)1 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)1 AgentStatus (com.navercorp.pinpoint.web.vo.AgentStatus)1 HashMap (java.util.HashMap)1 List (java.util.List)1