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.

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);
  }
  //...
}
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.
      Parameters:
      eventExecutors - the event executors to instrument
    • NettyEventExecutorMetrics

      public NettyEventExecutorMetrics(Iterable<io.netty.util.concurrent.EventExecutor> eventExecutors, Iterable<Tag> tags)
      Create a binder instance for the given event executors with tags applied to all Meters created by this binder.
      Parameters:
      eventExecutors - the event executors to instrument
      tags - tags to apply to all Meters
      Since:
      1.16.0
  • Method Details