Search in sources :

Example 1 with TCommandTransfer

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;
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer) PinpointSocket(com.navercorp.pinpoint.rpc.PinpointSocket)

Example 2 with TCommandTransfer

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));
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer) TResult(com.navercorp.pinpoint.thrift.dto.TResult) Test(org.junit.Test)

Example 3 with TCommandTransfer

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;
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer)

Example 4 with TCommandTransfer

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);
        }
    }
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer) AgentEventType(com.navercorp.pinpoint.common.server.util.AgentEventType) TCommandTransferResponse(com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse) AgentEventBo(com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)

Example 5 with TCommandTransfer

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);
}
Also used : TCommandTransfer(com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer) InetSocketAddress(java.net.InetSocketAddress)

Aggregations

TCommandTransfer (com.navercorp.pinpoint.thrift.dto.command.TCommandTransfer)14 TCommandTransferResponse (com.navercorp.pinpoint.thrift.dto.command.TCommandTransferResponse)6 PinpointSocket (com.navercorp.pinpoint.rpc.PinpointSocket)5 Test (org.junit.Test)5 ResponseEvent (com.navercorp.pinpoint.collector.cluster.route.ResponseEvent)4 HeaderTBaseDeserializer (com.navercorp.pinpoint.thrift.io.HeaderTBaseDeserializer)4 AgentEventBo (com.navercorp.pinpoint.common.server.bo.event.AgentEventBo)3 AgentEventType (com.navercorp.pinpoint.common.server.util.AgentEventType)3 AgentEventBo (com.navercorp.pinpoint.common.server.bo.AgentEventBo)2 HeaderV1 (com.navercorp.pinpoint.io.header.v1.HeaderV1)2 DefaultMessage (com.navercorp.pinpoint.io.request.DefaultMessage)2 ResponseMessage (com.navercorp.pinpoint.rpc.ResponseMessage)2 StreamException (com.navercorp.pinpoint.rpc.stream.StreamException)2 TCommandEcho (com.navercorp.pinpoint.thrift.dto.command.TCommandEcho)2 TCommandThreadDumpResponse (com.navercorp.pinpoint.thrift.dto.command.TCommandThreadDumpResponse)2 DefaultPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.DefaultPinpointRouteResponse)2 FailedPinpointRouteResponse (com.navercorp.pinpoint.web.cluster.FailedPinpointRouteResponse)2 PinpointRouteResponse (com.navercorp.pinpoint.web.cluster.PinpointRouteResponse)2 TBase (org.apache.thrift.TBase)2 StreamEvent (com.navercorp.pinpoint.collector.cluster.route.StreamEvent)1