Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we also trace the netty client and server? #2108

Open
duwupeng opened this issue Sep 27, 2016 · 5 comments
Open

Can we also trace the netty client and server? #2108

duwupeng opened this issue Sep 27, 2016 · 5 comments
Labels

Comments

@duwupeng
Copy link

duwupeng commented Sep 27, 2016

@Xylus Can we also trace the netty client and netty server?

 Server: 
 @Override
    public void start() {
        LOGGER.info("Bind Local Port {} [Netty]", port);

        new Thread("NettyContainer-Thread") {
            @Override
            public void run() {
                try {
                    bootstrap = new ServerBootstrap();

                    bootstrap.group(bossGroup, workerGroup)
                            .channel(NioServerSocketChannel.class)
                            .childHandler(new ChannelInitializer<SocketChannel>() {
                                @Override
                                protected void initChannel(SocketChannel ch) throws Exception {
                                    ch.pipeline().addLast(new IdleStateHandler(15, 0, 0), new SoaDecoder(), new SoaIdleHandler(), new SoaServerHandler(ProcessorCache.getProcessorMap()));
                                }
                            })
                            .option(ChannelOption.SO_BACKLOG, 1024)
                            .option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT)//重复利用之前分配的内存空间(PooledByteBuf -> ByteBuf)
                            .childOption(ChannelOption.SO_KEEPALIVE, true)
                            .childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);

                    // Start the server.
                    ChannelFuture f = bootstrap.bind(port).sync();

                    // Wait until the connection is closed.
                    f.channel().closeFuture().sync();
                } catch (InterruptedException e) {
                    LOGGER.error(e.getMessage(), e);
                } finally {
                    workerGroup.shutdownGracefully();
                    bossGroup.shutdownGracefully();
                }
            }
        }.start();
    }```


Client: 

  b = new Bootstrap();
        b.group(workerGroup);
        b.channel(NioSocketChannel.class);
        b.option(ChannelOption.SO_KEEPALIVE, true);
        b.option(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
        b.handler(new ChannelInitializer<SocketChannel>() {
            @Override
            public void initChannel(SocketChannel ch) throws Exception {
                ch.pipeline().addLast(new IdleStateHandler(readerIdleTimeSeconds, writerIdleTimeSeconds, allIdleTimeSeconds), new SoaDecoder(), new SoaIdleHandler(), new SoaClientHandler(callBack));
            }
        });
        return b;

For more information, could you refer to the https://github.com/isuwang/isuwang-soa/blob/master/dapeng-container/src/main/java/com/isuwang/dapeng/container/netty/NettyContainer.java

https://github.com/isuwang/isuwang-soa/blob/master/dapeng-remoting/dapeng-remoting-netty/src/main/java/com/isuwang/dapeng/remoting/netty/SoaClient.java
@iwin4aids
Copy link

UP,,,I was looking forward to a netty trace support also :))

@duwupeng duwupeng changed the title Can we also trace the netty server? Can we also trace the netty client and server? Sep 27, 2016
@Xylus Xylus added the proposal label Oct 3, 2016
@jiaqifeng
Copy link
Contributor

Pinpoint supports Jetty which using Netty. The key point is that Netty is a transport lib, you can not find a common trace start entry in it, and for tcp and udp there are no common way to insert the span info into the packet to continue the trace too.

@jiaqifeng
Copy link
Contributor

What I mean is that there could not be a common plugin for netty but you could write a plugin for your app in a level above netty.

@hwxhh
Copy link

hwxhh commented Mar 29, 2019

hello,I want to monitor the trace of netty progresses;how can I do for it!

@Fire4star
Copy link

What I mean is that there could not be a common plugin for netty but you could write a plugin for your app in a level above netty.

Hello, is there any way to monitor the trace of Netty ServerBootstrap port and application

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants