Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically register the metics of PooledByteBufAllocator.DEFAULT #5916

Merged
merged 9 commits into from
Nov 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,26 @@

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;

/**
* Provides useful {@link MeterBinder}s to monitor various Armeria components.
*/
public final class MoreMeterBinders {

static {
// Bind the default Netty allocator metrics to the default MeterRegistry.
new NettyAllocatorMetrics(PooledByteBufAllocator.DEFAULT)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: armeria always initializes this class when a client or server is built

.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}.
Expand Down
Loading