An open API service indexing awesome lists of open source software.

https://github.com/jcustenborder/netty-codec-statsd

Netty decoder for StatsD
https://github.com/jcustenborder/netty-codec-statsd

netty statsd

Last synced: about 2 months ago
JSON representation

Netty decoder for StatsD

Awesome Lists containing this project

README

          

## Introduction

This project is an implementation of the StatsD protocol for [Netty](http://netty.io/). Currently there is only support for
the UDP protocol. More than one entry can be sent by separating each entry with a new line.

## Usage

```
b = new Bootstrap();
b.group(bossGroup)
.channel(NioDatagramChannel.class)
.handler(new ChannelInitializer() {
@Override
protected void initChannel(DatagramChannel datagramChannel) throws Exception {
ChannelPipeline channelPipeline = datagramChannel.pipeline();
channelPipeline.addLast(
new LoggingHandler("StatsD", LogLevel.TRACE),
new StatsDRequestDecoder(),
new StatsDRequestHandler(config, records, time)
);
}
});
```

Each metric that is found will be passed along in the pipeline.

```
class StatsDRequestHandler extends SimpleChannelInboundHandler {
@Override
protected void channelRead0(ChannelHandlerContext channelHandlerContext, Metric metric) throws Exception {

}
}
```