Search in sources :

Example 1 with TSqlMetaData

use of com.navercorp.pinpoint.thrift.dto.TSqlMetaData in project pinpoint by naver.

the class TestTcpDataSender method addData.

private void addData(TBase<?, ?> data) {
    if (data instanceof TApiMetaData) {
        TApiMetaData md = (TApiMetaData) data;
        final String javaMethodDescriptor = toJavaMethodDescriptor(md);
        apiIdMap.put(md.getApiId(), javaMethodDescriptor);
    } else if (data instanceof TSqlMetaData) {
        TSqlMetaData md = (TSqlMetaData) data;
        int id = md.getSqlId();
        String sql = md.getSql();
        sqlIdMap.put(id, sql);
    } else if (data instanceof TStringMetaData) {
        TStringMetaData md = (TStringMetaData) data;
        int id = md.getStringId();
        String string = md.getStringValue();
        stringIdMap.put(id, string);
    }
    datas.add(data);
}
Also used : TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TSqlMetaData(com.navercorp.pinpoint.thrift.dto.TSqlMetaData) TStringMetaData(com.navercorp.pinpoint.thrift.dto.TStringMetaData)

Example 2 with TSqlMetaData

use of com.navercorp.pinpoint.thrift.dto.TSqlMetaData in project pinpoint by naver.

the class DefaultSqlMetaDataService method cacheSql.

@Override
public boolean cacheSql(ParsingResult parsingResult) {
    if (parsingResult == null) {
        return false;
    }
    // lazy sql parsing
    boolean isNewValue = this.cachingSqlNormalizer.normalizedSql(parsingResult);
    if (isNewValue) {
        if (isDebug) {
            // TODO logging hit ratio could help debugging
            logger.debug("NewSQLParsingResult:{}", parsingResult);
        }
        // isNewValue means that the value is newly cached.
        // So the sql could be new one. We have to send sql metadata to collector.
        final TSqlMetaData sqlMetaData = new TSqlMetaData();
        sqlMetaData.setAgentId(agentId);
        sqlMetaData.setAgentStartTime(agentStartTime);
        sqlMetaData.setSqlId(parsingResult.getId());
        sqlMetaData.setSql(parsingResult.getSql());
        this.enhancedDataSender.request(sqlMetaData);
    }
    return isNewValue;
}
Also used : TSqlMetaData(com.navercorp.pinpoint.thrift.dto.TSqlMetaData)

Aggregations

TSqlMetaData (com.navercorp.pinpoint.thrift.dto.TSqlMetaData)2 TApiMetaData (com.navercorp.pinpoint.thrift.dto.TApiMetaData)1 TStringMetaData (com.navercorp.pinpoint.thrift.dto.TStringMetaData)1