[강운덕] [PINPOINT-266] StatisticsHandler의 callee 정보 리팩토링, 파라미터의 이름및 연관성 있는 순서로 변경함. rowkey가 앞에 오도록함.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-server/trunk@3189 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2014-01-22 10:48:23 +00:00
parent 36f822ea9f
commit c9fe7e20fd
4 changed files with 12 additions and 11 deletions
@@ -75,15 +75,15 @@ public class HbaseApplicationMapStatisticsCallerDao implements ApplicationMapSta
// make row key. rowkey는 나.
final long acceptedTime = acceptedTimeService.getAcceptedTime();
final long rowTimeSlot = TimeSlot.getStatisticsRowSlot(acceptedTime);
final RowKey calleeRowKey = new CallRowKey(callerApplicationName, callerServiceType, rowTimeSlot);
final RowKey callerRowKey = new CallRowKey(callerApplicationName, callerServiceType, rowTimeSlot);
final short callerSlotNumber = ApplicationMapStatisticsUtils.getSlotNumber(calleeServiceType, elapsed, isError);
final ColumnName callerColumnName = new CallColumnName(calleeServiceType, calleeApplicationName, calleeHost, callerSlotNumber);
if (useBulk) {
RowInfo rowInfo = new DefaultRowInfo(calleeRowKey, callerColumnName);
RowInfo rowInfo = new DefaultRowInfo(callerRowKey, callerColumnName);
this.counter.increment(rowInfo, 1L);
} else {
final byte[] rowKey = calleeRowKey.getRowKey();
final byte[] rowKey = callerRowKey.getRowKey();
// column name은 나를 호출한 app
byte[] columnName = callerColumnName.getColumnName();
increment(rowKey, columnName, 1L);
@@ -49,15 +49,15 @@ public class SpanChunkHandler implements SimpleHandler {
logger.debug("SpanChunk Size:{}", spanEventList.size());
// TODO 껀바이 껀인데. 나중에 뭔가 한번에 업데이트 치는걸로 변경해야 될듯.
for (TSpanEvent spanEvent : spanEventList) {
ServiceType serviceType = ServiceType.findServiceType(spanEvent.getServiceType());
final ServiceType serviceType = ServiceType.findServiceType(spanEvent.getServiceType());
if (!serviceType.isRecordStatistics()) {
continue;
}
// if terminal update statistics
int elapsed = spanEvent.getEndElapsed();
boolean hasException = SpanEventUtils.hasException(spanEvent);
final int elapsed = spanEvent.getEndElapsed();
final boolean hasException = SpanEventUtils.hasException(spanEvent);
/**
* 통계정보에 기반한 서버맵을 그리기 위한 정보 저장.
@@ -66,7 +66,7 @@ public class SpanChunkHandler implements SimpleHandler {
statisticsHandler.updateCaller(spanEvent.getDestinationId(), serviceType.getCode(), spanChunk.getApplicationName(), spanChunk.getServiceType(), spanEvent.getEndPoint(), elapsed, hasException);
// 나를 호출한 정보 저장 (spanevent를 호출한 span)
statisticsHandler.updateCallee(spanChunk.getApplicationName(), spanChunk.getServiceType(), spanEvent.getDestinationId(), spanEvent.getServiceType(), spanChunk.getEndPoint(), elapsed, hasException);
statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEvent.getServiceType(), spanChunk.getApplicationName(), spanChunk.getServiceType(), spanChunk.getEndPoint(), elapsed, hasException);
}
}
} catch (Exception e) {
@@ -68,8 +68,9 @@ public class SpanHandler implements SimpleHandler {
int bugCheck = 0;
if (span.getParentSpanId() == -1) {
// FIXME 테스트용. host값에 agentId를 입력.
// user를 생성하는 부분
statisticsHandler.updateCaller(span.getApplicationName(), span.getServiceType(), span.getApplicationName(), ServiceType.USER.getCode(), span.getAgentId(), span.getElapsed(), isError);
statisticsHandler.updateCallee(span.getApplicationName(), ServiceType.USER.getCode(), span.getApplicationName(), span.getServiceType(), span.getAgentId(), span.getElapsed(), isError);
statisticsHandler.updateCallee(span.getApplicationName(), span.getServiceType(), span.getApplicationName(), ServiceType.USER.getCode(), span.getAgentId(), span.getElapsed(), isError);
bugCheck++;
}
@@ -80,7 +81,7 @@ public class SpanHandler implements SimpleHandler {
logger.debug("Received parent application name. {}", span.getParentApplicationName());
// TODO 원래는 부모의 serviceType을 알아야 한다.
// 여기에서는 그냥 부모는 모두 TOMCAT이라 가정하고 테스트.
statisticsHandler.updateCallee(span.getParentApplicationName(), span.getParentApplicationType(), span.getApplicationName(), span.getServiceType(), span.getAgentId(), span.getElapsed(), isError);
statisticsHandler.updateCallee(span.getApplicationName(), span.getServiceType(), span.getParentApplicationName(), span.getParentApplicationType(), span.getAgentId(), span.getElapsed(), isError);
// statisticsHandler.updateCallee(span.getParentApplicationName(), span.getParentApplicationType(), span.getApplicationName(), span.getServiceType(), span.getEndPoint(), span.getElapsed(), span.getErr() > 0);
bugCheck++;
}
@@ -114,7 +115,7 @@ public class SpanHandler implements SimpleHandler {
statisticsHandler.updateCaller(spanEvent.getDestinationId(), serviceType.getCode(), span.getApplicationName(), span.getServiceType(), spanEvent.getEndPoint(), elapsed, hasException);
// 나를 호출한 정보 저장 (spanevent를 호출한 span)
statisticsHandler.updateCallee(span.getApplicationName(), span.getServiceType(), spanEvent.getDestinationId(), spanEvent.getServiceType(), span.getEndPoint(), elapsed, hasException);
statisticsHandler.updateCallee(spanEvent.getDestinationId(), spanEvent.getServiceType(), span.getApplicationName(), span.getServiceType(), span.getEndPoint(), elapsed, hasException);
}
}
@@ -23,7 +23,7 @@ public class StatisticsHandler {
applicationMapStatisticsCallerDao.update(calleeApplicationName, calleeServiceType, callerApplicationName, callerServiceType, calleeHost, elapsed, isError);
}
public void updateCallee(String callerApplicationName, short callerServiceType, String calleeApplicationName, short calleeServiceType, String callerHost, int elapsed, boolean isError) {
public void updateCallee(String calleeApplicationName, short calleeServiceType, String callerApplicationName, short callerServiceType, String callerHost, int elapsed, boolean isError) {
applicationMapStatisticsCalleeDao.update(calleeApplicationName, calleeServiceType, callerApplicationName, callerServiceType, callerHost, elapsed, isError);
}
}