Search in sources :

Example 1 with TApiMetaData

use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.

the class DefaultApiMetaDataService method cacheApi.

@Override
public int cacheApi(final MethodDescriptor methodDescriptor) {
    final String fullName = methodDescriptor.getFullName();
    final Result result = this.apiCache.put(fullName);
    methodDescriptor.setApiId(result.getId());
    if (result.isNewValue()) {
        final TApiMetaData apiMetadata = new TApiMetaData();
        apiMetadata.setAgentId(agentId);
        apiMetadata.setAgentStartTime(agentStartTime);
        apiMetadata.setApiId(result.getId());
        apiMetadata.setApiInfo(methodDescriptor.getApiDescriptor());
        apiMetadata.setLine(methodDescriptor.getLineNumber());
        apiMetadata.setType(methodDescriptor.getType());
        this.enhancedDataSender.request(apiMetadata);
    }
    return result.getId();
}
Also used : TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData)

Example 2 with TApiMetaData

use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.

the class TcpDataSenderReconnectTest method connectAndSend.

@Test
public void connectAndSend() throws InterruptedException {
    TestPinpointServerAcceptor oldTestPinpointServerAcceptor = new TestPinpointServerAcceptor(new LoggingServerMessageListenerFactory(true));
    int bindPort = oldTestPinpointServerAcceptor.bind();
    PinpointClientFactory clientFactory = createPinpointClientFactory();
    TcpDataSender sender = new TcpDataSender(this.getClass().getName(), TestPinpointServerAcceptor.LOCALHOST, bindPort, clientFactory);
    oldTestPinpointServerAcceptor.assertAwaitClientConnected(5000);
    oldTestPinpointServerAcceptor.close();
    waitClientDisconnected(sender);
    logger.debug("Server start------------------");
    TestPinpointServerAcceptor newTestPinpointServerAcceptor = new TestPinpointServerAcceptor(new LoggingServerMessageListenerFactory(true));
    newTestPinpointServerAcceptor.bind(bindPort);
    newTestPinpointServerAcceptor.assertAwaitClientConnected(5000);
    logger.debug("sendMessage------------------");
    sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
    Thread.sleep(500);
    logger.debug("sender stop------------------");
    sender.stop();
    newTestPinpointServerAcceptor.close();
    clientFactory.release();
}
Also used : TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TestPinpointServerAcceptor(com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) LoggingServerMessageListenerFactory(com.navercorp.pinpoint.rpc.server.LoggingServerMessageListenerFactory) Test(org.junit.Test)

Example 3 with TApiMetaData

use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.

the class TcpDataSenderTest method connectAndSend.

@Test
public void connectAndSend() {
    TestServerMessageListenerFactory testServerMessageListenerFactory = new TestServerMessageListenerFactory(TestServerMessageListenerFactory.HandshakeType.DUPLEX, true);
    TestServerMessageListenerFactory.TestServerMessageListener serverMessageListener = testServerMessageListenerFactory.create();
    TestPinpointServerAcceptor testPinpointServerAcceptor = new TestPinpointServerAcceptor(testServerMessageListenerFactory);
    int bindPort = testPinpointServerAcceptor.bind();
    PinpointClientFactory clientFactory = createPinpointClientFactory();
    TcpDataSender<Object> sender = new TcpDataSender<>(this.getClass().getName(), TestPinpointServerAcceptor.LOCALHOST, bindPort, clientFactory);
    try {
        sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
        sender.send(new TApiMetaData("test", System.currentTimeMillis(), 1, "TestApi"));
        serverMessageListener.awaitAssertExpectedSendCount(2, 1000);
    } finally {
        sender.stop();
        if (clientFactory != null) {
            clientFactory.release();
        }
        testPinpointServerAcceptor.close();
    }
}
Also used : TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TestPinpointServerAcceptor(com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) TestServerMessageListenerFactory(com.navercorp.pinpoint.test.server.TestServerMessageListenerFactory) Test(org.junit.Test)

Example 4 with TApiMetaData

use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.

the class DefaultTBaseLocator method addBodyFactory.

