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 SpanHandler method insertSpanEventStat.
private void insertSpanEventStat(SpanBo span) {
final List<SpanEventBo> spanEventList = span.getSpanEventBoList();
if (CollectionUtils.isEmpty(spanEventList)) {
return;
}
final ServiceType applicationServiceType = getApplicationServiceType(span);
logger.debug("handle spanEvent 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 called span)
statisticsHandler.updateCaller(span.getApplicationId(), applicationServiceType, span.getAgentId(), spanEvent.getDestinationId(), spanEventType, spanEvent.getEndPoint(), elapsed, hasException);
// save the information of callee (the span that spanevent called)
statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEventType, span.getApplicationId(), applicationServiceType, span.getEndPoint(), elapsed, hasException);
}
}
use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.
the class SpanHandler method insertAcceptorHost.
private void insertAcceptorHost(SpanBo span) {
// save host application map
// acceptor host is set at profiler module only when the span is not the kind of root span
final String acceptorHost = span.getAcceptorHost();
if (acceptorHost == null) {
return;
}
final String spanApplicationName = span.getApplicationId();
final short applicationServiceTypeCode = getApplicationServiceType(span).getCode();
final String parentApplicationName = span.getParentApplicationId();
final short parentServiceType = span.getParentApplicationServiceType();
final ServiceType spanServiceType = registry.findServiceType(span.getServiceType());
if (spanServiceType.isQueue()) {
hostApplicationMapDao.insert(span.getEndPoint(), spanApplicationName, applicationServiceTypeCode, parentApplicationName, parentServiceType);
} else {
hostApplicationMapDao.insert(acceptorHost, spanApplicationName, applicationServiceTypeCode, parentApplicationName, parentServiceType);
}
}
use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.
the class FilteredMapServiceImpl method addNodeFromSpanEvent.
private void addNodeFromSpanEvent(SpanBo span, TimeWindow window, LinkDataDuplexMap linkDataDuplexMap, Map<Long, SpanBo> transactionSpanMap) {
/*
* add span event statistics
*/
final List<SpanEventBo> spanEventBoList = span.getSpanEventBoList();
if (CollectionUtils.isEmpty(spanEventBoList)) {
return;
}
final Application srcApplication = applicationFactory.createApplication(span.getApplicationId(), span.getApplicationServiceType());
LinkDataMap sourceLinkDataMap = linkDataDuplexMap.getSourceLinkDataMap();
for (SpanEventBo spanEvent : spanEventBoList) {
ServiceType destServiceType = registry.findServiceType(spanEvent.getServiceType());
if (!destServiceType.isRecordStatistics()) {
// internal method
continue;
}
// logic for checking acceptor
if (destServiceType.isRpcClient()) {
if (!transactionSpanMap.containsKey(spanEvent.getNextSpanId())) {
destServiceType = ServiceType.UNKNOWN;
}
}
String dest = spanEvent.getDestinationId();
if (dest == null) {
dest = "Unknown";
}
final Application destApplication = this.applicationFactory.createApplication(dest, destServiceType);
final short slotTime = getHistogramSlotTime(spanEvent, destServiceType);
// FIXME
final long spanEventTimeStamp = window.refineTimestamp(span.getStartTime() + spanEvent.getStartElapsed());
if (logger.isTraceEnabled()) {
logger.trace("spanEvent src:{} {} -> dest:{} {}", srcApplication, span.getAgentId(), destApplication, spanEvent.getEndPoint());
}
// endPoint may be null
final String destinationAgentId = StringUtils.defaultString(spanEvent.getEndPoint());
sourceLinkDataMap.addLinkData(srcApplication, span.getAgentId(), destApplication, destinationAgentId, spanEventTimeStamp, slotTime, 1);
}
}
use of com.navercorp.pinpoint.common.trace.ServiceType in project pinpoint by naver.
the class ServerInstanceSerializer method serialize.
@Override
public void serialize(ServerInstance serverInstance, JsonGenerator jgen, SerializerProvider provider) throws IOException, JsonProcessingException {
jgen.writeStartObject();
final short serviceTypeCode = serverInstance.getServiceTypeCode();
final ServiceType serviceType = serviceTypeRegistryService.findServiceType(serviceTypeCode);
jgen.writeBooleanField("hasInspector", hasInspector(serviceType));
jgen.writeStringField("name", serverInstance.getName());
jgen.writeStringField("serviceType", serviceType.getName());
jgen.writeFieldName("status");
write(serverInstance.getStatus(), jgen, provider);
jgen.writeEndObject();
}
Aggregations