Class NettyEventExecutorMetrics

java.lang.Object
io.micrometer.core.instrument.binder.netty4.NettyEventExecutorMetrics
All Implemented Interfaces:
MeterBinder

public class NettyEventExecutorMetrics extends Object implements MeterBinder
MeterBinder for Netty event executors.
Since:
1.11.0
See Also:
  • Constructor Details

    • NettyEventExecutorMetrics

      public NettyEventExecutorMetrics(Iterable<io.netty.util.concurrent.EventExecutor> eventExecutors)
      Create a binder instance for the given event executors.

      An EventLoopGroup (all its executors) can be instrumented at startup like:

       MeterRegistry registry = //...
       EventLoopGroup group = //...
       new NettyEventExecutorMetrics(group).bindTo(registry);
       
      Alternatively, an EventLoop can be instrumented at runtime during channel initialization. In this case, developers should ensure that this instance has not been registered already as re-binding metrics at runtime is inefficient here.
       @Override
       public void initChannel(SocketChannel channel) throws Exception {
         // this concurrent check must be implemented by micrometer users
         if (!isEventLoopInstrumented(channel.eventLoop())) {
           new EventExecutorMetrics(channel.eventLoop()).bindTo(registry);
         }
         //...
       }
       
      Parameters:
      eventExecutors - the event executors to instrument
  • Method Details