Skip to content

Commit 8cad48f

Browse files
dependabot[bot]devops
authored and
devops
committed
Bump io.netty:netty-bom from 4.1.119.Final to 4.2.0.Final
1 parent 3b1aaf3 commit 8cad48f

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

docs/src/test/java/io/micrometer/docs/netty/NettyMetricsTests.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,12 @@
2828
import io.netty.buffer.ByteBufAllocatorMetricProvider;
2929
import io.netty.buffer.UnpooledByteBufAllocator;
3030
import io.netty.channel.ChannelInitializer;
31-
import io.netty.channel.DefaultEventLoopGroup;
3231
import io.netty.channel.EventLoop;
33-
import io.netty.channel.nio.NioEventLoopGroup;
32+
import io.netty.channel.local.LocalIoHandler;
33+
import io.netty.channel.MultithreadEventLoopGroup;
34+
import io.netty.channel.MultiThreadIoEventLoopGroup;
35+
import io.netty.channel.nio.NioIoHandler;
36+
import io.netty.channel.SingleThreadIoEventLoop;
3437
import io.netty.channel.socket.SocketChannel;
3538
import io.netty.channel.socket.nio.NioSocketChannel;
3639
import io.netty.util.concurrent.SingleThreadEventExecutor;
@@ -54,7 +57,7 @@ void directInstrumentationExample() throws Exception {
5457
Set<String> names = new LinkedHashSet<>();
5558
// tag::directInstrumentation[]
5659
// Create or get an existing resources
57-
DefaultEventLoopGroup eventExecutors = new DefaultEventLoopGroup();
60+
MultithreadEventLoopGroup eventExecutors = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
5861
UnpooledByteBufAllocator unpooledByteBufAllocator = new UnpooledByteBufAllocator(false);
5962
// Use binders to instrument them
6063
new NettyEventExecutorMetrics(eventExecutors).bindTo(this.registry);
@@ -84,18 +87,18 @@ void directInstrumentationExample() throws Exception {
8487

8588
@Test
8689
void shouldInstrumentEventLoopDuringChannelInit() throws Exception {
87-
NioEventLoopGroup eventExecutors = new NioEventLoopGroup();
90+
MultiThreadIoEventLoopGroup eventExecutors = new MultiThreadIoEventLoopGroup(NioIoHandler.newFactory());
8891
CustomChannelInitializer channelInitializer = new CustomChannelInitializer(this.registry);
8992
NioSocketChannel channel = new NioSocketChannel();
9093
eventExecutors.register(channel).await();
9194
channelInitializer.initChannel(channel);
9295
assertThat(this.registry.get(NettyMeters.EVENT_EXECUTOR_TASKS_PENDING.getName())
93-
.tags(Tags.of("name", channel.eventLoop().threadProperties().name()))
96+
.tags(Tags.of("name", ((SingleThreadIoEventLoop) channel.eventLoop()).threadProperties().name()))
9497
.gauge()
9598
.value()).isZero();
9699
ByteBuf buffer = channel.alloc().buffer();
97100
Tags tags = Tags.of("id", String.valueOf(channel.alloc().hashCode()), "allocator.type",
98-
"PooledByteBufAllocator", "memory.type", "direct");
101+
"AdaptiveByteBufAllocator", "memory.type", "direct");
99102
assertThat(this.registry.get(NettyMeters.ALLOCATOR_MEMORY_USED.getName()).tags(tags).gauge().value())
100103
.isPositive();
101104
buffer.release();

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ maven-resolver = "1.9.22"
5858
mockito4 = "4.11.0"
5959
mockito5 = "5.11.0"
6060
mongo = "4.11.5"
61-
netty = "4.1.119.Final"
61+
netty = "4.2.0.Final"
6262
newrelic-api = "5.14.0"
6363
# Kotlin 1.7 sample will fail from OkHttp 4.12.0 due to okio dependency being a Kotlin 1.9 module
6464
okhttp = "4.11.0"

micrometer-core/src/test/java/io/micrometer/core/instrument/binder/netty4/NettyEventExecutorMetricsTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717

1818
import io.micrometer.core.instrument.Tags;
1919
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
20-
import io.netty.channel.DefaultEventLoopGroup;
2120
import io.netty.channel.EventLoop;
21+
import io.netty.channel.MultiThreadIoEventLoopGroup;
22+
import io.netty.channel.MultithreadEventLoopGroup;
23+
import io.netty.channel.local.LocalIoHandler;
2224
import io.netty.util.concurrent.SingleThreadEventExecutor;
2325
import org.junit.jupiter.api.Test;
2426

@@ -40,7 +42,7 @@ class NettyEventExecutorMetricsTests {
4042
@Test
4143
void shouldHaveTasksPendingMetricForEachEventLoop() throws Exception {
4244
Set<String> names = new LinkedHashSet<>();
43-
DefaultEventLoopGroup eventExecutors = new DefaultEventLoopGroup();
45+
MultithreadEventLoopGroup eventExecutors = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
4446
new NettyEventExecutorMetrics(eventExecutors).bindTo(this.registry);
4547
eventExecutors.spliterator().forEachRemaining(eventExecutor -> {
4648
if (eventExecutor instanceof SingleThreadEventExecutor) {
@@ -60,7 +62,7 @@ void shouldHaveTasksPendingMetricForEachEventLoop() throws Exception {
6062

6163
@Test
6264
void shouldHaveTasksPendingMetricForSingleEventLoop() throws Exception {
63-
DefaultEventLoopGroup eventExecutors = new DefaultEventLoopGroup();
65+
MultithreadEventLoopGroup eventExecutors = new MultiThreadIoEventLoopGroup(LocalIoHandler.newFactory());
6466
EventLoop eventLoop = eventExecutors.next();
6567
new NettyEventExecutorMetrics(eventLoop).bindTo(this.registry);
6668
assertThat(eventLoop).isInstanceOf(SingleThreadEventExecutor.class);

0 commit comments

Comments
 (0)