use of com.navercorp.pinpoint.grpc.trace.PAgentInfo in project pinpoint by naver.
the class AgentClientMock method info.
public void info(final int count) {
for (int i = 0; i < count; i++) {
PAgentInfo request = PAgentInfo.newBuilder().build();
QueueingStreamObserver<PResult> responseObserver = getResponseObserver();
agentStub.requestAgentInfo(request, responseObserver);
PResult value = responseObserver.getValue();
logger.info("Result {}", value);
}
}
use of com.navercorp.pinpoint.grpc.trace.PAgentInfo in project pinpoint by naver.
the class GrpcAgentInfoMessageConverter method convertAgentInfo.
public PAgentInfo convertAgentInfo(final AgentInfo agentInfo) {
final AgentInformation agentInformation = agentInfo.getAgentInformation();
final PAgentInfo.Builder builder = PAgentInfo.newBuilder();
builder.setIp(agentInformation.getHostIp());
builder.setHostname(agentInformation.getMachineName());
builder.setPorts("");
builder.setContainer(agentInformation.isContainer());
builder.setPid(agentInformation.getPid());
builder.setServiceType(agentInformation.getServerType().getCode());
builder.setVmVersion(agentInformation.getJvmVersion());
builder.setAgentVersion(Version.VERSION);
final ServerMetaData serverMetaData = agentInfo.getServerMetaData();
if (serverMetaData != null) {
final PServerMetaData tServerMetaData = convertServerMetaData(agentInfo.getServerMetaData());
builder.setServerMetaData(tServerMetaData);
}
final JvmInformation jvmInformation = agentInfo.getJvmInfo();
if (jvmInformation != null) {
final PJvmInfo tJvmInfo = convertJvmInfo(agentInfo.getJvmInfo());
builder.setJvmInfo(tJvmInfo);
}
return builder.build();
}
use of com.navercorp.pinpoint.grpc.trace.PAgentInfo 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.PAgentInfo in project pinpoint by naver.
the class AgentGrpcDataSender method request.
@Override
public boolean request(T data, final FutureListener<ResponseMessage> listener) {
final GeneratedMessageV3 message = this.messageConverter.toMessage(data);
if (!(message instanceof PAgentInfo)) {
throw new IllegalArgumentException("unsupported message " + data);
}
final PAgentInfo pAgentInfo = (PAgentInfo) message;
this.agentInfoStub.requestAgentInfo(pAgentInfo, new FutureListenerStreamObserver(listener));
return true;
}
use of com.navercorp.pinpoint.grpc.trace.PAgentInfo 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