diff --git a/pom.xml b/pom.xml index 2e2849789..fb70ca0ad 100644 --- a/pom.xml +++ b/pom.xml @@ -235,26 +235,26 @@ - - arcus - arcus-spring - 0.3.5 - - - arcus-client - arcus - - - spring-context - org.springframework - - - - - arcus - arcus-client - 1.6.2.1 - + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/java/com/nhn/hippo/web/service/RecordSetServiceImpl.java b/src/main/java/com/nhn/hippo/web/service/RecordSetServiceImpl.java index 48d3003b5..e5033c7b1 100644 --- a/src/main/java/com/nhn/hippo/web/service/RecordSetServiceImpl.java +++ b/src/main/java/com/nhn/hippo/web/service/RecordSetServiceImpl.java @@ -28,9 +28,6 @@ public class RecordSetServiceImpl implements RecordSetService { @Override public RecordSet createRecordSet(List spanAlignList, long focusTimestamp) { - // 이쪽의 sort로직을 spanAlign을 생성하는 부분에 넣어야 되나? - sortSpanAlignAnnotation(spanAlignList); - RecordSet recordSet = new RecordSet(); // focusTimeStamp 를 찾아서 마크한다. @@ -103,22 +100,6 @@ public class RecordSetServiceImpl implements RecordSetService { } } - /** - * 복사본을 생성하지 않고 원본을 그냥 소트함. - * - * @param spanAlignList - */ - private void sortSpanAlignAnnotation(List spanAlignList) { - for (SpanAlign spanAlign : spanAlignList) { - if (spanAlign.isSpan()) { - SpanBo spanBo = spanAlign.getSpanBo(); - AnnotationUtils.sortAnnotationListByKey(spanBo); - } else { - SpanEventBo spanEventBo = spanAlign.getSpanEventBo(); - AnnotationUtils.sortAnnotationListByKey(spanEventBo); - } - } - } private String getRpcArgument(SpanBo spanBo) { String rpc = spanBo.getRpc(); @@ -178,52 +159,66 @@ public class RecordSetServiceImpl implements RecordSetService { for (SpanAlign spanAlign : spanAlignList) { if (spanAlign.isSpan()) { SpanBo spanBo = spanAlign.getSpanBo(); - String method = (String) AnnotationUtils.getDisplayMethod(spanBo); String argument = getRpcArgument(spanBo); long begin = spanBo.getStartTime(); long elapsed = spanBo.getElapsed(); - ApiDescription apiDescription = null; - if (method.startsWith("API-DID not found.")) { - apiDescription = apiDescriptionParser.parse(method); - + String method = AnnotationUtils.findApiAnnotation(spanBo.getAnnotationBoList()); + if (method != null) { + ApiDescription apiDescription = apiDescriptionParser.parse(method); Record record = new Record(spanAlign.getDepth(), true, apiDescription.getSimpleMethodDescription(), argument, begin, elapsed, spanBo.getAgentId(), spanBo.getApplicationId(), spanBo.getServiceType(), null); record.setSimpleClassName(apiDescription.getSimpleClassName()); record.setFullApiDescription(method); recordList.add(record); } else { - Record record = new Record(spanAlign.getDepth(), true, "API-DID not found.", argument, begin, elapsed, spanBo.getAgentId(), spanBo.getApplicationId(), spanBo.getServiceType(), null); - record.setSimpleClassName("API-DID not found."); - record.setFullApiDescription("API-DID not found."); + AnnotationKey apiMetaDataError = AnnotationUtils.getApiMetaDataError(spanBo.getAnnotationBoList()); + Record record = new Record(spanAlign.getDepth(), true, apiMetaDataError.getValue(), argument, begin, elapsed, spanBo.getAgentId(), spanBo.getApplicationId(), spanBo.getServiceType(), null); + record.setSimpleClassName(""); + record.setFullApiDescription(""); recordList.add(record); } - - List annotationRecord = createAnnotationRecord(spanAlign.getDepth() + 1, spanBo.getAnnotationBoList()); recordList.addAll(annotationRecord); - if(spanBo.getRemoteAddr() != null) { + if (spanBo.getRemoteAddr() != null) { Record remoteAddress = createParameterRecord(spanAlign.getDepth() + 1, "REMOTE_ADDRESS", spanBo.getRemoteAddr()); recordList.add(remoteAddress); } } else { SpanEventBo spanEventBo = spanAlign.getSpanEventBo(); - String method = (String) AnnotationUtils.getDisplayMethod(spanEventBo); + String argument = getDisplayArgument(spanEventBo); - long begin = spanAlign.getSpanBo().getStartTime() + spanEventBo.getStartElapsed(); - long elapsed = spanEventBo.getEndElapsed(); + final String method = AnnotationUtils.findApiAnnotation(spanEventBo.getAnnotationBoList()); + if (method != null) { + ApiDescription apiDescription = apiDescriptionParser.parse(method); + String destinationId = spanEventBo.getDestinationId(); - ApiDescription apiDescription = apiDescriptionParser.parse(method); - String destinationId = spanEventBo.getDestinationId(); - Record record = new Record(spanAlign.getDepth(), true, apiDescription.getSimpleMethodDescription(), argument, begin, elapsed, spanEventBo.getAgentId(), spanEventBo.getDestinationId(), spanEventBo.getServiceType(), destinationId); - record.setSimpleClassName(apiDescription.getSimpleClassName()); - record.setFullApiDescription(method); + long begin = spanAlign.getSpanBo().getStartTime() + spanEventBo.getStartElapsed(); + long elapsed = spanEventBo.getEndElapsed(); + + Record record = new Record(spanAlign.getDepth(), true, apiDescription.getSimpleMethodDescription(), argument, begin, elapsed, spanEventBo.getAgentId(), spanEventBo.getDestinationId(), spanEventBo.getServiceType(), destinationId); + record.setSimpleClassName(apiDescription.getSimpleClassName()); + record.setFullApiDescription(method); + + recordList.add(record); + } else { + AnnotationKey apiMetaDataError = AnnotationUtils.getApiMetaDataError(spanEventBo.getAnnotationBoList()); + String destinationId = spanEventBo.getDestinationId(); + + long begin = spanAlign.getSpanBo().getStartTime() + spanEventBo.getStartElapsed(); + long elapsed = spanEventBo.getEndElapsed(); + + Record record = new Record(spanAlign.getDepth(), true, apiMetaDataError.getValue(), argument, begin, elapsed, spanEventBo.getAgentId(), spanEventBo.getDestinationId(), spanEventBo.getServiceType(), destinationId); + record.setSimpleClassName(""); + record.setFullApiDescription(method); + + recordList.add(record); + } - recordList.add(record); List annotationRecord = createAnnotationRecord(spanAlign.getDepth() + 1, spanEventBo.getAnnotationBoList()); recordList.addAll(annotationRecord); } diff --git a/src/main/java/com/nhn/hippo/web/service/SpanServiceImpl.java b/src/main/java/com/nhn/hippo/web/service/SpanServiceImpl.java index 36efa719c..d26c221b1 100644 --- a/src/main/java/com/nhn/hippo/web/service/SpanServiceImpl.java +++ b/src/main/java/com/nhn/hippo/web/service/SpanServiceImpl.java @@ -245,7 +245,7 @@ public class SpanServiceImpl implements SpanService { logger.info("{} Agent StartTime found:{}", agentInfoBo.getAgentId(), agentInfoBo); } catch (AgentIdNotFoundException ex) { AnnotationBo agentInfoNotFound = new AnnotationBo(); - agentInfoNotFound.setKey(AnnotationKey.API.getCode()); + agentInfoNotFound.setKey(AnnotationKey.ERROR_API_METADATA_AGENT_INFO_NOT_FOUND.getCode()); agentInfoNotFound.setValue("API-DynamicID not found. Cause:agentInfo not found. agentId:" + ex.getAgentId() + " startTime:" + ex.getStartTime()); annotationBoList.add(agentInfoNotFound); return; @@ -256,8 +256,8 @@ public class SpanServiceImpl implements SpanService { int size = apiMetaDataList.size(); if (size == 0) { AnnotationBo api = new AnnotationBo(); - api.setKey(AnnotationKey.API.getCode()); - api.setValue("API-DID not found. api:" + apiId); + api.setKey(AnnotationKey.ERROR_API_METADATA_NOT_FOUND.getCode()); + api.setValue("API-DynamicID not found. api:" + apiId); annotationBoList.add(api); } else if (size == 1) { ApiMetaDataBo apiMetaDataBo = apiMetaDataList.get(0); @@ -281,7 +281,7 @@ public class SpanServiceImpl implements SpanService { annotationBoList.add(apiAnnotation); } else { AnnotationBo apiAnnotation = new AnnotationBo(); - apiAnnotation.setKey(AnnotationKey.API.getCode()); + apiAnnotation.setKey(AnnotationKey.ERROR_API_METADATA_DID_COLLSION.getCode()); String collisonMessage = collisionApiDidMessage(apiId, apiMetaDataList); apiAnnotation.setValue(collisonMessage); annotationBoList.add(apiAnnotation); @@ -298,7 +298,7 @@ public class SpanServiceImpl implements SpanService { return null; } AnnotationBo identifierCheckFail = new AnnotationBo(); - identifierCheckFail.setKey(AnnotationKey.API.getCode()); + identifierCheckFail.setKey(AnnotationKey.ERROR_API_METADATA_IDENTIFIER_CHECK_ERROR.getCode()); identifierCheckFail.setValue("invalid ApiMetaInfo:" + apiMetaDataBo); return identifierCheckFail; } @@ -375,9 +375,6 @@ public class SpanServiceImpl implements SpanService { SpanAligner2 spanAligner = new SpanAligner2(spans); return spanAligner.sort(); - /* - * SpanAligner spanAligner = new SpanAligner(spans); List sort = spanAligner.sort(); if (sort.size() != spans.size()) { // TODO 중간 노드 데이터 분실 ? 혹은 잘못된 데이터 생성? logger.warn("span node not complete! spans:{}, sort{}", spans, sort); } SpanPopulator spanPopulator = new SpanPopulator(sort); List populatedList = spanPopulator.populateSpanEvent(); return populatedList; - */ } @Override