[강운덕] [LUCYSUS-1744] API-ID의 예외 케이스 처리 강화, 별도 error코드를 나누고, 문제 발생시 errorcode를 노출하는것으로 수정함.

pom에서 arucs 의존성을 제거함

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-web/trunk@1350 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-03-20 07:27:58 +00:00
parent bf55ff634e
commit 4e4813e6bd
3 changed files with 59 additions and 67 deletions
@@ -28,9 +28,6 @@ public class RecordSetServiceImpl implements RecordSetService {
@Override
public RecordSet createRecordSet(List<SpanAlign> 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<SpanAlign> 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<Record> 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<Record> annotationRecord = createAnnotationRecord(spanAlign.getDepth() + 1, spanEventBo.getAnnotationBoList());
recordList.addAll(annotationRecord);
}
@@ -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<SpanAlign> 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<SpanAlign> populatedList = spanPopulator.populateSpanEvent(); return populatedList;
*/
}
@Override