Search in sources :

Example 1 with StringMetaDataBo

use of com.navercorp.pinpoint.common.server.bo.StringMetaDataBo in project pinpoint by naver.

the class SpanServiceImpl method transitionException.

private void transitionException(List<SpanAlign> spanAlignList) {
    for (SpanAlign spanAlign : spanAlignList) {
        if (spanAlign.hasException()) {
            StringMetaDataBo stringMetaData = selectStringMetaData(spanAlign.getAgentId(), spanAlign.getExceptionId(), spanAlign.getAgentStartTime());
            spanAlign.setExceptionClass(stringMetaData.getStringValue());
        }
    }
}
Also used : SpanAlign(com.navercorp.pinpoint.web.calltree.span.SpanAlign) StringMetaDataBo(com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)

Example 2 with StringMetaDataBo

use of com.navercorp.pinpoint.common.server.bo.StringMetaDataBo in project pinpoint by naver.

the class ThriftStringMetaDataHandler method handleStringMetaData.

private TResult handleStringMetaData(TStringMetaData stringMetaData) {
    try {
        String agentId = stringMetaData.getAgentId();
        long agentStartTime = stringMetaData.getAgentStartTime();
        int stringId = stringMetaData.getStringId();
        String stringValue = stringMetaData.getStringValue();
        final StringMetaDataBo stringMetaDataBo = new StringMetaDataBo(agentId, agentStartTime, stringId, stringValue);
        stringMetaDataService.insert(stringMetaDataBo);
    } catch (Exception e) {
        logger.warn("Failed to handle stringMetaData={}, Caused:{}", stringMetaData, e.getMessage(), e);
        final TResult result = new TResult(false);
        result.setMessage(e.getMessage());
        return result;
    }
    return new TResult(true);
}
Also used : StringMetaDataBo(com.navercorp.pinpoint.common.server.bo.StringMetaDataBo) TResult(com.navercorp.pinpoint.thrift.dto.TResult)

Example 3 with StringMetaDataBo

use of com.navercorp.pinpoint.common.server.bo.StringMetaDataBo in project pinpoint by naver.

the class SpanServiceImpl method transitionCachedString.

private void transitionCachedString(List<Align> spans) {
    this.transitionAnnotation(spans, new AnnotationReplacementCallback() {

        @Override
        public void replacement(Align align, List<AnnotationBo> annotationBoList) {
            List<AnnotationBo> cachedStringAnnotation = findCachedStringAnnotation(annotationBoList);
            if (cachedStringAnnotation.isEmpty()) {
                return;
            }
            for (AnnotationBo annotationBo : cachedStringAnnotation) {
                final int cachedArgsKey = annotationBo.getKey();
                int stringMetaDataId = (Integer) annotationBo.getValue();
                List<StringMetaDataBo> stringMetaList = stringMetaDataDao.getStringMetaData(align.getAgentId(), align.getAgentStartTime(), stringMetaDataId);
                int size = stringMetaList.size();
                if (size == 0) {
                    logger.warn("StringMetaData not Found {}/{}/{}", align.getAgentId(), stringMetaDataId, align.getAgentStartTime());
                    String errorMessage = "CACHED-STRING-ID not found. stringId:";
                    AnnotationBo api = new AnnotationBo(AnnotationKey.ERROR_API_METADATA_NOT_FOUND.getCode(), errorMessage);
                    annotationBoList.add(api);
                } else if (size >= 1) {
                    // key collision shouldn't really happen (probability too low)
                    StringMetaDataBo stringMetaDataBo = stringMetaList.get(0);
                    AnnotationBo stringMetaData = new AnnotationBo(AnnotationKeyUtils.cachedArgsToArgs(cachedArgsKey), stringMetaDataBo.getStringValue());
                    annotationBoList.add(stringMetaData);
                    if (size > 1) {
                        logger.warn("stringMetaData size not 1 :{}", stringMetaList);
                    }
                }
            }
        }
    });
}
Also used : AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) Align(com.navercorp.pinpoint.web.calltree.span.Align) ArrayList(java.util.ArrayList) List(java.util.List) StringMetaDataBo(com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)

Example 4 with StringMetaDataBo

use of com.navercorp.pinpoint.common.server.bo.StringMetaDataBo 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 5 with StringMetaDataBo

use of com.navercorp.pinpoint.common.server.bo.StringMetaDataBo in project pinpoint by naver.

the class SpanServiceImpl method transitionCachedString.

private void transitionCachedString(List<SpanAlign> spans) {
    this.transitionAnnotation(spans, new AnnotationReplacementCallback() {

        @Override
        public void replacement(SpanAlign spanAlign, List<AnnotationBo> annotationBoList) {
            List<AnnotationBo> cachedStringAnnotation = findCachedStringAnnotation(annotationBoList);
            if (cachedStringAnnotation.isEmpty()) {
                return;
            }
            for (AnnotationBo annotationBo : cachedStringAnnotation) {
                final int cachedArgsKey = annotationBo.getKey();
                int stringMetaDataId = (Integer) annotationBo.getValue();
                List<StringMetaDataBo> stringMetaList = stringMetaDataDao.getStringMetaData(spanAlign.getAgentId(), spanAlign.getAgentStartTime(), stringMetaDataId);
                int size = stringMetaList.size();
                if (size == 0) {
                    logger.warn("StringMetaData not Found {}/{}/{}", spanAlign.getAgentId(), stringMetaDataId, spanAlign.getAgentStartTime());
                    AnnotationBo api = new AnnotationBo();
                    api.setKey(AnnotationKey.ERROR_API_METADATA_NOT_FOUND.getCode());
                    api.setValue("CACHED-STRING-ID not found. stringId:" + cachedArgsKey);
                    annotationBoList.add(api);
                } else if (size >= 1) {
                    // key collision shouldn't really happen (probability too low)
                    StringMetaDataBo stringMetaDataBo = stringMetaList.get(0);
                    AnnotationBo stringMetaData = new AnnotationBo();
                    stringMetaData.setKey(AnnotationKeyUtils.cachedArgsToArgs(cachedArgsKey));
                    stringMetaData.setValue(stringMetaDataBo.getStringValue());
                    annotationBoList.add(stringMetaData);
                    if (size > 1) {
                        logger.warn("stringMetaData size not 1 :{}", stringMetaList);
                    }
                }
            }
        }
    });
}
Also used : SpanAlign(com.navercorp.pinpoint.web.calltree.span.SpanAlign) AnnotationBo(com.navercorp.pinpoint.common.server.bo.AnnotationBo) ArrayList(java.util.ArrayList) List(java.util.List) StringMetaDataBo(com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)

Aggregations

StringMetaDataBo (com.navercorp.pinpoint.common.server.bo.StringMetaDataBo)9 ArrayList (java.util.ArrayList)3 AnnotationBo (com.navercorp.pinpoint.common.server.bo.AnnotationBo)2 Align (com.navercorp.pinpoint.web.calltree.span.Align)2 SpanAlign (com.navercorp.pinpoint.web.calltree.span.SpanAlign)2 List (java.util.List)2 MetaDataRowKey (com.navercorp.pinpoint.common.server.bo.serializer.metadata.MetaDataRowKey)1 Header (com.navercorp.pinpoint.grpc.Header)1 TResult (com.navercorp.pinpoint.thrift.dto.TResult)1 Cell (org.apache.hadoop.hbase.Cell)1 Put (org.apache.hadoop.hbase.client.Put)1