Search in sources :

Example 1 with ServiceInfo

use of com.navercorp.pinpoint.bootstrap.context.ServiceInfo in project pinpoint by naver.

the class AgentInfoSender method createTServiceInfo.

private TServerMetaData createTServiceInfo() {
    TServerMetaData tServerMetaData = new TServerMetaData();
    tServerMetaData.setServerInfo(serverMetaData.getServerInfo());
    tServerMetaData.setVmArgs(serverMetaData.getVmArgs());
    List<TServiceInfo> tServiceInfos = new ArrayList<TServiceInfo>();
    for (ServiceInfo serviceInfo : serverMetaData.getServiceInfos()) {
        TServiceInfo tServiceInfo = new TServiceInfo();
        tServiceInfo.setServiceName(serviceInfo.getServiceName());
        tServiceInfo.setServiceLibs(serviceInfo.getServiceLibs());
        tServiceInfos.add(tServiceInfo);
    }
    tServerMetaData.setServiceInfos(tServiceInfos);
    return tServerMetaData;
}
Also used : ServiceInfo(com.navercorp.pinpoint.bootstrap.context.ServiceInfo) TServiceInfo(com.navercorp.pinpoint.thrift.dto.TServiceInfo) TServiceInfo(com.navercorp.pinpoint.thrift.dto.TServiceInfo) ArrayList(java.util.ArrayList) TServerMetaData(com.navercorp.pinpoint.thrift.dto.TServerMetaData)

Example 2 with ServiceInfo

use of com.navercorp.pinpoint.bootstrap.context.ServiceInfo in project pinpoint by naver.

the class DefaultServerMetaDataHolder method addServiceInfo.

@Override
public void addServiceInfo(String serviceName, List<String> serviceLibs) {
    ServiceInfo serviceInfo = new DefaultServiceInfo(serviceName, serviceLibs);
    this.serviceInfos.add(serviceInfo);
}
Also used : ServiceInfo(com.navercorp.pinpoint.bootstrap.context.ServiceInfo)

Example 3 with ServiceInfo

use of com.navercorp.pinpoint.bootstrap.context.ServiceInfo in project pinpoint by naver.

the class AgentInfoSenderTest method serverMetaDataShouldBeSentOnPublish.

@Test
public void serverMetaDataShouldBeSentOnPublish() throws InterruptedException {
    // Given
    final AtomicInteger requestCount = new AtomicInteger();
    final AtomicInteger successCount = new AtomicInteger();
    final long agentInfoSendRetryIntervalMs = 1000L;
    ResponseServerMessageListener serverListener = new ResponseServerMessageListener(requestCount, successCount);
    PinpointServerAcceptor serverAcceptor = createServerAcceptor(serverListener);
    PinpointClientFactory clientFactory = createPinpointClientFactory();
    PinpointClient pinpointClient = ClientFactoryUtils.createPinpointClient(HOST, PORT, clientFactory);
    TcpDataSender dataSender = new TcpDataSender(pinpointClient);
    AgentInfoSender agentInfoSender = new AgentInfoSender.Builder(dataSender, getAgentInfo()).sendInterval(agentInfoSendRetryIntervalMs).build();
    final List<ServerMetaData> serverMetaDataObjects = new ArrayList<ServerMetaData>();
    serverMetaDataObjects.add(new DefaultServerMetaData("server1", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
    serverMetaDataObjects.add(new DefaultServerMetaData("server2", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
    serverMetaDataObjects.add(new DefaultServerMetaData("server3", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
    serverMetaDataObjects.add(new DefaultServerMetaData("server4", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
    serverMetaDataObjects.add(new DefaultServerMetaData("server5", Collections.<String>emptyList(), Collections.<Integer, String>emptyMap(), Collections.<ServiceInfo>emptyList()));
    // When
    try {
        for (ServerMetaData serverMetaData : serverMetaDataObjects) {
            agentInfoSender.publishServerMetaData(serverMetaData);
        }
        waitExpectedRequestCount(requestCount, 5);
    } finally {
        closeAll(serverAcceptor, agentInfoSender, pinpointClient, clientFactory);
    }
    // Then
    assertEquals(5, requestCount.get());
    assertEquals(5, successCount.get());
}
Also used : PinpointClient(com.navercorp.pinpoint.rpc.client.PinpointClient) ArrayList(java.util.ArrayList) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) ServiceInfo(com.navercorp.pinpoint.bootstrap.context.ServiceInfo) PinpointClientFactory(com.navercorp.pinpoint.rpc.client.PinpointClientFactory) DefaultPinpointClientFactory(com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) PinpointServerAcceptor(com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor) TcpDataSender(com.navercorp.pinpoint.profiler.sender.TcpDataSender) DefaultServerMetaData(com.navercorp.pinpoint.profiler.context.DefaultServerMetaData) ServerMetaData(com.navercorp.pinpoint.bootstrap.context.ServerMetaData) DefaultServerMetaData(com.navercorp.pinpoint.profiler.context.DefaultServerMetaData) Test(org.junit.Test)

Aggregations

ServiceInfo (com.navercorp.pinpoint.bootstrap.context.ServiceInfo)3 ArrayList (java.util.ArrayList)2 ServerMetaData (com.navercorp.pinpoint.bootstrap.context.ServerMetaData)1 DefaultServerMetaData (com.navercorp.pinpoint.profiler.context.DefaultServerMetaData)1 TcpDataSender (com.navercorp.pinpoint.profiler.sender.TcpDataSender)1 DefaultPinpointClientFactory (com.navercorp.pinpoint.rpc.client.DefaultPinpointClientFactory)1 PinpointClient (com.navercorp.pinpoint.rpc.client.PinpointClient)1 PinpointClientFactory (com.navercorp.pinpoint.rpc.client.PinpointClientFactory)1 PinpointServerAcceptor (com.navercorp.pinpoint.rpc.server.PinpointServerAcceptor)1 TServerMetaData (com.navercorp.pinpoint.thrift.dto.TServerMetaData)1 TServiceInfo (com.navercorp.pinpoint.thrift.dto.TServiceInfo)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Test (org.junit.Test)1