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;
}
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);
}
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());
}
Aggregations