Search in sources :

Example 21 with ServiceType

use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.

the class NodeSerializer method serialize.

@Override
public void serialize(Node node, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
    jgen.writeStartObject();
    //        jgen.writeStringField("id", node.getNodeName());
    // necessary for go.js
    jgen.writeStringField("key", node.getNodeName());
    // for go.js
    jgen.writeStringField("applicationName", node.getApplicationTextName());
    // necessary for go.js
    jgen.writeStringField("category", node.getServiceType().toString());
    jgen.writeStringField("serviceType", node.getServiceType().toString());
    final ServiceType serviceType = node.getApplication().getServiceType();
    //        if (serviceType.isUser()) {
    //            jgen.writeStringField("fig", "Ellipse");
    //        } else if(serviceType.isWas()) {
    //            jgen.writeStringField("fig", "RoundedRectangle");
    //        } else {
    //            jgen.writeStringField("fig", "Rectangle");
    //        }
    jgen.writeStringField("serviceTypeCode", Short.toString(serviceType.getCode()));
    //        jgen.writeStringField("terminal", Boolean.toString(serviceType.isTerminal()));
    // for go.js
    jgen.writeBooleanField("isWas", serviceType.isWas());
    jgen.writeBooleanField("isQueue", serviceType.isQueue());
    jgen.writeBooleanField("isAuthorized", node.isAuthorized());
    writeHistogram(jgen, node);
    if (node.getServiceType().isUnknown()) {
        writeEmptyObject(jgen, "serverList");
        jgen.writeNumberField("instanceCount", 0);
    } else {
        final ServerInstanceList serverInstanceList = node.getServerInstanceList();
        if (serverInstanceList != null) {
            jgen.writeObjectField("serverList", serverInstanceList);
            jgen.writeNumberField("instanceCount", serverInstanceList.getInstanceCount());
        } else {
            writeEmptyObject(jgen, "serverList");
            jgen.writeNumberField("instanceCount", 0);
        }
    }
    jgen.writeEndObject();
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) ServerInstanceList(com.navercorp.pinpoint.web.applicationmap.ServerInstanceList)

Example 22 with ServiceType

use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.

the class LinkFilterTest method fromToFilterAgentTest.

@Test
public void fromToFilterAgentTest() {
    final ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName("TOMCAT");
    final short tomcatServiceType = tomcat.getCode();
    FilterDescriptor descriptor = new FilterDescriptor();
    descriptor.setFromApplicationName("APP_A");
    descriptor.setFromServiceType(tomcat.getName());
    descriptor.setFromAgentId("AGENT_A");
    descriptor.setToApplicationName("APP_B");
    descriptor.setToServiceType(tomcat.getName());
    descriptor.setToAgentId("AGENT_B");
    FilterHint hint = new FilterHint(Collections.<RpcHint>emptyList());
    LinkFilter linkFilter = new LinkFilter(descriptor, hint, serviceTypeRegistryService);
    logger.debug(linkFilter.toString());
    SpanBo fromSpanBo = new SpanBo();
    fromSpanBo.setApplicationId("APP_A");
    fromSpanBo.setServiceType(tomcatServiceType);
    fromSpanBo.setAgentId("AGENT_A");
    fromSpanBo.setSpanId(100);
    SpanBo toSpanBO = new SpanBo();
    toSpanBO.setApplicationId("APP_B");
    toSpanBO.setServiceType(tomcatServiceType);
    toSpanBO.setAgentId("AGENT_B");
    toSpanBO.setParentSpanId(100);
    SpanBo spanBoC = new SpanBo();
    spanBoC.setApplicationId("APP_C");
    spanBoC.setServiceType(tomcatServiceType);
    spanBoC.setAgentId("AGENT_C");
    Assert.assertTrue(linkFilter.include(Arrays.asList(fromSpanBo, toSpanBO)));
    Assert.assertFalse(linkFilter.include(Arrays.asList(fromSpanBo, spanBoC)));
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) Test(org.junit.Test)

Example 23 with ServiceType

use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.

the class LinkFilterTest method fromToFilterTest.

@Test
public void fromToFilterTest() {
    ServiceType tomcat = serviceTypeRegistryService.findServiceTypeByName("TOMCAT");
    final short tomcatServiceType = tomcat.getCode();
    FilterDescriptor descriptor = new FilterDescriptor();
    descriptor.setFromApplicationName("APP_A");
    descriptor.setFromServiceType(tomcat.getName());
    //        descriptor.setFromAgentId("AGENT_A");
    descriptor.setToApplicationName("APP_B");
    descriptor.setToServiceType(tomcat.getName());
    //        descriptor.setToAgentId("AGENT_B");
    FilterHint hint = new FilterHint(Collections.<RpcHint>emptyList());
    LinkFilter linkFilter = new LinkFilter(descriptor, hint, serviceTypeRegistryService);
    logger.debug(linkFilter.toString());
    SpanBo fromSpanBo = new SpanBo();
    fromSpanBo.setApplicationId("APP_A");
    fromSpanBo.setServiceType(tomcatServiceType);
    fromSpanBo.setAgentId("AGENT_A");
    fromSpanBo.setSpanId(100);
    SpanBo toSpanBO = new SpanBo();
    toSpanBO.setApplicationId("APP_B");
    toSpanBO.setServiceType(tomcatServiceType);
    toSpanBO.setAgentId("AGENT_B");
    toSpanBO.setParentSpanId(100);
    SpanBo spanBoC = new SpanBo();
    spanBoC.setApplicationId("APP_C");
    spanBoC.setServiceType(tomcatServiceType);
    spanBoC.setAgentId("AGENT_C");
    Assert.assertTrue(linkFilter.include(Arrays.asList(fromSpanBo, toSpanBO)));
    Assert.assertFalse(linkFilter.include(Arrays.asList(fromSpanBo, spanBoC)));
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo) Test(org.junit.Test)

