Search in sources :

Example 1 with MetaDataRowKey

use of com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey in project pinpoint by naver.

the class HbaseSqlMetaDataDao method getSqlMetaData.

@Override
public List<SqlMetaDataBo> getSqlMetaData(String agentId, long time, int sqlId) {
    Objects.requireNonNull(agentId, "agentId");
    MetaDataRowKey metaDataRowKey = new DefaultMetaDataRowKey(agentId, time, sqlId);
    byte[] rowKey = getDistributedKey(rowKeyEncoder.encodeRowKey(metaDataRowKey));
    Get get = new Get(rowKey);
    get.addFamily(DESCRIPTOR.getName());
    TableName sqlMetaDataTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    return hbaseOperations2.get(sqlMetaDataTableName, get, sqlMetaDataMapper);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) DefaultMetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey) DefaultMetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey) MetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey) Get(org.apache.hadoop.hbase.client.Get)

Example 2 with MetaDataRowKey

use of com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey in project pinpoint by naver.

the class StringMetaDataMapper method mapRow.

@Override
public List<StringMetaDataBo> 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<StringMetaDataBo> stringMetaDataList = new ArrayList<>();
    for (Cell cell : result.rawCells()) {
        String stringValue = Bytes.toString(cell.getQualifierArray(), cell.getQualifierOffset(), cell.getQualifierLength());
        if (STRING_METADATA_CF_STR_QUALI_STRING.equals(stringValue)) {
            stringValue = Bytes.toString(cell.getValueArray(), cell.getValueOffset(), cell.getValueLength());
        }
        StringMetaDataBo stringMetaDataBo = new StringMetaDataBo(key.getAgentId(), key.getAgentStartTime(), key.getId(), stringValue);
        stringMetaDataList.add(stringMetaDataBo);
    }
    return stringMetaDataList;
}
Also used : MetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey) ArrayList(java.util.ArrayList) Cell(org.apache.hadoop.hbase.Cell) StringMetaDataBo(com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)

Example 3 with MetaDataRowKey

use of com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey 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 4 with MetaDataRowKey

use of com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey in project pinpoint by naver.

the class HbaseStringMetaDataDao method getStringMetaData.

@Override
public List<StringMetaDataBo> getStringMetaData(String agentId, long time, int stringId) {
    Objects.requireNonNull(agentId, "agentId");
    MetaDataRowKey metaDataRowKey = new DefaultMetaDataRowKey(agentId, time, stringId);
    byte[] rowKey = getDistributedKey(rowKeyEncoder.encodeRowKey(metaDataRowKey));
    Get get = new Get(rowKey);
    get.addFamily(DESCRIPTOR.getName());
    TableName stringMetaDataTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    return hbaseOperations2.get(stringMetaDataTableName, get, stringMetaDataMapper);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) DefaultMetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey) DefaultMetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey) MetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey) Get(org.apache.hadoop.hbase.client.Get)

Example 5 with MetaDataRowKey

use of com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey in project pinpoint by naver.

the class HbaseApiMetaDataDao method getApiMetaData.

@Override
@Cacheable(cacheNames = "apiMetaData", key = SPEL_KEY, cacheManager = CacheConfiguration.API_METADATA_CACHE_NAME)
public List<ApiMetaDataBo> getApiMetaData(String agentId, long time, int apiId) {
    Objects.requireNonNull(agentId, "agentId");
    MetaDataRowKey metaDataRowKey = new DefaultMetaDataRowKey(agentId, time, apiId);
    byte[] sqlId = getDistributedKey(rowKeyEncoder.encodeRowKey(metaDataRowKey));
    Get get = new Get(sqlId);
    get.addFamily(DESCRIPTOR.getName());
    TableName apiMetaDataTableName = tableNameProvider.getTableName(DESCRIPTOR.getTable());
    return hbaseOperations2.get(apiMetaDataTableName, get, apiMetaDataMapper);
}
Also used : TableName(org.apache.hadoop.hbase.TableName) DefaultMetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey) DefaultMetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey) MetaDataRowKey(com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey) Get(org.apache.hadoop.hbase.client.Get) Cacheable(org.springframework.cache.annotation.Cacheable)

Aggregations

MetaDataRowKey (com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey)6 DefaultMetaDataRowKey (com.navercorp.pinpoint.common.server.bo.serializer.metadata.DefaultMetaDataRowKey)3 ArrayList (java.util.ArrayList)3 Cell (org.apache.hadoop.hbase.Cell)3 TableName (org.apache.hadoop.hbase.TableName)3 Get (org.apache.hadoop.hbase.client.Get)3 Buffer (com.navercorp.pinpoint.common.buffer.Buffer)1 FixedBuffer (com.navercorp.pinpoint.common.buffer.FixedBuffer)1 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1 MethodTypeEnum (com.navercorp.pinpoint.common.server.bo.MethodTypeEnum)1 SqlMetaDataBo (com.navercorp.pinpoint.common.server.bo.SqlMetaDataBo)1 StringMetaDataBo (com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)1 Cacheable (org.springframework.cache.annotation.Cacheable)1