Netty Metrics

1,598 views
Skip to first unread message

Florin Dragu

unread,
Jan 21, 2015, 5:56:06 PM1/21/15
to ne...@googlegroups.com
I'm looking to see if there are any netty 4.0.x based metrics extensions/plugins that can capture metrics similar to what Netflix did in rxnetty  or even more basic stuff like metrics integration for tcp/http based on something like codahale metrics?
Thanks,
Florin

Norman Maurer

unread,
Jan 22, 2015, 1:45:55 AM1/22/15
to ne...@googlegroups.com, Florin Dragu
I don’t think anything exists… That said, contributions welcome :)

-- 
Norman Maurer
--
You received this message because you are subscribed to the Google Groups "Netty discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netty/27ebf4b0-c95b-4018-9cc2-51adfdc87ba7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Florin Dragu

unread,
Jan 23, 2015, 11:28:14 AM1/23/15
to ne...@googlegroups.com, fdr...@gmail.com
I started looking at what both rxnetty and vert.x are doing for capturing metrics. 
Is there any particular design you had in mind for a pure netty approach?

Leonardo Gomes

unread,
Jan 27, 2015, 10:52:18 AM1/27/15
to ne...@googlegroups.com, fdr...@gmail.com
I could give a hand if you go for it. I would love to have those metrics directly into Netty as well.

Cheers,
Leo

Leonardo Gomes

unread,
Jan 28, 2015, 2:38:52 PM1/28/15
to ne...@googlegroups.com, fdr...@gmail.com
I had a quick look and it seems that this is an old topic going around since 2012:
https://developer.jboss.org/wiki/Netty4AndJMXIntegration

I've seen also a presentation from Norman mentioning that it would be the subject of a GSOC.

Any news/status?

There's a chance I could even work on it during my working-hours, so I'm really interested.

Peace,
Leo.

Florin Dragu

unread,
Jan 28, 2015, 6:48:19 PM1/28/15
to ne...@googlegroups.com, fdr...@gmail.com, leonardo...@gmail.com
Not much progress yet - I hope to get to it starting on Mon. In the mean time I'll look at the post you sent bellow.
To unsubscribe from this group and stop receiving emails from it, send an email to netty+unsubscribe@googlegroups.com.

Leonardo Gomes

unread,
Jan 30, 2015, 7:55:05 PM1/30/15
to Florin Dragu, ne...@googlegroups.com
Found this as well, which is introducing some metrics: https://github.com/netty/netty/pull/2788

Florin Dragu

unread,
Feb 3, 2015, 7:52:23 PM2/3/15
to ne...@googlegroups.com, fdr...@gmail.com, leonardo...@gmail.com
After looking at previous posts/ideas and studying RxNetty and Vert.x I am thinking we could have metrics for the following groups (more or less):
  • Server/Client Bootstrap
  • Event Loop Group - Boss
  • Event Loop Group - Workers
  • Channel
  • Channel Initializer
  • Channel Pipeline
  • Channel Inbound Handler
  • Channel Outbound Handler
  • TCP
  • HTTP
  • UDP
To capture the metrics and make them available we could have a MetricsPublisher or Collector that receives metric events (similar to RxNetty metrics) and distribute them to registered metrics listeners. The collector would have some config that allows different levels of instrumentation (low, mid, high).
There can be different metric listener implementation - one could be for codahale metrics, but it should be able to allow other implementations.
 
In terms of integrating into Netty there are 2 options:
  1. Create the hooks directly in netty code for metrics collection/instrumentation (no bytecode manipulation) - this allows to collect everything we want, but every time we want to collect another thing it requires a change to netty code base
  2. Create a netty extension for metrics collection (special handlers, etc) that collects metrics by using the official hooks and available listeners - this allows to keep the netty code clean, but may not have easy access to all events/metrics
Thoughts?

Florin

Leonardo Gomes

unread,
Feb 17, 2015, 12:00:18 PM2/17/15
to ne...@googlegroups.com, Florin Dragu
@Norman, Trustin: It would be nice to have your opinion here :)
Especially because https://github.com/netty/netty/pull/2788 has not been merged and it provides already some metrics, so I'm wondering that you probably already have an idea of what you'd like to see implemented.

Cheers,
Leo

Florin Dragu

unread,
Feb 18, 2015, 1:40:01 PM2/18/15
to ne...@googlegroups.com, fdr...@gmail.com, leonardo...@gmail.com
I have something working for what my team built on top on Netty4 to support mainly Restful endpoints - it can't be used in Netty as is, but I'll outline what I did:

I am using Codahale metrics (core, jvm and graphite jars) and a MetricsEvent extensible enum (that currently only has these 3 events REQUEST_RECEIVED, RESPONSE_SENT, RESPONSE_WRITE_FAILED).

I have a MetricsCollector that has this method void onEvent(MetricsEvent event, Object value)
and based on these 3 events and the object (in my case the object is a request state object I created and that I keep on the ChannelHandlerContext as an attribute to hold state all along the channel pipeline) I capture these metrics about the app and about the endpoints exposed: 
 - JVM metrics: gc, buffers, memory, threads 
 - App config properties; 
 - Counter inflightRequests; 
 - Counter processedRequests; 
 - Counter failedRequests; 
 - Counter responseWriteFailed; 
 - Histogram responseSizes; 
 - Histogram requestSizes; 
 - Timer getRequests; 
 - Timer postRequests; 
 - Timer putRequests; 
 - Timer deleteRequests; 
 - Timer otherRequests; 
 - Timer requests; 
 - Meter[] responses; // 1xx, 2xx, 3xx, 4xx, 5xx 
 - Map<String, Timer> restEndpointRequestsTimers; // API endpoints by matching path 
 - Map<String, Meter[]> restEndpointResponsesMeters; // API endpoints by matching path and 1xx, 2xx, 3xx, 4xx, 5xx for each endpoint

Cheers,
Florin
Reply all
Reply to author
Forward
0 new messages