use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class DataTypeAnnotation method apply.
@Override
public PAnnotationValue apply(GrpcAnnotationValueMapper context) {
PAnnotationValue.Builder builder = context.getAnnotationBuilder();
final DataType dataType = this.value;
if (dataType instanceof IntStringValue) {
final IntStringValue v = (IntStringValue) dataType;
PIntStringValue pIntStringValue = context.newIntStringValue(v);
builder.setIntStringValue(pIntStringValue);
return builder.build();
} else if (dataType instanceof StringStringValue) {
final StringStringValue v = (StringStringValue) dataType;
PStringStringValue pStringStringValue = context.newStringStringValue(v);
builder.setStringStringValue(pStringStringValue);
return builder.build();
} else if (dataType instanceof IntStringStringValue) {
final IntStringStringValue v = (IntStringStringValue) dataType;
final PIntStringStringValue pIntStringStringValue = context.newIntStringStringValue(v);
builder.setIntStringStringValue(pIntStringStringValue);
return builder.build();
} else if (dataType instanceof LongIntIntByteByteStringValue) {
final LongIntIntByteByteStringValue v = (LongIntIntByteByteStringValue) dataType;
final PLongIntIntByteByteStringValue pValue = context.newLongIntIntByteByteStringValue(v);
builder.setLongIntIntByteByteStringValue(pValue);
return builder.build();
} else if (dataType instanceof IntBooleanIntBooleanValue) {
final IntBooleanIntBooleanValue v = (IntBooleanIntBooleanValue) dataType;
final PIntBooleanIntBooleanValue pValue = context.newIntBooleanIntBooleanValue(v);
builder.setIntBooleanIntBooleanValue(pValue);
return builder.build();
}
throw new UnsupportedOperationException("unsupported type:" + dataType);
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class HttpRequestExecutorExecuteMethodInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
try {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
final HttpRequest httpRequest = getHttpRequest(args);
final NameIntValuePair<String> host = getHost();
if (httpRequest != null) {
ClientRequestWrapper clientRequest = new HttpClient4RequestWrapper(httpRequest, host.getName(), host.getValue());
this.clientRequestRecorder.record(recorder, clientRequest, throwable);
this.cookieRecorder.record(recorder, httpRequest, throwable);
}
if (statusCode) {
final Integer statusCodeValue = getStatusCode(result);
if (statusCodeValue != null) {
recorder.recordAttribute(AnnotationKey.HTTP_STATUS_CODE, statusCodeValue);
}
recordResponseHeader(recorder, result);
}
recorder.recordApi(methodDescriptor);
recorder.recordException(throwable);
final InterceptorScopeInvocation invocation = interceptorScope.getCurrentInvocation();
final Object attachment = getAttachment(invocation);
if (attachment instanceof HttpCallContext) {
final HttpCallContext callContext = (HttpCallContext) attachment;
logger.debug("Check call context {}", callContext);
if (io) {
final IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) callContext.getWriteElapsedTime(), callContext.isWriteFail(), (int) callContext.getReadElapsedTime(), callContext.isReadFail());
recorder.recordAttribute(AnnotationKey.HTTP_IO, value);
}
// clear
invocation.removeAttachment();
}
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class AnnotationTranscoder method decodeIntBooleanIntBooleanValue.
private Object decodeIntBooleanIntBooleanValue(byte[] data) {
final Buffer buffer = new FixedBuffer(data);
final int intValue1 = buffer.readVInt();
final boolean booleanValue1 = buffer.readBoolean();
final int intValue2 = buffer.readVInt();
final boolean booleanValue2 = buffer.readBoolean();
return new IntBooleanIntBooleanValue(intValue1, booleanValue1, intValue2, booleanValue2);
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class HttpMethodBaseExecuteMethodInterceptor method recordIo.
private void recordIo(SpanEventRecorder recorder, HttpClient3CallContext callContext) {
if (io) {
IntBooleanIntBooleanValue value = new IntBooleanIntBooleanValue((int) callContext.getWriteElapsedTime(), callContext.isWriteFail(), (int) callContext.getReadElapsedTime(), callContext.isReadFail());
recorder.recordAttribute(AnnotationKey.HTTP_IO, value);
}
}
use of com.navercorp.pinpoint.common.util.IntBooleanIntBooleanValue in project pinpoint by naver.
the class GrpcAnnotationValueMapperTest method buildPAnnotationValue_IntBooleanIntBooleanValue.
@Test
public void buildPAnnotationValue_IntBooleanIntBooleanValue() {
IntBooleanIntBooleanValue intStringValue = new IntBooleanIntBooleanValue(1, true, 3, false);
PAnnotationValue container = mapper.buildPAnnotationValue(Annotations.of(1, intStringValue));
PIntBooleanIntBooleanValue pAnnotation = container.getIntBooleanIntBooleanValue();
Assert.assertEquals(pAnnotation.getIntValue1(), 1);
Assert.assertEquals(pAnnotation.getBoolValue1(), true);
Assert.assertEquals(pAnnotation.getIntValue2(), 3);
Assert.assertEquals(pAnnotation.getBoolValue2(), false);
}
Aggregations