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;
}
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);
}
}
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();
}
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(), ""));
}
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);
}
}
Aggregations