use of com.navercorp.pinpoint.grpc.AgentHeaderFactory in project pinpoint by naver.
the class MetadataClientMock method newChannelFactory.
private ChannelFactory newChannelFactory() {
HeaderFactory headerFactory = new AgentHeaderFactory("mockAgentId", "mockAgentName", "mockApplicationName", ServiceType.UNDEFINED.getCode(), System.currentTimeMillis());
ChannelFactoryBuilder channelFactoryBuilder = new DefaultChannelFactoryBuilder("MetadataClientMock");
channelFactoryBuilder.setHeaderFactory(headerFactory);
channelFactoryBuilder.setClientOption(new ClientOption());
return channelFactoryBuilder.build();
}
use of com.navercorp.pinpoint.grpc.AgentHeaderFactory in project pinpoint by naver.
the class SpanClientMock method newChannelFactory.
private ChannelFactory newChannelFactory() {
HeaderFactory headerFactory = new AgentHeaderFactory("mockAgentId", "mockAgentName", "mockApplicationName", ServiceType.UNDEFINED.getCode(), System.currentTimeMillis());
ChannelFactoryBuilder channelFactoryBuilder = new DefaultChannelFactoryBuilder("SpanClientMock");
final ClientInterceptor unaryCallDeadlineInterceptor = new UnaryCallDeadlineInterceptor(1000);
channelFactoryBuilder.addClientInterceptor(unaryCallDeadlineInterceptor);
final ClientInterceptor discardClientInterceptor = newDiscardClientInterceptor();
channelFactoryBuilder.addClientInterceptor(discardClientInterceptor);
channelFactoryBuilder.setHeaderFactory(headerFactory);
channelFactoryBuilder.setClientOption(new ClientOption());
return channelFactoryBuilder.build();
}
use of com.navercorp.pinpoint.grpc.AgentHeaderFactory 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();
}
Aggregations