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());
}
}
}
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);
}
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);
}
}
}
}
});
}
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;
}
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);
}
}
}
}
});
}
Aggregations