public static void addBodyFactory(TypeLocatorBuilder<TBase<?, ?>> builder) {
    builder.addBodyFactory(SPAN, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSpan();
        }
    });
    builder.addBodyFactory(AGENT_INFO, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TAgentInfo();
        }
    });
    builder.addBodyFactory(AGENT_STAT, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TAgentStat();
        }
    });
    builder.addBodyFactory(AGENT_STAT_BATCH, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TAgentStatBatch();
        }
    });
    builder.addBodyFactory(SPANCHUNK, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSpanChunk();
        }
    });
    builder.addBodyFactory(SPANEVENT, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSpanEvent();
        }
    });
    builder.addBodyFactory(SQLMETADATA, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TSqlMetaData();
        }
    });
    builder.addBodyFactory(APIMETADATA, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TApiMetaData();
        }
    });
    builder.addBodyFactory(RESULT, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TResult();
        }
    });
    builder.addBodyFactory(STRINGMETADATA, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new TStringMetaData();
        }
    });
    builder.addBodyFactory(NETWORK_CHECK, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return new NetworkAvailabilityCheckPacket();
        }
    });
    builder.addBodyFactory(CHUNK, new BodyFactory<TBase<?, ?>>() {

        @Override
        public TBase<?, ?> getObject() {
            return null;
        }
    });
}
Also used : TAgentStat(com.navercorp.pinpoint.thrift.dto.TAgentStat) TAgentStatBatch(com.navercorp.pinpoint.thrift.dto.TAgentStatBatch) TStringMetaData(com.navercorp.pinpoint.thrift.dto.TStringMetaData) TResult(com.navercorp.pinpoint.thrift.dto.TResult) TSpanChunk(com.navercorp.pinpoint.thrift.dto.TSpanChunk) TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TSpan(com.navercorp.pinpoint.thrift.dto.TSpan) TBase(org.apache.thrift.TBase) TSqlMetaData(com.navercorp.pinpoint.thrift.dto.TSqlMetaData) TAgentInfo(com.navercorp.pinpoint.thrift.dto.TAgentInfo) TSpanEvent(com.navercorp.pinpoint.thrift.dto.TSpanEvent)

Example 5 with TApiMetaData

use of com.navercorp.pinpoint.thrift.dto.TApiMetaData in project pinpoint by naver.

the class TestTcpDataSender method addData.

private void addData(TBase<?, ?> data) {
    if (data instanceof TApiMetaData) {
        TApiMetaData md = (TApiMetaData) data;
        final String javaMethodDescriptor = toJavaMethodDescriptor(md);
        apiIdMap.put(md.getApiId(), javaMethodDescriptor);
    } else if (data instanceof TSqlMetaData) {
        TSqlMetaData md = (TSqlMetaData) data;
        int id = md.getSqlId();
        String sql = md.getSql();
        sqlIdMap.put(id, sql);
    } else if (data instanceof TStringMetaData) {
        TStringMetaData md = (TStringMetaData) data;
        int id = md.getStringId();
        String string = md.getStringValue();
        stringIdMap.put(id, string);
    }
    datas.add(data);
}
Also used : TApiMetaData(com.navercorp.pinpoint.thrift.dto.TApiMetaData) TSqlMetaData(com.navercorp.pinpoint.thrift.dto.TSqlMetaData) TStringMetaData(com.navercorp.pinpoint.thrift.dto.TStringMetaData)

Aggregations

TApiMetaData (com.navercorp.pinpoint.thrift.dto.TApiMetaData)7 DefaultPinpointClientFactory (com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)2 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)2 TestPinpointServerAcceptor (com.navercorp.pinpoint.test.server.TestPinpointServerAcceptor)2 TResult (com.navercorp.pinpoint.thrift.dto.TResult)2 TSqlMetaData (com.navercorp.pinpoint.thrift.dto.TSqlMetaData)2 TStringMetaData (com.navercorp.pinpoint.thrift.dto.TStringMetaData)2 Test (org.junit.Test)2 LoggingServerMessageListenerFactory (com.navercorp.pinpoint.rpc.server.LoggingServerMessageListenerFactory)1 TestServerMessageListenerFactory (com.navercorp.pinpoint.test.server.TestServerMessageListenerFactory)1 TAgentInfo (com.navercorp.pinpoint.thrift.dto.TAgentInfo)1 TAgentStat (com.navercorp.pinpoint.thrift.dto.TAgentStat)1 TAgentStatBatch (com.navercorp.pinpoint.thrift.dto.TAgentStatBatch)1 TSpan (com.navercorp.pinpoint.thrift.dto.TSpan)1 TSpanChunk (com.navercorp.pinpoint.thrift.dto.TSpanChunk)1 TSpanEvent (com.navercorp.pinpoint.thrift.dto.TSpanEvent)1 TBase (org.apache.thrift.TBase)1