use of com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer in project pinpoint by naver.
the class GrpcCommandService method registerNewPinpointGrpcServer.
private PinpointGrpcServer registerNewPinpointGrpcServer(StreamObserver<PCmdRequest> requestObserver, AgentInfo agentInfo, Long transportId) {
PinpointGrpcServer pinpointGrpcServer = createPinpointGrpcServer(requestObserver, agentInfo);
final boolean registered = grpcServerRepository.registerIfAbsent(transportId, pinpointGrpcServer);
if (registered) {
return pinpointGrpcServer;
} else {
return null;
}
}
use of com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer in project pinpoint by naver.
the class GrpcCommandService method commandActiveThreadLightDump.
@Override
public void commandActiveThreadLightDump(PCmdActiveThreadLightDumpRes activeThreadLightDumpResponse, StreamObserver<Empty> responseObserver) {
final Long transportId = getTransportId();
PinpointGrpcServer pinpointGrpcServer = grpcServerRepository.get(transportId);
if (pinpointGrpcServer != null) {
activeThreadLightDumpService.handle(pinpointGrpcServer, activeThreadLightDumpResponse, responseObserver);
responseObserver.onNext(Empty.getDefaultInstance());
responseObserver.onCompleted();
} else {
logger.info("{} => local. Can't find PinpointGrpcServer(transportId={})", getAgentInfo().getAgentKey(), transportId);
responseObserver.onError(new StatusException(Status.NOT_FOUND));
}
}
use of com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer in project pinpoint by naver.
the class GrpcAgentConnectionTest method equalsTest.
@Test
public void equalsTest() {
PinpointGrpcServer mockGrpcServer1 = Mockito.mock(PinpointGrpcServer.class);
List<Integer> supportCommandList = Collections.singletonList(Short.toUnsignedInt(TCommandType.ECHO.getCode()));
GrpcAgentConnection grpcAgentConnection = new GrpcAgentConnection(mockGrpcServer1, supportCommandList);
Assert.assertEquals(grpcAgentConnection, grpcAgentConnection);
Assert.assertEquals(grpcAgentConnection, new GrpcAgentConnection(mockGrpcServer1, supportCommandList));
PinpointGrpcServer mockGrpcServer2 = Mockito.mock(PinpointGrpcServer.class);
Assert.assertNotEquals(grpcAgentConnection, new GrpcAgentConnection(mockGrpcServer2, supportCommandList));
}
use of com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer in project pinpoint by naver.
the class GrpcAgentConnectionTest method requestTest.
@Test
public void requestTest() {
PinpointGrpcServer mockGrpcServer = Mockito.mock(PinpointGrpcServer.class);
List<Integer> supportCommandList = Collections.singletonList(Short.toUnsignedInt(TCommandType.ECHO.getCode()));
GrpcAgentConnection grpcAgentConnection = new GrpcAgentConnection(mockGrpcServer, supportCommandList);
boolean supportCommand = grpcAgentConnection.isSupportCommand(TCommandType.TRANSFER.getBodyFactory().getObject());
Assert.assertFalse(supportCommand);
supportCommand = grpcAgentConnection.isSupportCommand(TCommandType.RESULT.getBodyFactory().getObject());
Assert.assertFalse(supportCommand);
supportCommand = grpcAgentConnection.isSupportCommand(TCommandType.ECHO.getBodyFactory().getObject());
Assert.assertTrue(supportCommand);
Future<ResponseMessage> future = grpcAgentConnection.request(new TResult());
Assert.assertFalse(future.isSuccess());
Assert.assertNotNull(future.getCause());
TCommandEcho commandEcho = new TCommandEcho("hello");
// check to pass validation
future = grpcAgentConnection.request(commandEcho);
Assert.assertNull(future);
}
use of com.navercorp.pinpoint.collector.receiver.grpc.PinpointGrpcServer in project pinpoint by naver.
the class ClusterPointController method clearConnection.
private void clearConnection(GrpcAgentConnection grpcAgentConnection) {
PinpointGrpcServer pinpointGrpcServer = grpcAgentConnection.getPinpointGrpcServer();
pinpointGrpcServer.close(SocketStateCode.ERROR_UNKNOWN);
}
Aggregations