From 4e4813e6bde70df5674d2e7b6fffbb9bddc83851 Mon Sep 17 00:00:00 2001 From: Woonduk Kang Date: Wed, 20 Mar 2013 07:27:58 +0000 Subject: [PATCH] =?UTF-8?q?[=EA=B0=95=EC=9A=B4=EB=8D=95]=20[LUCYSUS-1744]?= =?UTF-8?q?=20API-ID=EC=9D=98=20=EC=98=88=EC=99=B8=20=EC=BC=80=EC=9D=B4?= =?UTF-8?q?=EC=8A=A4=20=EC=B2=98=EB=A6=AC=20=EA=B0=95=ED=99=94,=20?= =?UTF-8?q?=EB=B3=84=EB=8F=84=20error=EC=BD=94=EB=93=9C=EB=A5=BC=20?= =?UTF-8?q?=EB=82=98=EB=88=84=EA=B3=A0,=20=EB=AC=B8=EC=A0=9C=20=EB=B0=9C?= =?UTF-8?q?=EC=83=9D=EC=8B=9C=20errorcode=EB=A5=BC=20=EB=85=B8=EC=B6=9C?= =?UTF-8?q?=ED=95=98=EB=8A=94=EA=B2=83=EC=9C=BC=EB=A1=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=ED=95=A8.=20pom=EC=97=90=EC=84=9C=20arucs=20=EC=9D=98?= =?UTF-8?q?=EC=A1=B4=EC=84=B1=EC=9D=84=20=EC=A0=9C=EA=B1=B0=ED=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@1350 84d0f5b1-2673-498c-a247-62c4ff18d310 --- pom.xml | 40 +++++----- .../web/service/RecordSetServiceImpl.java | 73 +++++++++---------- .../hippo/web/service/SpanServiceImpl.java | 13 ++-- 3 files changed, 59 insertions(+), 67 deletions(-) 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