use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class TransactionIdUtils method parseTransactionId.
public static TransactionId parseTransactionId(final byte[] transactionId, String defaultAgentId) {
Objects.requireNonNull(transactionId, "transactionId");
final Buffer buffer = new FixedBuffer(transactionId);
final byte version = buffer.readByte();
if (version != VERSION) {
throw new IllegalArgumentException("invalid Version");
}
String agentId = buffer.readPrefixedString();
agentId = StringUtils.defaultString(agentId, defaultAgentId);
if (!IdValidateUtils.validateId(agentId)) {
throw new IllegalArgumentException("invalid transactionId:" + transactionId);
}
final long agentStartTime = buffer.readVLong();
final long transactionSequence = buffer.readVLong();
return new TransactionId(agentId, agentStartTime, transactionSequence);
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class ResponseTimeMapper method createResponseTime.
private ResponseTime createResponseTime(byte[] rowKey) {
final Buffer row = new FixedBuffer(rowKey);
String applicationName = row.read2PrefixedString();
short serviceTypeCode = row.readShort();
final long timestamp = TimeUtils.recoveryTimeMillis(row.readLong());
ServiceType serviceType = registry.findServiceType(serviceTypeCode);
return new ResponseTime(applicationName, serviceType, timestamp);
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class ApiMetaDataMapper method mapRow.
@Override
public List<ApiMetaDataBo> mapRow(Result result, int rowNum) throws Exception {
if (result.isEmpty()) {
return Collections.emptyList();
}
final byte[] rowKey = getOriginalKey(result.getRow());
final MetaDataRowKey key = decoder.decodeRowKey(rowKey);
List<ApiMetaDataBo> apiMetaDataList = new ArrayList<>();
for (Cell cell : result.rawCells()) {
final byte[] value = getValue(cell);
Buffer buffer = new FixedBuffer(value);
final String apiInfo = buffer.readPrefixedString();
final int lineNumber = buffer.readInt();
MethodTypeEnum methodTypeEnum = MethodTypeEnum.DEFAULT;
if (buffer.hasRemaining()) {
methodTypeEnum = MethodTypeEnum.valueOf(buffer.readInt());
}
ApiMetaDataBo apiMetaDataBo = new ApiMetaDataBo(key.getAgentId(), key.getAgentStartTime(), key.getId(), lineNumber, methodTypeEnum, apiInfo);
apiMetaDataList.add(apiMetaDataBo);
if (logger.isDebugEnabled()) {
logger.debug("read apiAnnotation:{}", apiMetaDataBo);
}
}
return apiMetaDataList;
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class AnnotationTranscoder method decodeIntStringValue.
private Object decodeIntStringValue(byte[] data) {
final Buffer buffer = new FixedBuffer(data);
final int intValue = buffer.readSVInt();
final String stringValue = BytesUtils.toString(buffer.readPrefixedBytes());
return new IntStringValue(intValue, stringValue);
}
use of com.navercorp.pinpoint.common.buffer.FixedBuffer in project pinpoint by naver.
the class AnnotationTranscoder method decodeIntStringStringValue.
private Object decodeIntStringStringValue(byte[] data) {
final Buffer buffer = new FixedBuffer(data);
final int intValue = buffer.readSVInt();
final String stringValue1 = BytesUtils.toString(buffer.readPrefixedBytes());
final String stringValue2 = BytesUtils.toString(buffer.readPrefixedBytes());
return new IntStringStringValue(intValue, stringValue1, stringValue2);
}
Aggregations