Class NettyEventExecutorMetrics
java.lang.Object
io.micrometer.core.instrument.binder.netty4.NettyEventExecutorMetrics
- All Implemented Interfaces:
MeterBinder
MeterBinder
for Netty event executors.- Since:
- 1.11.0
- See Also:
-
Constructor Summary
ConstructorDescriptionNettyEventExecutorMetrics
(Iterable<io.netty.util.concurrent.EventExecutor> eventExecutors) Create a binder instance for the given event executors. -
Method Summary
-
Constructor Details
-
NettyEventExecutorMetrics
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, anEventLoop
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
-
bindTo
- Specified by:
bindTo
in interfaceMeterBinder
-