diff --git a/core/src/main/java/com/linecorp/armeria/common/metric/MoreMeterBinders.java b/core/src/main/java/com/linecorp/armeria/common/metric/MoreMeterBinders.java index 1e569e408cc..4c82f8d993c 100644 --- a/core/src/main/java/com/linecorp/armeria/common/metric/MoreMeterBinders.java +++ b/core/src/main/java/com/linecorp/armeria/common/metric/MoreMeterBinders.java @@ -25,10 +25,13 @@ import com.google.common.collect.ImmutableList; +import com.linecorp.armeria.common.Flags; import com.linecorp.armeria.common.annotation.UnstableApi; import com.linecorp.armeria.internal.common.util.CertificateUtil; import io.micrometer.core.instrument.binder.MeterBinder; +import io.micrometer.core.instrument.binder.netty4.NettyAllocatorMetrics; +import io.netty.buffer.PooledByteBufAllocator; import io.netty.channel.EventLoopGroup; /** @@ -36,6 +39,12 @@ */ public final class MoreMeterBinders { + static { + // Bind the default Netty allocator metrics to the default MeterRegistry. + new NettyAllocatorMetrics(PooledByteBufAllocator.DEFAULT) + .bindTo(Flags.meterRegistry()); + } + /** * Returns a new {@link MeterBinder} to observe Netty's {@link EventLoopGroup}s. The following stats are * currently exported per registered {@link MeterIdPrefix}.