use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class DataTypeAnnotation method apply.
@Override
public TAnnotationValue apply(AnnotationValueThriftMapper context) {
final DataType dataType = this.value;
if (dataType instanceof IntStringValue) {
final IntStringValue v = (IntStringValue) dataType;
final TIntStringValue tIntStringValue = new TIntStringValue(v.getIntValue());
if (v.getStringValue() != null) {
tIntStringValue.setStringValue(v.getStringValue());
}
return TAnnotationValue.intStringValue(tIntStringValue);
} else if (dataType instanceof StringStringValue) {
final StringStringValue v = (StringStringValue) dataType;
final TStringStringValue tStringStringValue = new TStringStringValue(v.getStringValue1());
if (v.getStringValue2() != null) {
tStringStringValue.setStringValue2(v.getStringValue2());
}
return TAnnotationValue.stringStringValue(tStringStringValue);
} else if (dataType instanceof IntStringStringValue) {
final IntStringStringValue v = (IntStringStringValue) dataType;
final TIntStringStringValue tIntStringStringValue = new TIntStringStringValue(v.getIntValue());
if (v.getStringValue1() != null) {
tIntStringStringValue.setStringValue1(v.getStringValue1());
}
if (v.getStringValue2() != null) {
tIntStringStringValue.setStringValue2(v.getStringValue2());
}
return TAnnotationValue.intStringStringValue(tIntStringStringValue);
} else if (dataType instanceof LongIntIntByteByteStringValue) {
final LongIntIntByteByteStringValue v = (LongIntIntByteByteStringValue) dataType;
final TLongIntIntByteByteStringValue tvalue = new TLongIntIntByteByteStringValue(v.getLongValue(), v.getIntValue1());
if (v.getIntValue2() != -1) {
tvalue.setIntValue2(v.getIntValue2());
}
if (v.getByteValue1() != -1) {
tvalue.setByteValue1(v.getByteValue1());
}
if (v.getByteValue2() != -1) {
tvalue.setByteValue2(v.getByteValue2());
}
if (v.getStringValue() != null) {
tvalue.setStringValue(v.getStringValue());
}
return TAnnotationValue.longIntIntByteByteStringValue(tvalue);
} else if (dataType instanceof IntBooleanIntBooleanValue) {
final IntBooleanIntBooleanValue v = (IntBooleanIntBooleanValue) dataType;
final TIntBooleanIntBooleanValue tvalue = new TIntBooleanIntBooleanValue(v.getIntValue1(), v.isBooleanValue1(), v.getIntValue2(), v.isBooleanValue2());
return TAnnotationValue.intBooleanIntBooleanValue(tvalue);
}
throw new UnsupportedOperationException("unsupported type:" + dataType);
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class AnnotationTranscoder method encodeIntBooleanIntBooleanValue.
private byte[] encodeIntBooleanIntBooleanValue(Object o) {
final IntBooleanIntBooleanValue value = (IntBooleanIntBooleanValue) o;
// int + int
final Buffer buffer = new AutomaticBuffer(8);
buffer.putVInt(value.getIntValue1());
buffer.putBoolean(value.isBooleanValue1());
buffer.putVInt(value.getIntValue2());
buffer.putBoolean(value.isBooleanValue2());
return buffer.getBuffer();
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class AnnotationTranscoderTest method testIntBooleanIntBoolean.
@Test
public void testIntBooleanIntBoolean() {
AnnotationTranscoder transcoder = new AnnotationTranscoder();
IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue(10, false, 5000, true);
byte[] encode = transcoder.encode(value, AnnotationTranscoder.CODE_INT_BOOLEAN_INT_BOOLEAN);
IntBooleanIntBooleanValue decode = (IntBooleanIntBooleanValue) transcoder.decode(AnnotationTranscoder.CODE_INT_BOOLEAN_INT_BOOLEAN, encode);
Assert.assertEquals(value.getIntValue1(), decode.getIntValue1());
Assert.assertEquals(false, decode.isBooleanValue1());
Assert.assertEquals(value.getIntValue2(), decode.getIntValue2());
Assert.assertEquals(true, decode.isBooleanValue2());
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class JedisMethodInterceptor method recordIo.
private void recordIo(SpanEventRecorder recorder, CommandContext callContext) {
if (io) {
IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) callContext.getWriteElapsedTime(), callContext.isWriteFail(), (int) callContext.getReadElapsedTime(), callContext.isReadFail());
recorder.recordAttribute(AnnotationKey.REDIS_IO, value);
}
}
Aggregations