use of com.navercorp.pinpoint.grpc.trace.PResult in project pinpoint by naver.
the class AgentClientMock method stringMetaData.
public void stringMetaData(final int count) {
for (int i = 0; i < count; i++) {
PStringMetaData request = PStringMetaData.newBuilder().build();
PResult result = metadataStub.requestStringMetaData(request);
}
}
use of com.navercorp.pinpoint.grpc.trace.PResult in project pinpoint by naver.
the class UnaryCallDeadlineInterceptorTest method withDeadlineTest.
@Test
public void withDeadlineTest() {
Channel channel = new TestChannel();
UnaryCallDeadlineInterceptor unaryCallDeadlineInterceptor = new UnaryCallDeadlineInterceptor(5000);
ClientCall<PAgentInfo, PResult> pAgentInfoPResultClientCall = unaryCallDeadlineInterceptor.interceptCall(createMethodDescritor(MethodDescriptor.MethodType.UNARY), CallOptions.DEFAULT.withAuthority("test"), channel);
Assert.assertNotNull(((TestChannel) channel).callOptions.getDeadline());
}
use of com.navercorp.pinpoint.grpc.trace.PResult in project pinpoint by naver.
the class GrpcMessageToResultConverter method toMessage.
@Override
public ResultResponse toMessage(Object object) {
if (object instanceof ResponseMessage) {
final ResponseMessage responseMessage = (ResponseMessage) object;
final byte[] byteMessage = responseMessage.getMessage();
try {
final PResult pResult = PResult.parseFrom(byteMessage);
return new ResultResponse() {
@Override
public boolean isSuccess() {
return pResult.getSuccess();
}
@Override
public String getMessage() {
return pResult.getMessage();
}
};
} catch (InvalidProtocolBufferException e) {
throw new IllegalArgumentException("invalid message data. response message=" + responseMessage, e);
}
}
return null;
}
use of com.navercorp.pinpoint.grpc.trace.PResult in project pinpoint by naver.
the class GrpcSqlMetaDataHandler method handleRequest.
@Override
public void handleRequest(ServerRequest<GeneratedMessageV3> serverRequest, ServerResponse<GeneratedMessageV3> serverResponse) {
final GeneratedMessageV3 data = serverRequest.getData();
if (data instanceof PSqlMetaData) {
PResult result = handleSqlMetaData((PSqlMetaData) data);
serverResponse.write(result);
} else {
logger.warn("Invalid request type. serverRequest={}", serverRequest);
throw Status.INTERNAL.withDescription("Bad Request(invalid request type)").asRuntimeException();
}
}
use of com.navercorp.pinpoint.grpc.trace.PResult in project pinpoint by naver.
the class GrpcAgentInfoHandler method handleRequest.
@Override
public void handleRequest(ServerRequest<GeneratedMessageV3> serverRequest, ServerResponse<GeneratedMessageV3> serverResponse) {
final GeneratedMessageV3 data = serverRequest.getData();
if (data instanceof PAgentInfo) {
final PResult result = handleAgentInfo((PAgentInfo) data);
serverResponse.write(result);
} else {
logger.warn("Invalid request type. serverRequest={}", serverRequest);
throw Status.INTERNAL.withDescription("Bad Request(invalid request type)").asRuntimeException();
}
}
Aggregations