use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanDecoderV0 method readAnnotationList.
private List<AnnotationBo> readAnnotationList(Buffer buffer, SpanDecodingContext decodingContext) {
int annotationListSize = buffer.readVInt();
List<AnnotationBo> annotationBoList = new ArrayList<>(annotationListSize);
// AnnotationBo prev = decodingContext.getPrevFirstAnnotationBo();
AnnotationBo prev = null;
for (int i = 0; i < annotationListSize; i++) {
AnnotationBo current;
if (i == 0) {
current = readFirstAnnotationBo(buffer);
// save first annotation for delta bitfield
// decodingContext.setPrevFirstAnnotationBo(current);
} else {
current = readDeltaAnnotationBo(buffer, prev);
}
prev = current;
annotationBoList.add(current);
}
return annotationBoList;
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanDecoderV0 method readDeltaAnnotationBo.
private AnnotationBo readDeltaAnnotationBo(Buffer buffer, AnnotationBo prev) {
final int prevKey = prev.getKey();
int key = buffer.readSVInt() + prevKey;
byte valueType = buffer.readByte();
byte[] valueBytes = buffer.readPrefixedBytes();
Object value = transcoder.decode(valueType, valueBytes);
AnnotationBo annotation = new AnnotationBo(key, value);
return annotation;
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanDecoderV0 method readFirstSpanEvent.
private SpanEventBo readFirstSpanEvent(Buffer buffer, SpanDecodingContext decodingContext) {
final SpanEventBitField bitField = new SpanEventBitField(buffer.readByte());
final SpanEventBo firstSpanEvent = new SpanEventBo();
firstSpanEvent.setStartElapsed(buffer.readVInt());
firstSpanEvent.setEndElapsed(buffer.readVInt());
firstSpanEvent.setSequence(buffer.readShort());
firstSpanEvent.setDepth(buffer.readSVInt());
firstSpanEvent.setServiceType(buffer.readShort());
if (bitField.isSetRpc()) {
firstSpanEvent.setRpc(buffer.readPrefixedString());
}
if (bitField.isSetEndPoint()) {
firstSpanEvent.setEndPoint(buffer.readPrefixedString());
}
if (bitField.isSetDestinationId()) {
firstSpanEvent.setDestinationId(buffer.readPrefixedString());
}
firstSpanEvent.setApiId(buffer.readSVInt());
if (bitField.isSetNextSpanId()) {
firstSpanEvent.setNextSpanId(buffer.readLong());
}
if (bitField.isSetHasException()) {
int exceptionId = buffer.readSVInt();
String exceptionMessage = buffer.readPrefixedString();
firstSpanEvent.setExceptionInfo(exceptionId, exceptionMessage);
}
if (bitField.isSetAnnotation()) {
List<AnnotationBo> annotationBoList = readAnnotationList(buffer, decodingContext);
firstSpanEvent.setAnnotationBoList(annotationBoList);
}
if (bitField.isSetNextAsyncId()) {
firstSpanEvent.setNextAsyncId(buffer.readSVInt());
}
// }
return firstSpanEvent;
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class SpanEventBitFieldTest method testAnnotation_first.
@Test
public void testAnnotation_first() throws Exception {
SpanEventBo spanEventBo = new SpanEventBo();
spanEventBo.setAnnotationBoList(Collections.singletonList(new AnnotationBo(1, "test")));
SpanEventBitField bitField = SpanEventBitField.buildFirst(spanEventBo);
Assert.assertTrue(bitField.isSetAnnotation());
bitField.setAnnotation(false);
Assert.assertFalse(bitField.isSetAnnotation());
}
use of com.navercorp.pinpoint.common.server.bo.AnnotationBo in project pinpoint by naver.
the class AnnotationUtilsTest method findApiAnnotation.
@Test
public void findApiAnnotation() {
AnnotationBo annotationBo = new AnnotationBo(AnnotationKey.API.getCode(), "a");
String value = AnnotationUtils.findApiAnnotation(Collections.singletonList(annotationBo));
Assert.assertEquals("a", value);
}
Aggregations