Search in sources :

Example 16 with ServiceType

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

the class ApplicationServerTypeProvider method get.

@Override
public ServiceType get() {
    final ServiceType applicationServiceType = getApplicationServiceType();
    logger.info("default ApplicationServerType={}", applicationServiceType);
    PluginContextLoadResult pluginContextLoadResult = this.pluginContextLoadResultProvider.get();
    List<ApplicationTypeDetector> applicationTypeDetectorList = pluginContextLoadResult.getApplicationTypeDetectorList();
    ApplicationServerTypeResolver applicationServerTypeResolver = new ApplicationServerTypeResolver(applicationTypeDetectorList, applicationServiceType, profilerConfig.getApplicationTypeDetectOrder());
    ServiceType resolve = applicationServerTypeResolver.resolve();
    logger.info("resolved ApplicationServerType={}", resolve);
    return resolve;
}
Also used : ApplicationServerTypeResolver(com.navercorp.pinpoint.profiler.util.ApplicationServerTypeResolver) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) ApplicationTypeDetector(com.navercorp.pinpoint.bootstrap.plugin.ApplicationTypeDetector) PluginContextLoadResult(com.navercorp.pinpoint.profiler.plugin.PluginContextLoadResult)

Example 17 with ServiceType

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

the class FilteredMapServiceImpl method createParentApplication.

private Application createParentApplication(SpanBo span, Map<Long, SpanBo> transactionSpanMap) {
    final SpanBo parentSpan = transactionSpanMap.get(span.getParentSpanId());
    if (span.isRoot() || parentSpan == null) {
        ServiceType spanServiceType = this.registry.findServiceType(span.getServiceType());
        if (spanServiceType.isQueue()) {
            String applicationName = span.getAcceptorHost();
            ServiceType serviceType = spanServiceType;
            return this.applicationFactory.createApplication(applicationName, serviceType);
        } else {
            String applicationName = span.getApplicationId();
            ServiceType serviceType = ServiceType.USER;
            return this.applicationFactory.createApplication(applicationName, serviceType);
        }
    } else {
        // create virtual queue node if current' span's service type is a queue AND :
        // 1. parent node's application service type is not a queue (it may have come from a queue that is traced)
        // 2. current node's application service type is not a queue (current node may be a queue that is traced)
        ServiceType spanServiceType = this.registry.findServiceType(span.getServiceType());
        if (spanServiceType.isQueue()) {
            ServiceType parentApplicationServiceType = this.registry.findServiceType(parentSpan.getApplicationServiceType());
            ServiceType spanApplicationServiceType = this.registry.findServiceType(span.getApplicationServiceType());
            if (!parentApplicationServiceType.isQueue() && !spanApplicationServiceType.isQueue()) {
                String parentApplicationName = span.getAcceptorHost();
                if (parentApplicationName == null) {
                    parentApplicationName = span.getRemoteAddr();
                }
                short parentServiceType = span.getServiceType();
                return this.applicationFactory.createApplication(parentApplicationName, parentServiceType);
            }
        }
        String parentApplicationName = parentSpan.getApplicationId();
        short parentServiceType = parentSpan.getApplicationServiceType();
        return this.applicationFactory.createApplication(parentApplicationName, parentServiceType);
    }
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) SpanBo(com.navercorp.pinpoint.common.server.bo.SpanBo)

Example 18 with ServiceType

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

the class AgentInfoSerializer method serialize.

@Override
public void serialize(AgentInfo agentInfo, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
    jgen.writeStartObject();
    jgen.writeStringField("applicationName", agentInfo.getApplicationName());
    jgen.writeStringField("agentId", agentInfo.getAgentId());
    jgen.writeNumberField("startTimestamp", agentInfo.getStartTimestamp());
    jgen.writeStringField("hostName", agentInfo.getHostName());
    jgen.writeStringField("ip", agentInfo.getIp());
    jgen.writeStringField("ports", agentInfo.getPorts());
    final ServiceType serviceType = serviceTypeRegistryService.findServiceType(agentInfo.getServiceTypeCode());
    jgen.writeStringField("serviceType", serviceType.getDesc());
    jgen.writeNumberField("pid", agentInfo.getPid());
    jgen.writeStringField("vmVersion", agentInfo.getVmVersion());
    jgen.writeStringField("agentVersion", agentInfo.getAgentVersion());
    jgen.writeObjectField("serverMetaData", agentInfo.getServerMetaData());
    jgen.writeObjectField("jvmInfo", agentInfo.getJvmInfo());
    AgentStatus status = agentInfo.getStatus();
    if (status != null) {
        jgen.writeObjectField("status", status);
    }
    jgen.writeNumberField("initialStartTimestamp", agentInfo.getInitialStartTimestamp());
    if (matcherGroupList != null) {
        jgen.writeFieldName("linkList");
        jgen.writeStartArray();
        for (MatcherGroup matcherGroup : matcherGroupList) {
            if (matcherGroup.ismatchingType(agentInfo)) {
                LinkInfo linkInfo = matcherGroup.makeLinkInfo(agentInfo);
                jgen.writeStartObject();
                jgen.writeStringField("linkName", linkInfo.getLinkName());
                jgen.writeStringField("linkURL", linkInfo.getLinkUrl());
                jgen.writeStringField("linkType", linkInfo.getLinktype());
                jgen.writeEndObject();
            }
        }
        jgen.writeEndArray();
    }
    jgen.writeEndObject();
}
Also used : AgentStatus(com.navercorp.pinpoint.web.vo.AgentStatus) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) MatcherGroup(com.navercorp.pinpoint.web.applicationmap.link.MatcherGroup) LinkInfo(com.navercorp.pinpoint.web.applicationmap.link.LinkInfo)

Example 19 with ServiceType

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

the class ApplicationAgentHostListSerializer method writeAgent.

private void writeAgent(AgentInfo agentInfo, JsonGenerator jsonGenerator) throws IOException {
    jsonGenerator.writeStringField("agentId", StringUtils.defaultString(agentInfo.getAgentId(), ""));
    final ServiceType serviceType = serviceTypeRegistryService.findServiceType(agentInfo.getServiceTypeCode());
    jsonGenerator.writeStringField("serviceType", StringUtils.defaultString(serviceType.getDesc(), ""));
    jsonGenerator.writeStringField("hostName", StringUtils.defaultString(agentInfo.getHostName(), ""));
    jsonGenerator.writeStringField("ip", StringUtils.defaultString(agentInfo.getIp(), ""));
}
Also used : ServiceType(com.navercorp.pinpoint.common.trace.ServiceType)

Example 20 with ServiceType

use of com.navercorp.pinpoint.common.trace.ServiceType 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

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