Search in sources :

Example 1 with HeaderPropagationInterceptor

use of com.navercorp.pinpoint.grpc.server.HeaderPropagationInterceptor in project pinpoint by naver.

the class SpanServerTestMain method run.

public void run() throws Exception {
    // InternalLoggerFactory.setDefaultFactory(Log4J2LoggerFactory.INSTANCE);
    Logger logger = Logger.getLogger("io.grpc");
    logger.setLevel(Level.FINER);
    logger.addHandler(new ConsoleHandler());
    GrpcReceiver grpcReceiver = new GrpcReceiver();
    grpcReceiver.setBeanName("TraceServer");
    BindAddress.Builder builder = BindAddress.newBuilder();
    builder.setIp(IP);
    builder.setPort(PORT);
    grpcReceiver.setBindAddress(builder.build());
    Executor executor = newWorkerExecutor(8);
    ServerServiceDefinition bindableService = newSpanBindableService(executor);
    grpcReceiver.setBindableServiceList(Collections.singletonList(bindableService));
    grpcReceiver.setAddressFilter(new MockAddressFilter());
    grpcReceiver.setExecutor(Executors.newFixedThreadPool(8));
    grpcReceiver.setEnable(true);
    grpcReceiver.setServerOption(ServerOption.newBuilder().build());
    AgentHeaderReader agentHeaderReader = new AgentHeaderReader("test");
    HeaderPropagationInterceptor interceptor = new HeaderPropagationInterceptor(agentHeaderReader);
    grpcReceiver.setServerInterceptorList(Arrays.asList(interceptor));
    // for(int i = 0; i < 9999; i++) {
    grpcReceiver.afterPropertiesSet();
    grpcReceiver.blockUntilShutdown();
// TimeUnit.SECONDS.sleep(30);
// System.out.println("###### SHUTDOWN");
// grpcReceiver.destroy();
// grpcReceiver.blockUntilShutdown();
// System.out.println("###### START");
// TimeUnit.SECONDS.sleep(30);
}
Also used : AgentHeaderReader(com.navercorp.pinpoint.grpc.server.AgentHeaderReader) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Executor(java.util.concurrent.Executor) BindAddress(com.navercorp.pinpoint.collector.receiver.BindAddress) HeaderPropagationInterceptor(com.navercorp.pinpoint.grpc.server.HeaderPropagationInterceptor) ServerServiceDefinition(io.grpc.ServerServiceDefinition) Logger(java.util.logging.Logger) ConsoleHandler(java.util.logging.ConsoleHandler)

Example 2 with HeaderPropagationInterceptor

use of com.navercorp.pinpoint.grpc.server.HeaderPropagationInterceptor in project pinpoint by naver.

the class HeaderServerInterceptorFactory method newServerInterceptors.

private List<ServerInterceptor> newServerInterceptors(String name) {
    HeaderReader<Header> headerReader = new AgentHeaderReader(name);
    ServerInterceptor interceptor = new HeaderPropagationInterceptor(headerReader);
    return Arrays.asList(interceptor);
}
Also used : AgentHeaderReader(com.navercorp.pinpoint.grpc.server.AgentHeaderReader) Header(com.navercorp.pinpoint.grpc.Header) HeaderPropagationInterceptor(com.navercorp.pinpoint.grpc.server.HeaderPropagationInterceptor) ServerInterceptor(io.grpc.ServerInterceptor)

Aggregations

AgentHeaderReader (com.navercorp.pinpoint.grpc.server.AgentHeaderReader)2 HeaderPropagationInterceptor (com.navercorp.pinpoint.grpc.server.HeaderPropagationInterceptor)2 BindAddress (com.navercorp.pinpoint.collector.receiver.BindAddress)1 Header (com.navercorp.pinpoint.grpc.Header)1 ServerInterceptor (io.grpc.ServerInterceptor)1 ServerServiceDefinition (io.grpc.ServerServiceDefinition)1 Executor (java.util.concurrent.Executor)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ConsoleHandler (java.util.logging.ConsoleHandler)1 Logger (java.util.logging.Logger)1