Search in sources :

Example 6 with AgentHistogram

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram 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 7 with AgentHistogram

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.

the class LinkSerializer method writeAgentResponseStatistics.

private void writeAgentResponseStatistics(String fieldName, AgentHistogramList agentHistogramList, JsonGenerator jgen) throws IOException {
    jgen.writeFieldName(fieldName);
    jgen.writeStartObject();
    for (AgentHistogram agentHistogram : agentHistogramList.getAgentHistogramList()) {
        jgen.writeFieldName(agentHistogram.getId());
        jgen.writeObject(ResponseTimeStatics.fromHistogram(agentHistogram.getHistogram()));
    }
    jgen.writeEndObject();
}
Also used : AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)

Example 8 with AgentHistogram

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.

the class LinkSerializerTest method testSerialize.

@Test
public void testSerialize() throws JsonProcessingException {
    AgentHistogramList list = new AgentHistogramList();
    AgentHistogram histogram = new AgentHistogram(new Application("test", ServiceType.STAND_ALONE));
    list.addAgentHistogram(histogram);
    Node node1 = new Node(new Application("test1", ServiceType.STAND_ALONE));
    Node node2 = new Node(new Application("test1", ServiceType.STAND_ALONE));
    Link link = new Link(CreateType.Source, node1, node2, Range.newRange(0, 1));
    ObjectWriter objectWriter = MAPPER.writerWithDefaultPrettyPrinter();
    String s = objectWriter.writeValueAsString(link);
    logger.debug(s);
}
Also used : Node(com.navercorp.pinpoint.web.applicationmap.nodes.Node) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList) Application(com.navercorp.pinpoint.web.vo.Application) Link(com.navercorp.pinpoint.web.applicationmap.link.Link) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) Test(org.junit.Test)

Example 9 with AgentHistogram

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.

the class DefaultNodeHistogramFactory method createTerminalNodeHistogram.

@Override
public NodeHistogram createTerminalNodeHistogram(Application terminalApplication, Range range, LinkList linkList) {
    // for Terminal nodes, add all links pointing to the application and create the histogram
    final NodeHistogram nodeHistogram = new NodeHistogram(terminalApplication, range);
    // create applicationHistogram
    final List<Link> toLinkList = linkList.findToLink(terminalApplication);
    final Histogram applicationHistogram = new Histogram(terminalApplication.getServiceType());
    for (Link link : toLinkList) {
        applicationHistogram.add(link.getHistogram());
    }
    nodeHistogram.setApplicationHistogram(applicationHistogram);
    // create applicationTimeHistogram
    LinkCallDataMap linkCallDataMap = new LinkCallDataMap();
    for (Link link : toLinkList) {
        LinkCallDataMap sourceLinkCallDataMap = link.getSourceLinkCallDataMap();
        linkCallDataMap.addLinkDataMap(sourceLinkCallDataMap);
    }
    ApplicationTimeHistogramBuilder builder = new ApplicationTimeHistogramBuilder(terminalApplication, range);
    ApplicationTimeHistogram applicationTimeHistogram = builder.build(linkCallDataMap.getLinkDataList());
    nodeHistogram.setApplicationTimeHistogram(applicationTimeHistogram);
    // for Terminal nodes, create AgentLevel histogram
    if (terminalApplication.getServiceType().isTerminal() || terminalApplication.getServiceType().isAlias()) {
        LinkCallDataMap mergeSource = new LinkCallDataMap();
        final Map<String, Histogram> agentHistogramMap = new HashMap<>();
        for (Link link : toLinkList) {
            LinkCallDataMap sourceLinkCallDataMap = link.getSourceLinkCallDataMap();
            mergeSource.addLinkDataMap(sourceLinkCallDataMap);
            AgentHistogramList targetList = sourceLinkCallDataMap.getTargetList();
            for (AgentHistogram histogram : targetList.getAgentHistogramList()) {
                Histogram find = agentHistogramMap.get(histogram.getId());
                if (find == null) {
                    find = new Histogram(histogram.getServiceType());
                    agentHistogramMap.put(histogram.getId(), find);
                }
                find.add(histogram.getHistogram());
            }
            nodeHistogram.setAgentHistogramMap(agentHistogramMap);
        }
        AgentTimeHistogramBuilder agentTimeBuilder = new AgentTimeHistogramBuilder(terminalApplication, range);
        AgentTimeHistogram agentTimeHistogram = agentTimeBuilder.buildTarget(mergeSource);
        nodeHistogram.setAgentTimeHistogram(agentTimeHistogram);
    }
    return nodeHistogram;
}
Also used : AgentTimeHistogramBuilder(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder) Histogram(com.navercorp.pinpoint.web.applicationmap.histogram.Histogram) ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) ApplicationTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram) AgentTimeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram) ApplicationTimeHistogramBuilder(com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder) HashMap(java.util.HashMap) LinkCallDataMap(com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap) NodeHistogram(com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram) AgentHistogramList(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList) Link(com.navercorp.pinpoint.web.applicationmap.link.Link)

Example 10 with AgentHistogram

use of com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram in project pinpoint by naver.

the class ServerBuilder method buildLogicalServer.

/**
 * filled with application information of physical server and service instance
 *
 * @param hostHistogram
 */
public ServerInstanceList buildLogicalServer(final AgentHistogramList hostHistogram) {
    ServerInstanceList serverInstanceList = new ServerInstanceList();
    for (AgentHistogram agentHistogram : hostHistogram.getAgentHistogramList()) {
        final String instanceName = agentHistogram.getId();
        final String hostName = getHostName(agentHistogram.getId());
        final ServiceType serviceType = agentHistogram.getServiceType();
        final ServerInstance serverInstance = new ServerInstance(hostName, instanceName, serviceType.getCode());
        serverInstanceList.addServerInstance(serverInstance);
    }
    return serverInstanceList;
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) AgentHistogram(com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)

Aggregations

AgentHistogram (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogram)10 Application (com.navercorp.pinpoint.web.vo.Application)5 AgentHistogramList (com.navercorp.pinpoint.web.applicationmap.rawdata.AgentHistogramList)4 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)2 AgentTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogram)2 AgentTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.AgentTimeHistogramBuilder)2 ApplicationTimeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogram)2 ApplicationTimeHistogramBuilder (com.navercorp.pinpoint.web.applicationmap.histogram.ApplicationTimeHistogramBuilder)2 Histogram (com.navercorp.pinpoint.web.applicationmap.histogram.Histogram)2 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 Link (com.navercorp.pinpoint.web.applicationmap.link.Link)2 LinkCallDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkCallDataMap)2 AgentResponseTimeViewModel (com.navercorp.pinpoint.web.view.AgentResponseTimeViewModel)2 HashMap (java.util.HashMap)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 Node (com.navercorp.pinpoint.web.applicationmap.nodes.Node)1 Test (org.junit.Test)1