use of com.navercorp.pinpoint.profiler.metadata.MetaDataType in project pinpoint by naver.
the class NioUdpDataSenderTest method sendTest1.
@Test
public void sendTest1() throws Exception {
NioUDPDataSender<MetaDataType> sender = newNioUdpDataSender();
int sendMessageCount = 10;
for (int i = 0; i < 10; i++) {
MetaDataType metaData = new StringMetaData(i, "test");
sender.send(metaData);
}
try {
waitMessageReceived(sendMessageCount);
} finally {
sender.stop();
}
}
use of com.navercorp.pinpoint.profiler.metadata.MetaDataType in project pinpoint by naver.
the class NioUdpDataSenderTest method exceedMessageSendTest.
@Test(expected = IOException.class)
public void exceedMessageSendTest() throws IOException {
String random = RandomStringUtils.randomAlphabetic(ThriftUdpMessageSerializer.UDP_MAX_PACKET_LENGTH + 100);
MetaDataType metaData = new StringMetaData(1, random);
NioUDPDataSender<MetaDataType> sender = newNioUdpDataSender();
sender.send(metaData);
waitMessageReceived(1);
}
use of com.navercorp.pinpoint.profiler.metadata.MetaDataType in project pinpoint by naver.
the class AgentGrpcDataSenderTestMain method request.
public void request() throws Exception {
MessageConverter<MetaDataType, GeneratedMessageV3> messageConverter = new GrpcMetadataMessageConverter();
HeaderFactory headerFactory = new AgentHeaderFactory(AGENT_ID, AGENT_NAME, APPLICATION_NAME, SERVICE_TYPE, START_TIME);
DnsExecutorServiceProvider dnsExecutorServiceProvider = new DnsExecutorServiceProvider();
GrpcNameResolverProvider grpcNameResolverProvider = new GrpcNameResolverProvider(dnsExecutorServiceProvider);
NameResolverProvider nameResolverProvider = grpcNameResolverProvider.get();
ChannelFactoryBuilder channelFactoryBuilder = new DefaultChannelFactoryBuilder("TestAgentGrpcDataSender");
channelFactoryBuilder.setHeaderFactory(headerFactory);
channelFactoryBuilder.setNameResolverProvider(nameResolverProvider);
channelFactoryBuilder.setClientOption(new ClientOption());
ChannelFactory channelFactory = channelFactoryBuilder.build();
AgentGrpcDataSender<MetaDataType> sender = new AgentGrpcDataSender<>("localhost", 9997, 1, messageConverter, reconnectExecutor, scheduledExecutorService, channelFactory, null);
AgentInfo agentInfo = newAgentInfo();
sender.request(agentInfo);
TimeUnit.SECONDS.sleep(60);
sender.stop();
}
use of com.navercorp.pinpoint.profiler.metadata.MetaDataType in project pinpoint by naver.
the class AgentGrpcDataSenderProvider method get.
@Override
public EnhancedDataSender<MetaDataType> get() {
final String collectorIp = grpcTransportConfig.getAgentCollectorIp();
final int collectorPort = grpcTransportConfig.getAgentCollectorPort();
final boolean sslEnable = grpcTransportConfig.isAgentSslEnable();
final int senderExecutorQueueSize = grpcTransportConfig.getAgentSenderExecutorQueueSize();
final ChannelFactoryBuilder channelFactoryBuilder = newChannelFactoryBuilder(sslEnable);
ChannelFactory channelFactory = channelFactoryBuilder.build();
final ReconnectExecutor reconnectExecutor = reconnectExecutorProvider.get();
final ProfilerCommandServiceLocator profilerCommandServiceLocator = createProfilerCommandServiceLocator(activeTraceRepository);
MessageConverter<MetaDataType, GeneratedMessageV3> messageConverter = this.messageConverter;
return newAgentGrpcDataSender(collectorIp, collectorPort, senderExecutorQueueSize, messageConverter, channelFactory, reconnectExecutor, retransmissionExecutor, profilerCommandServiceLocator);
}
use of com.navercorp.pinpoint.profiler.metadata.MetaDataType in project pinpoint by naver.
the class AgentInfoSenderTest method agentInfoShouldRetryUntilSuccess.
@Test
public void agentInfoShouldRetryUntilSuccess() {
final long agentInfoSendRetryIntervalMs = 100L;
final int maxTryPerAttempt = 3;
final int expectedTriesUntilSuccess = maxTryPerAttempt;
final ResponseServerMessageListenerFactory messageListenerFactory = new ResponseServerMessageListenerFactory(expectedTriesUntilSuccess);
ResponseServerMessageListener messageListener = messageListenerFactory.create();
TestPinpointServerAcceptor testPinpointServerAcceptor = new TestPinpointServerAcceptor(messageListenerFactory);
int bindPort = testPinpointServerAcceptor.bind();
PinpointClientFactory socketFactory = createPinpointClientFactory();
EnhancedDataSender<MetaDataType> dataSender = newTcpDataSender(socketFactory, bindPort);
AgentInfoSender agentInfoSender = new AgentInfoSender.Builder(dataSender, agentInfoFactory).maxTryPerAttempt(maxTryPerAttempt).sendInterval(agentInfoSendRetryIntervalMs).setMessageConverter(resultResponseMessageConverter).build();
try {
agentInfoSender.start();
waitExpectedRequestCount(expectedTriesUntilSuccess, messageListener);
} finally {
closeAll(agentInfoSender, socketFactory);
testPinpointServerAcceptor.close();
}
assertEquals(expectedTriesUntilSuccess, messageListener.getRequestCount());
assertEquals(1, messageListener.getSuccessCount());
}
Aggregations