Search in sources :

Example 16 with FixedBuffer

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);
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) ByteBuffer(java.nio.ByteBuffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer)

Example 17 with FixedBuffer

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);
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType) ResponseTime(com.navercorp.pinpoint.web.vo.ResponseTime)

Example 18 with FixedBuffer

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;
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) MetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey) ArrayList(java.util.ArrayList) MethodTypeEnum(com.navercorp.pinpoint.common.server.bo.MethodTypeEnum) ApiMetaDataBo(com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo) Cell(org.apache.hadoop.hbase.Cell)

Example 19 with FixedBuffer

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);
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) TIntStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringValue)

Example 20 with FixedBuffer

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);
}
Also used : FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer) Buffer(com.navercorp.pinpoint.common.buffer.Buffer) AutomaticBuffer(com.navercorp.pinpoint.common.buffer.AutomaticBuffer) TIntStringStringValue(com.navercorp.pinpoint.thrift.dto.TIntStringStringValue) FixedBuffer(com.navercorp.pinpoint.common.buffer.FixedBuffer)

Aggregations

Buffer (com.navercorp.pinpoint.common.buffer.Buffer)39 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)39 AutomaticBuffer (com.navercorp.pinpoint.common.buffer.AutomaticBuffer)23 Test (org.junit.Test)16 AgentStatDataPointCodec (com.navercorp.pinpoint.common.server.bo.codec.stat.AgentStatDataPointCodec)10 ApplicationStatDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.stat.ApplicationStatDecodingContext)10 JoinStatBo (com.navercorp.pinpoint.common.server.bo.stat.join.JoinStatBo)10 Date (java.util.Date)10 ByteBuffer (java.nio.ByteBuffer)5 Cell (org.apache.hadoop.hbase.Cell)4 ArrayList (java.util.ArrayList)3 AgentInfoBo (com.navercorp.pinpoint.common.server.bo.AgentInfoBo)2 AgentStatDecodingContext (com.navercorp.pinpoint.common.server.bo.serializer.stat.AgentStatDecodingContext)2 AgentStatDataPoint (com.navercorp.pinpoint.common.server.bo.stat.AgentStatDataPoint)2 IntStringStringValue (com.navercorp.pinpoint.common.util.IntStringStringValue)2 LinkDataMap (com.navercorp.pinpoint.web.applicationmap.rawdata.LinkDataMap)2 Application (com.navercorp.pinpoint.web.vo.Application)2 OffsetFixedBuffer (com.navercorp.pinpoint.common.buffer.OffsetFixedBuffer)1 AgentLifeCycleBo (com.navercorp.pinpoint.common.server.bo.AgentLifeCycleBo)1 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1