Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Build Status Download OpenTracing Badge

OpenTracing Java Netty Server Instrumentation

This library provides instrumentation tracing decorators for Netty's Http Codec 4.x.

Initialization

ServerBootstrap b = new ServerBootstrap();
b.option(ChannelOption.SO_BACKLOG, 1024);
ChannelInitializer<Channel> initializer = new ChannelInitializer<Channel>() {
@Override
 protected void initChannel(final Channel ch) throws Exception {
  ChannelPipeline p = ch.pipeline();
  p.addLast(new HttpServerCodec());
  p.addLast(new NettyTracingServerHandler(tracer,
                                          decorators(),
                                          Pattern.compile("/health")));
  p.addLast(new Handler());
    }
  };
b.group(parentGroup, childGroup).channel(NioServerSocketChannel.class).childHandler(initializer);

Channel ch = b.bind(0).sync().channel();
port = ((InetSocketAddress) ch.localAddress()).getPort();

Trace Decorators

A default decorator is provider. You can add your own by implementing NettyHttpSpanDecorator

Accessing Server Span

Current server span accessible via attr .

Span span = ctx.channel().attr(NettyHttpTracing.SPAN_ATTRIBUTE).get();
   

Development

./gradlew clean check

Special Thanks

Release

Follow instructions in RELEASE

About

Netty Opentracing integration

Topics

Resources

License

Packages

No packages published