use of com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer in project pinpoint by naver.
the class AgentServiceImpl method openStream.
@Override
public ClientStreamChannelContext openStream(AgentInfo agentInfo, byte[] payload, ClientStreamChannelMessageListener messageListener, StreamChannelStateChangeEventHandler<ClientStreamChannel> stateChangeListener) throws TException {
TCommandTransfer transferObject = createCommandTransferObject(agentInfo, payload);
PinpointSocket socket = clusterManager.getSocket(agentInfo);
if (socket != null) {
return socket.openStream(serializeRequest(transferObject), messageListener, stateChangeListener);
}
return null;
}
use of com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer in project pinpoint by naver.
the class ProfilerCommandServiceLocatorTest method basicFunctionTest2.
@Test
public void basicFunctionTest2() throws Exception {
ProfilerCommandLocatorBuilder builder = new ProfilerCommandLocatorBuilder();
builder.addService(new MockCommandServiceGroup());
ProfilerCommandServiceLocator commandServiceLocator = builder.build();
TResult commandResult = new TResult();
TCommandTransfer commandTransfer = new TCommandTransfer();
Assert.assertEquals(2, commandServiceLocator.getCommandServiceClasses().size());
Assert.assertEquals(2, commandServiceLocator.getCommandServiceCodes().size());
Assert.assertTrue(commandServiceLocator.getCommandServiceCodes().contains(TCommandType.getType(commandResult.getClass()).getCode()));
Assert.assertTrue(commandServiceLocator.getCommandServiceCodes().contains(TCommandType.getType(commandTransfer.getClass()).getCode()));
Assert.assertNotNull(commandServiceLocator.getService(commandResult));
Assert.assertNotNull(commandServiceLocator.getSimpleService(commandResult));
Assert.assertNull(commandServiceLocator.getRequestService(commandResult));
Assert.assertNull(commandServiceLocator.getStreamService(commandResult));
Assert.assertNotNull(commandServiceLocator.getService(commandTransfer));
Assert.assertNotNull(commandServiceLocator.getStreamService(commandTransfer));
Assert.assertNull(commandServiceLocator.getSimpleService(commandTransfer));
Assert.assertNull(commandServiceLocator.getRequestService(commandTransfer));
}
use of com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer in project pinpoint by naver.
the class AgentServiceImpl method createCommandTransferObject.
private TCommandTransfer createCommandTransferObject(AgentInfo agentInfo, byte[] payload) {
TCommandTransfer transferObject = new TCommandTransfer();
transferObject.setApplicationName(agentInfo.getApplicationName());
transferObject.setAgentId(agentInfo.getAgentId());
transferObject.setStartTime(agentInfo.getStartTimestamp());
transferObject.setPayload(payload);
return transferObject;
}
use of com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer in project pinpoint by naver.
the class AgentEventHandlingFilter method insertResponseEvent.
private void insertResponseEvent(ResponseEvent responseEvent, long eventTimestamp) {
final TCommandTransfer command = responseEvent.getDeliveryCommand();
final String agentId = command.getAgentId();
final long startTimestamp = command.getStartTime();
final TCommandTransferResponse response = responseEvent.getRouteResult();
final byte[] payload = response.getPayload();
final Class<?> payloadType = readPayload(payload);
if (payload == null) {
return;
}
for (AgentEventType eventType : RESPONSE_EVENT_TYPES) {
if (eventType.getMessageType() == payloadType) {
final AgentEventBo agentEventBo = new AgentEventBo(agentId, startTimestamp, eventTimestamp, eventType);
agentEventBo.setEventBody(payload);
this.agentEventService.insert(agentEventBo);
}
}
}
use of com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer in project pinpoint by naver.
the class DefaultRouteHandlerTest method createRouteEvent.
private RouteEvent createRouteEvent() {
TCommandTransfer tCommandTransfer = new TCommandTransfer();
tCommandTransfer.setApplicationName("applicationName");
tCommandTransfer.setAgentId("agentId");
tCommandTransfer.setStartTime(System.currentTimeMillis());
InetSocketAddress socketAddress = new InetSocketAddress(50505);
return new DefaultRouteEvent(tCommandTransfer, socketAddress);
}
Aggregations