Netty Opentracing integration
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config/checkstyle
gradle/wrapper
opentracing-netty-server
travis
.gitignore
.travis.yml
LICENSE
README.md
RELEASE.md
build.gradle
gradle.properties
gradlew
gradlew.bat
settings.gradle

README.md

Build Status Download OpenTracing Badge

OpenTracing Java Netty Server Instrumentation

This library provides instrumentation for Java Netty Server applications.

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