Search in sources :

Example 1 with AgentHeaderFactory

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();
}
Also used : HeaderFactory(com.navercorp.pinpoint.grpc.client.HeaderFactory) AgentHeaderFactory(com.navercorp.pinpoint.grpc.AgentHeaderFactory) ClientOption(com.navercorp.pinpoint.grpc.client.config.ClientOption) AgentHeaderFactory(com.navercorp.pinpoint.grpc.AgentHeaderFactory) ChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.ChannelFactoryBuilder) DefaultChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder) DefaultChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder)

Example 2 with AgentHeaderFactory

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();
}
Also used : UnaryCallDeadlineInterceptor(com.navercorp.pinpoint.grpc.client.UnaryCallDeadlineInterceptor) DiscardClientInterceptor(com.navercorp.pinpoint.grpc.client.interceptor.DiscardClientInterceptor) ClientInterceptor(io.grpc.ClientInterceptor) HeaderFactory(com.navercorp.pinpoint.grpc.client.HeaderFactory) AgentHeaderFactory(com.navercorp.pinpoint.grpc.AgentHeaderFactory) ClientOption(com.navercorp.pinpoint.grpc.client.config.ClientOption) AgentHeaderFactory(com.navercorp.pinpoint.grpc.AgentHeaderFactory) ChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.ChannelFactoryBuilder) DefaultChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder) DefaultChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder)

Example 3 with AgentHeaderFactory

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();
}
Also used : NameResolverProvider(io.grpc.NameResolverProvider) GrpcNameResolverProvider(com.navercorp.pinpoint.profiler.context.provider.grpc.GrpcNameResolverProvider) HeaderFactory(com.navercorp.pinpoint.grpc.client.HeaderFactory) AgentHeaderFactory(com.navercorp.pinpoint.grpc.AgentHeaderFactory) ChannelFactory(com.navercorp.pinpoint.grpc.client.ChannelFactory) ChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.ChannelFactoryBuilder) DefaultChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder) DefaultChannelFactoryBuilder(com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder) MetaDataType(com.navercorp.pinpoint.profiler.metadata.MetaDataType) GrpcNameResolverProvider(com.navercorp.pinpoint.profiler.context.provider.grpc.GrpcNameResolverProvider) GrpcMetadataMessageConverter(com.navercorp.pinpoint.profiler.context.grpc.GrpcMetadataMessageConverter) AgentInfo(com.navercorp.pinpoint.profiler.metadata.AgentInfo) DnsExecutorServiceProvider(com.navercorp.pinpoint.profiler.context.provider.grpc.DnsExecutorServiceProvider) ClientOption(com.navercorp.pinpoint.grpc.client.config.ClientOption) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) AgentHeaderFactory(com.navercorp.pinpoint.grpc.AgentHeaderFactory)

Aggregations

AgentHeaderFactory (com.navercorp.pinpoint.grpc.AgentHeaderFactory)3 ChannelFactoryBuilder (com.navercorp.pinpoint.grpc.client.ChannelFactoryBuilder)3 DefaultChannelFactoryBuilder (com.navercorp.pinpoint.grpc.client.DefaultChannelFactoryBuilder)3 HeaderFactory (com.navercorp.pinpoint.grpc.client.HeaderFactory)3 ClientOption (com.navercorp.pinpoint.grpc.client.config.ClientOption)3 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 ChannelFactory (com.navercorp.pinpoint.grpc.client.ChannelFactory)1 UnaryCallDeadlineInterceptor (com.navercorp.pinpoint.grpc.client.UnaryCallDeadlineInterceptor)1 DiscardClientInterceptor (com.navercorp.pinpoint.grpc.client.interceptor.DiscardClientInterceptor)1 GrpcMetadataMessageConverter (com.navercorp.pinpoint.profiler.context.grpc.GrpcMetadataMessageConverter)1 DnsExecutorServiceProvider (com.navercorp.pinpoint.profiler.context.provider.grpc.DnsExecutorServiceProvider)1 GrpcNameResolverProvider (com.navercorp.pinpoint.profiler.context.provider.grpc.GrpcNameResolverProvider)1 AgentInfo (com.navercorp.pinpoint.profiler.metadata.AgentInfo)1 MetaDataType (com.navercorp.pinpoint.profiler.metadata.MetaDataType)1 ClientInterceptor (io.grpc.ClientInterceptor)1 NameResolverProvider (io.grpc.NameResolverProvider)1