Skip to content

Commit

Permalink
Merge pull request pinpoint-apm#18 from nstopkimsk/master
Browse files Browse the repository at this point in the history
modified comments in English
  • Loading branch information
nstopkimsk committed Dec 27, 2014
2 parents c960c8b + 9d65742 commit a9ab509
Show file tree
Hide file tree
Showing 14 changed files with 142 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
* @author emeroad
*/
public enum AnnotationKey {
// 가변 인코딩을 사용하므로, 작은 숫자는 패킷에 전송 되는 데이터로 위주로 사용하고 내부 사용 코드는 숫자를 크게 잡아야 한다.

// because of using variable-length encoding,
// a small number should be used mainly for data contained in network packets and a big number for internal used code.

// 2147483647
// -2147483648

// @Deprecated // spanEvent와 span으로 apiId를 직접 이동 시킴. int 로 덤프
// @Deprecated // moved apiId to spanEvent and span. dump by int
// API_DID(10, "API-DID"),
// @Deprecated // 정적 api 코드를 제거해야 한다. API-DID만 사용할것. int로 덤프
// @Deprecated // you should remove static API code. Use only API-DID. dump by int
// API_ID(11, "API-ID"),
// api를 string으로 덤프하는 anntation 최초 개발시 사용함. 추후 이것도 없애야 될듯.
// used for developing the annotation that dumps api by string. you also consider to remove it later.
API(12, "API"),
API_METADATA(13, "API-METADATA"),
RETURN_DATA(14, "RETRUN_DATA", true),
Expand All @@ -40,18 +43,19 @@ public enum AnnotationKey {
CAll_PARAM(16, "CALL_PARAM", true),
PROTOCAL(17, "PROTOCAL", true),

// 정확한 에러 원인을 모를 경우.
// when you don't know the correct cause of errors.
ERROR_API_METADATA_ERROR(10000010, "API-METADATA-ERROR"),
// agentInfo를 못찾앗을 경우
// when agentInfo not found
ERROR_API_METADATA_AGENT_INFO_NOT_FOUND(10000011, "API-METADATA-AGENT-INFO-NOT-FOUND"),
// agentInfo를 찾았으나 체크섬이 맞지 않는경우
// when checksum is not correct even if agentInfo exists
ERROR_API_METADATA_IDENTIFIER_CHECK_ERROR(10000012, "API-METADATA-IDENTIFIER-CHECK_ERROR"),
// meta data자체를 못찾은 경우.
// when meta data itself not found
ERROR_API_METADATA_NOT_FOUND(10000013, "API-METADATA-NOT-FOUND"),
// meta data의 동일 hashid가 존재할 경우
// when the same hashId of meta data exists
ERROR_API_METADATA_DID_COLLSION(10000014, "API-METADATA-DID-COLLSION"),
// ERROR code 처리가 애매한데 ERROR_API_META_DATA_을 검색해서 ApiMetaDataError로 처리하였음.
// 자동 id

// it's not clear to handle a error code. so ApiMetaDataError with searching ERROR_API_META_DATA has been used.
// automatically generated id

SQL_ID(20, "SQL-ID"),
SQL(21, "SQL", true),
Expand All @@ -61,15 +65,15 @@ public enum AnnotationKey {

STRING_ID(30, "STRING_ID"),

// HTTP_URL은 argument로 치환되므로 true가 아님..
// HTTP_URL is replaced by argument. So viewInRecordSet parameter value is not true.
HTTP_URL(40, "http.url"),
HTTP_PARAM(41, "http.param", true),
HTTP_PARAM_ENTITY(42, "http.entity", true),
HTTP_COOKIE(45, "http.cookie", true),
HTTP_CALL_RETRY_COUNT(48, "retryCount"),
// httpclient일때 post 파라미터
// post method parameter of httpclient

// ARCUS_COMMAND(50, "arcus.command"),
// ARCUS_COMMAND(50, "arcus.command"),

NPC_URL(60, "npc.url"),
NPC_PARAM(61, "npc.param"),
Expand Down Expand Up @@ -240,7 +244,7 @@ public static int cachedArgsToArgs(int index) {
}

final int cachedIndex = CACHE_ARGS0.getCode() - ARGS0.getCode();
// 음수라서 -해야 된다.
// you have to - (minus) operation because of negative value
return index - cachedIndex;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class HistogramSchema {
private final HistogramSlot verySlowSlot;
private final HistogramSlot errorSlot;

// 내부에서 생성한 FAST_SCHEMA, NORMAL등의 참조만 사용할것
// Should use the reference of FAST_SCHEMA, NORMAL created internally
private HistogramSchema(int typeCode, short fast, String fastName, short normal, String normalName, short slow, String slowName, String verySlowName, String errorName) {
this.typeCode = typeCode;
this.fastSlot = new HistogramSlot(fast, SlotType.FAST, fastName);
Expand All @@ -57,7 +57,7 @@ public int getTypeCode() {
}

/**
* elapsedTime 기준으로 가장 적합한 슬롯을 찾는다.
* find the most appropriate slot based on elapsedTime
* @param elapsedTime
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,34 +34,23 @@
*/
public enum ServiceType {

/**
* 정의되지 않은 서비스 코드,
*/

// Undefined Service Code
UNDEFINED((short) -1, "UNDEFINED", TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* agent가 설치되지 않은 피호출자.
*/
// Callee node that agent hasn't been installed
UNKNOWN((short) 1, "UNKNOWN", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* 사용자
*/

// User
USER((short) 2, "USER", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* UNKNOWN의 그룹, UI에서만 사용함.
*/

// Group of UNKNOWN, used only for UI
UNKNOWN_GROUP((short) 3, "UNKNOWN_GROUP", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* TEST의 그룹 - 테스트 실행 시 사용
*/
// Group of TEST, used for running tests
TEST((short) 5, "TEST", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* Java applications, WAS
*/
// Java applications, WAS
STAND_ALONE((short) 1000, "STAND_ALONE", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
TEST_STAND_ALONE((short) 1005, "TEST_STAND_ALONE", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
TOMCAT((short) 1010, "TOMCAT", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
Expand All @@ -88,51 +77,37 @@ public enum ServiceType {
CUBRID((short) 2400, "CUBRID", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, NORMAL_SCHEMA),
CUBRID_EXECUTE_QUERY((short) 2401, "CUBRID", TERMINAL, RECORD_STATISTICS, true, NORMAL_SCHEMA),

/**
* Internal method
*/
// FIXME internal method를 여기에 넣기 애매하긴 하나.. 일단 그대로 둠.
// Internal method
// FIXME it's not clear to put internal method here. but do that for now.
INTERNAL_METHOD((short) 5000, "INTERNAL_METHOD", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* Spring framework
*/
// Spring framework
SPRING((short) 5050, "SPRING", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
SPRING_MVC((short) 5051, "SPRING", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
// FIXME 스프링 관련 코드들 어떻게 가져갈지 정리 필요
// FIXME need to define how to handle spring related codes
SPRING_ORM_IBATIS((short) 5061, "SPRING", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
SPRING_BEAN((short) 5071, "SPRING_BEAN", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* xBatis
*/

// xBatis
IBATIS((short) 5500, "IBATIS", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
MYBATIS((short) 5510, "MYBATIS", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* DBCP
*/
// DBCP
DBCP((short) 6050, "DBCP", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),

/**
* Memory cache
*/
// Memory cache
MEMCACHED((short) 8050, "MEMCACHED", TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, FAST_SCHEMA),
MEMCACHED_FUTURE_GET((short) 8051, "MEMCACHED", TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, FAST_SCHEMA),
ARCUS((short) 8100, "ARCUS", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),
ARCUS_FUTURE_GET((short) 8101, "ARCUS", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),
ARCUS_EHCACHE_FUTURE_GET((short) 8102, "ARCUS-EHCACHE", TERMINAL, !RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),

/**
* Redis & nBase-ARC
*/
// Redis & nBase-ARC
REDIS((short) 8200, "REDIS", TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, FAST_SCHEMA),
NBASE_ARC((short) 8250, "NBASE_ARC", TERMINAL, RECORD_STATISTICS, INCLUDE_DESTINATION, FAST_SCHEMA),


/**
* Connector, Client
*/
// Connector, Client
HTTP_CLIENT((short) 9050, "HTTP_CLIENT", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
HTTP_CLIENT_INTERNAL((short) 9051, "HTTP_CLIENT", !TERMINAL, !RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
JDK_HTTPURLCONNECTOR((short) 9055, "JDK_HTTPCONNECTOR", !TERMINAL, RECORD_STATISTICS, !INCLUDE_DESTINATION, NORMAL_SCHEMA),
Expand All @@ -146,10 +121,10 @@ public enum ServiceType {
private final String desc;
private final boolean terminal;

// FIXME rpc 호출에 대해서만 통계정보를 남길 것이니, isRecordRpc()로 바꾸는건 어떨지???
// FIXME record statistics of only rpc call currently. so is it all right to chane into isRecordRpc()
private final boolean recordStatistics;

// DetinationId를 포함시켜 api를 출력하지 여부
// whether or not print out api including destinationId
private final boolean includeDestinationId;
private final HistogramSchema histogramSchema;

Expand All @@ -162,7 +137,7 @@ public enum ServiceType {
this.histogramSchema = histogramSchema;
}

// FIXME 이 메소드를 사용해서 ServiceType을 찾는건 좋지 않을 듯.
// FIXME it may be not good to find serviceType by using this api
public static List<ServiceType> findDesc(String desc) {
if (desc == null) {
throw new NullPointerException("desc must not be null");
Expand All @@ -182,25 +157,17 @@ public boolean isIndexable() {
return !terminal && !isRpcClient() && code > 1000;
}

// FIXME rpc 호출에 대해서만 통계정보를 남길 것이니, isRecordRpc()로 바꾸는건 어떨지???
// FIXME record statistics of only rpc call currently. so is it all right to chane into isRecordRpc()
public boolean isRecordStatistics() {
return recordStatistics;
}

/**
* agent가 설치되어있지 않은 피호출자인가?
*
* @return
*/
public boolean isUnknown() {
return this == ServiceType.UNKNOWN; // || this == ServiceType.UNKNOWN_CLOUD;
}

/**
* 사용자 또는 알 수 없는 호출자인가?
*
* @return
*/

// return true when the service type is USER or can not be identified
public boolean isUser() {
return this == ServiceType.USER;
}
Expand Down Expand Up @@ -268,7 +235,8 @@ private static void initializeStatisticsLookupTable() {
serviceTypeList.add(serviceType);
}
}
// 수정하지 못하도록 한다.

// Don't modify
for (Map.Entry<String, List<ServiceType>> entry : temp.entrySet()) {
List<ServiceType> serviceTypes = Collections.unmodifiableList(entry.getValue());
STATISTICS_LOOKUP_TABLE.put(entry.getKey(), serviceTypes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class AgentInfoBo {
public static final Comparator<AgentInfoBo> AGENT_NAME_ASC_COMPARATOR = new Comparator<AgentInfoBo>() {
@Override
public int compare(AgentInfoBo that, AgentInfoBo other) {
// null 일때 상황이 애매할수 있어서 그냥 ""으로 처리함.
final String thatAgentId = defaultString(that.agentId);
final String otherAgentId = defaultString(other.agentId);
return thatAgentId.compareTo(otherAgentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public class AgentStatCpuLoadBo {
private final String agentId;
private final long startTimestamp;
private final long timestamp;
private final double jvmCpuLoad; // 범위는 1 >= X >=0 ex) 25% 라면 0.25로 저장됨
private final double systemCpuLoad; // 범위는 1 >= X >=0 ex) 25% 라면 0.25로 저장됨
private final double jvmCpuLoad; // range is 1 >= X >=0, ex) if 25% then save 0.25
private final double systemCpuLoad; // range is 1 >= X >=0, ex) if 25% then save 0.25

private AgentStatCpuLoadBo(Builder builder) {
this.agentId = builder.agentId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void setVersion(int version) {
if (version < 0 || version > 255) {
throw new IllegalArgumentException("out of range (0~255) " + version);
}
// range 체크
// check range
this.version = (byte) (version & 0xFF);
}

Expand Down Expand Up @@ -110,11 +110,11 @@ public void setValue(Object value) {
}

public void writeValue(Buffer buffer) {
// long timestamp; // required 8
// long duration; // optional 8
// int key; // required 4
// long timestamp; // required 8
// long duration; // optional 8
// int key; // required 4
// int valueTypeCode; // required 4
// ByteBuffer value; // optional 4 + buf.length
// ByteBuffer value; // optional 4 + buf.length
buffer.put(this.version);
buffer.putSVar(this.key);
buffer.put(this.valueType);
Expand Down
30 changes: 16 additions & 14 deletions commons/src/main/java/com/navercorp/pinpoint/common/bo/SpanBo.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,11 @@
public class SpanBo implements com.navercorp.pinpoint.common.bo.Span {

private static final int VERSION_SIZE = 1;
// version 0 = prefix의 사이즈를 int로

// version 0 means that the type of prefix's size is int
private byte version = 0;


// private AgentKeyBo agentKeyBo;
// private AgentKeyBo agentKeyBo;
private String agentId;
private String applicationId;
private long agentStartTime;
Expand Down Expand Up @@ -109,8 +108,8 @@ public SpanBo(TSpan span) {
this.remoteAddr = span.getRemoteAddr();


// FIXME span.errCode는 span과 spanEvent의 에러를 모두 포함한 값.
// exceptionInfo는 span자체의 에러정보이기 때문에 errCode가 0이 아니더라도 exceptionInfo는 null일 수 있음.
// FIXME span.errCode contains error of span and spanEvent
// because exceptionInfo is the error information of span itself, exceptionInfo can be null even if errCode is not 0
final TIntStringValue exceptionInfo = span.getExceptionInfo();
if (exceptionInfo != null) {
this.hasException = true;
Expand Down Expand Up @@ -146,7 +145,7 @@ public void setVersion(int version) {
if (version < 0 || version > 255) {
throw new IllegalArgumentException("out of range (0~255)");
}
// range 체크
// check range
this.version = (byte) (version & 0xFF);
}

Expand Down Expand Up @@ -361,11 +360,13 @@ public void setExceptionClass(String exceptionClass) {
}


// io wirte시 variable encoding을 추가함.
// 약 10%정도 byte 사이즈가 줄어드는 효과가 있음.
// Variable encoding has been added in case of write io operation. The data size can be reduced by about 10%.
public byte[] writeValue() {
// var encoding 사용시 사이즈를 측정하기 어려움. 안되는것음 아님 편의상 그냥 자동 증가 buffer를 사용한다.
// 향후 더 효율적으로 메모리를 사용하게 한다면 getBufferLength를 다시 부활 시키는것을 고려한다.
/*
It is difficult to calculate the size of buffer. It's not impossible.
However just use automatic incremental buffer for convenience's sake.
Consider to reuse getBufferLength when memory can be used more efficiently later.
*/
final Buffer buffer = new AutomaticBuffer(256);

buffer.put(version);
Expand All @@ -374,14 +375,15 @@ public byte[] writeValue() {
// buffer.put(leastTraceID);

buffer.putPrefixedString(agentId);
// time의 경우도 현재 시간을 기준으로 var를 사용하는게 사이즈가 더 작음 6byte를 먹음.

// Using var makes the sie of time smaller based on the present time. That consumes only 6 bytes.
buffer.putVar(agentStartTime);

// rowkey에 들어감.
// insert for rowkey
// buffer.put(spanID);
buffer.put(parentSpanId);

// 현재 시간이 기준이므로 var encoding
// use var encoding because of based on the present time
buffer.putVar(startTime);
buffer.putVar(elapsed);

Expand All @@ -392,7 +394,7 @@ public byte[] writeValue() {
buffer.putPrefixedString(remoteAddr);
buffer.putSVar(apiId);

// errCode code는 음수가 될수 있음.
// errCode value may be negative
buffer.putSVar(errCode);

if (hasException){
Expand Down
Loading

0 comments on commit a9ab509

Please sign in to comment.