Example 24 with ServiceType

use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.

the class ServerInstanceListTest method createAgentInfo.

public static AgentInfo createAgentInfo(String agentId, String hostName) {
    AgentInfoBo.Builder agentInfoBuilder = new AgentInfoBo.Builder();
    agentInfoBuilder.setAgentId(agentId);
    ServiceType serviceType = ServiceType.TEST_STAND_ALONE;
    agentInfoBuilder.setServiceTypeCode(serviceType.getCode());
    agentInfoBuilder.setHostName(hostName);
    return new AgentInfo(agentInfoBuilder.build());
}
Also used : AgentInfoBo(com.navercorp.pinpoint.common.server.bo.AgentInfoBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) AgentInfo(com.navercorp.pinpoint.web.vo.AgentInfo)

Example 25 with ServiceType

use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.

the class SpanChunkHandler method handleSimple.

@Override
public void handleSimple(TBase<?, ?> tbase) {
    try {
        final SpanChunkBo spanChunkBo = newSpanChunkBo(tbase);
        traceDao.insertSpanChunk(spanChunkBo);
        final ServiceType applicationServiceType = getApplicationServiceType(spanChunkBo);
        List<SpanEventBo> spanEventList = spanChunkBo.getSpanEventBoList();
        if (spanEventList != null) {
            if (logger.isDebugEnabled()) {
                logger.debug("SpanChunk Size:{}", spanEventList.size());
            }
            // TODO need to batch update later.
            for (SpanEventBo spanEvent : spanEventList) {
                final ServiceType spanEventType = registry.findServiceType(spanEvent.getServiceType());
                if (!spanEventType.isRecordStatistics()) {
                    continue;
                }
                // if terminal update statistics
                final int elapsed = spanEvent.getEndElapsed();
                final boolean hasException = spanEvent.hasException();
                /*
                     * save information to draw a server map based on statistics
                     */
                // save the information of caller (the spanevent that span called)
                statisticsHandler.updateCaller(spanChunkBo.getApplicationId(), applicationServiceType, spanChunkBo.getAgentId(), spanEvent.getDestinationId(), spanEventType, spanEvent.getEndPoint(), elapsed, hasException);
                // save the information of callee (the span that called spanevent)
                statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEventType, spanChunkBo.getApplicationId(), applicationServiceType, spanChunkBo.getEndPoint(), elapsed, hasException);
            }
        }
    } catch (Exception e) {
        logger.warn("SpanChunk handle error Caused:{}", e.getMessage(), e);
    }
}
Also used : SpanChunkBo(com.navercorp.pinpoint.common.server.bo.SpanChunkBo) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanEventBo(com.navercorp.pinpoint.common.server.bo.SpanEventBo)

Aggregations

ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)34 Test (org.junit.Test)5 SpanBo (com.navercorp.pinpoint.common.server.bo.SpanBo)4 SpanEventBo (com.navercorp.pinpoint.common.server.bo.SpanEventBo)4 Application (com.navercorp.pinpoint.web.vo.Application)3 HistogramSchema (com.navercorp.pinpoint.common.trace.HistogramSchema)2 NodeHistogram (com.navercorp.pinpoint.web.applicationmap.histogram.NodeHistogram)2 ResponseTimeViewModel (com.navercorp.pinpoint.web.view.ResponseTimeViewModel)2 ApplicationTypeDetector (com.navercorp.pinpoint.bootstrap.plugin.ApplicationTypeDetector)1 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)1 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)1 SpanChunkBo (com.navercorp.pinpoint.common.server.bo.SpanChunkBo)1 DefaultServiceTypeRegistryService (com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService)1 ServiceTypeRegistryService (com.navercorp.pinpoint.common.service.ServiceTypeRegistryService)1 ServiceTypeInfo (com.navercorp.pinpoint.common.trace.ServiceTypeInfo)1 ServiceTypeRegistry (com.navercorp.pinpoint.common.trace.ServiceTypeRegistry)1 TraceMetadataLoader (com.navercorp.pinpoint.common.trace.TraceMetadataLoader)1 TraceMetadataProvider (com.navercorp.pinpoint.common.trace.TraceMetadataProvider)1