mirror of
https://github.com/wahyd4/pinpoint.git
synced 2026-08-18 01:06:03 +10:00
[강운덕] [LUCYSUS-1744] span의 문자열 길이를 255자 이내로 제한하고 1byte unsigned chunk로 마크하는것으로 변경.
git-svn-id: http://svn.bds.nhncorp.com/pe/hippo-commons/trunk@944 84d0f5b1-2673-498c-a247-62c4ff18d310
This commit is contained in:
@@ -226,7 +226,7 @@ public class SpanBo {
|
||||
|
||||
private int getBufferLength(int a, int b, int c, int d) {
|
||||
int size = a + b + c + d;
|
||||
size += 1 + 2 + 2 + 2 + VERSION_SIZE; // chunk size chunk
|
||||
size += 1 + 1 + 1 + 1 + VERSION_SIZE; // chunk size chunk
|
||||
// size = size + TIMESTAMP + MOSTTRACEID + LEASTTRACEID + SPANID +
|
||||
// PARENTSPANID + FLAG + TERMINAL;
|
||||
size += PARENTSPANID + FLAG + SERVICETYPE;
|
||||
@@ -259,10 +259,10 @@ public class SpanBo {
|
||||
buffer.put(startTime);
|
||||
buffer.put(elapsed);
|
||||
|
||||
buffer.put2PrefixedBytes(rpcBytes);
|
||||
buffer.put2PrefixedBytes(serviceNameBytes);
|
||||
buffer.put1PrefixedBytes(rpcBytes);
|
||||
buffer.put1PrefixedBytes(serviceNameBytes);
|
||||
buffer.put(serviceType.getCode());
|
||||
buffer.put2PrefixedBytes(endPointBytes);
|
||||
buffer.put1PrefixedBytes(endPointBytes);
|
||||
|
||||
buffer.put(flag);
|
||||
return buffer.getBuffer();
|
||||
@@ -284,10 +284,10 @@ public class SpanBo {
|
||||
this.startTime = buffer.readLong();
|
||||
this.elapsed = buffer.readInt();
|
||||
|
||||
this.rpc = buffer.read2PrefixedString();
|
||||
this.serviceName = buffer.read2PrefixedString();
|
||||
this.rpc = buffer.read1UnsignedPrefixedString();
|
||||
this.serviceName = buffer.read1UnsignedPrefixedString();
|
||||
this.serviceType = ServiceType.parse(buffer.readShort());
|
||||
this.endPoint = buffer.read2PrefixedString();
|
||||
this.endPoint = buffer.read1UnsignedPrefixedString();
|
||||
|
||||
this.flag = buffer.readShort();
|
||||
return buffer.getOffset();
|
||||
|
||||
@@ -77,6 +77,10 @@ public class Buffer {
|
||||
return this.buffer[offset++];
|
||||
}
|
||||
|
||||
public int readUnsignedByte() {
|
||||
return readByte() & 0xff;
|
||||
}
|
||||
|
||||
public boolean readBoolean() {
|
||||
byte b = readByte();
|
||||
if (b == BOOLEAN_FALSE) {
|
||||
@@ -151,6 +155,14 @@ public class Buffer {
|
||||
return readString(size);
|
||||
}
|
||||
|
||||
public String read1UnsignedPrefixedString() {
|
||||
int size = readUnsignedByte();
|
||||
if (size == 0) {
|
||||
return "";
|
||||
}
|
||||
return readString(size);
|
||||
}
|
||||
|
||||
public String read2PrefixedString() {
|
||||
int size = readShort();
|
||||
if (size == 0) {
|
||||
|
||||
Reference in New Issue
Block a user