[강운덕] [LUCYSUS-1744] 향후 HBaseTables는 별도 패키로 빠져서 hbase단위로 분리될 예정이므로 PinpointConstants를 참조 하도록 변경함.

git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-commons/trunk@2400 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
Woonduk Kang
2013-10-02 10:26:35 +00:00
parent 1f004fce23
commit dbe08a1dba
6 changed files with 15 additions and 14 deletions
@@ -5,7 +5,7 @@ import com.nhn.pinpoint.common.util.RowKeyUtils;
import com.nhn.pinpoint.common.util.TimeUtils;
import org.apache.hadoop.hbase.util.Bytes;
import static com.nhn.pinpoint.common.hbase.HBaseTables.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.PinpointConstants.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.util.BytesUtils.INT_BYTE_LENGTH;
/**
@@ -5,7 +5,7 @@ import com.nhn.pinpoint.common.util.RowKeyUtils;
import com.nhn.pinpoint.common.util.TimeUtils;
import org.apache.hadoop.hbase.util.Bytes;
import static com.nhn.pinpoint.common.hbase.HBaseTables.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.PinpointConstants.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.util.BytesUtils.INT_BYTE_LENGTH;
/**
@@ -1,6 +1,6 @@
package com.nhn.pinpoint.common.util;
import static com.nhn.pinpoint.common.hbase.HBaseTables.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.PinpointConstants.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.util.BytesUtils.INT_BYTE_LENGTH;
import static com.nhn.pinpoint.common.util.BytesUtils.LONG_BYTE_LENGTH;
@@ -1,8 +1,7 @@
package com.nhn.pinpoint.common.util;
import static com.nhn.pinpoint.common.hbase.HBaseTables.AGENT_NAME_MAX_LEN;
import static com.nhn.pinpoint.common.PinpointConstants.AGENT_NAME_MAX_LEN;
import com.nhn.pinpoint.common.hbase.HBaseTables;
import com.nhn.pinpoint.thrift.dto.Span;
import com.nhn.pinpoint.thrift.dto.SpanChunk;
import com.nhn.pinpoint.thrift.dto.SpanEvent;
@@ -36,7 +35,7 @@ public class SpanUtils {
if (span == null) {
throw new NullPointerException("span must not be null");
}
return BytesUtils.stringLongLongToBytes(span.getTraceAgentId(), HBaseTables.AGENT_NAME_MAX_LEN, span.getTraceAgentStartTime(), span.getTraceTransactionSequence());
return BytesUtils.stringLongLongToBytes(span.getTraceAgentId(), AGENT_NAME_MAX_LEN, span.getTraceAgentStartTime(), span.getTraceTransactionSequence());
}
@@ -44,13 +43,13 @@ public class SpanUtils {
if (spanEvent == null) {
throw new NullPointerException("spanEvent must not be null");
}
return BytesUtils.stringLongLongToBytes(spanEvent.getTraceAgentId(), HBaseTables.AGENT_NAME_MAX_LEN, spanEvent.getTraceAgentStartTime(), spanEvent.getTraceTransactionSequence());
return BytesUtils.stringLongLongToBytes(spanEvent.getTraceAgentId(), AGENT_NAME_MAX_LEN, spanEvent.getTraceAgentStartTime(), spanEvent.getTraceTransactionSequence());
}
public static byte[] getTransactionId(SpanChunk spanChunk) {
if (spanChunk == null) {
throw new NullPointerException("spanChunk must not be null");
}
return BytesUtils.stringLongLongToBytes(spanChunk.getTraceAgentId(), HBaseTables.AGENT_NAME_MAX_LEN, spanChunk.getTraceAgentStartTime(), spanChunk.getTraceTransactionSequence());
return BytesUtils.stringLongLongToBytes(spanChunk.getTraceAgentId(), AGENT_NAME_MAX_LEN, spanChunk.getTraceAgentStartTime(), spanChunk.getTraceTransactionSequence());
}
}
@@ -1,5 +1,6 @@
package com.nhn.pinpoint.common.util;
import com.nhn.pinpoint.common.PinpointConstants;
import org.apache.hadoop.hbase.util.Bytes;
import com.nhn.pinpoint.common.Histogram;
@@ -83,9 +84,9 @@ public class TerminalSpanUtils {
byte[] slot = Bytes.toBytes(time);
byte[] applicationnameBytes = Bytes.toBytes(applicationName);
byte[] buf = new byte[HBaseTables.APPLICATION_NAME_MAX_LEN + 8];
byte[] buf = new byte[PinpointConstants.APPLICATION_NAME_MAX_LEN + 8];
System.arraycopy(applicationnameBytes, 0, buf, 0, applicationnameBytes.length);
System.arraycopy(slot, 0, buf, HBaseTables.APPLICATION_NAME_MAX_LEN, 8);
System.arraycopy(slot, 0, buf, PinpointConstants.APPLICATION_NAME_MAX_LEN, 8);
return buf;
}
@@ -1,5 +1,6 @@
package com.nhn.pinpoint.common.util;
import com.nhn.pinpoint.common.PinpointConstants;
import com.nhn.pinpoint.thrift.dto.Span;
import com.nhn.pinpoint.common.hbase.HBaseTables;
@@ -28,7 +29,7 @@ public class SpanUtilsTest {
@Test
public void testGetTraceIndexRowKey2() throws Exception {
String agentId = "";
for (int i = 0; i < HBaseTables.AGENT_NAME_MAX_LEN; i++) {
for (int i = 0; i < PinpointConstants.AGENT_NAME_MAX_LEN; i++) {
agentId += "1";
}
@@ -39,7 +40,7 @@ public class SpanUtilsTest {
@Test
public void testGetTraceIndexRowKey3() throws Exception {
String agentId = "";
for (int i = 0; i < HBaseTables.AGENT_NAME_MAX_LEN + 1; i++) {
for (int i = 0; i < PinpointConstants.AGENT_NAME_MAX_LEN + 1; i++) {
agentId += "1";
}
@@ -58,10 +59,10 @@ public class SpanUtilsTest {
byte[] traceIndexRowKey = SpanUtils.getAgentIdTraceIndexRowKey(span.getAgentId(), span.getStartTime());
String agentId = Bytes.toString(traceIndexRowKey, 0, HBaseTables.AGENT_NAME_MAX_LEN).trim();
String agentId = Bytes.toString(traceIndexRowKey, 0, PinpointConstants.AGENT_NAME_MAX_LEN).trim();
Assert.assertEquals(agentId0, agentId);
long time = TimeUtils.recoveryCurrentTimeMillis(Bytes.toLong(traceIndexRowKey, HBaseTables.AGENT_NAME_MAX_LEN));
long time = TimeUtils.recoveryCurrentTimeMillis(Bytes.toLong(traceIndexRowKey, PinpointConstants.AGENT_NAME_MAX_LEN));
Assert.assertEquals(time, l1);
}
}