private void register() {
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberDirectArenas"),
        (Gauge<Integer>) this::getNumDirectArenas);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberHeapArenas"),
        (Gauge<Integer>) this::getNumHeapArenas);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberThreadLocalCaches"),
        (Gauge<Integer>) this::getNumThreadLocalCaches);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "UsedHeapMemory"),
        (Gauge<Long>) this::getUsedHeapMemory);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "UsedDirectMemory"),
        (Gauge<Long>) this::getUsedDirectMemory);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "PinnedHeapMemory"),
        (Gauge<Long>) this::getPinnedHeapMemory);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "PinnedDirectMemory"),
        (Gauge<Long>) this::getPinnedDirectMemory);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberHeapTotalAllocations"),
        (Gauge<Long>) this::getNumHeapTotalAllocations);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberHeapTotalDeallocations"),
        (Gauge<Long>) this::getNumHeapTotalDeallocations);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberHeapTotalActiveAllocations"),
        (Gauge<Long>) this::getNumHeapTotalActiveAllocations);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberDirectTotalAllocations"),
        (Gauge<Long>) this::getNumDirectTotalAllocations);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberDirectTotalDeallocations"),
        (Gauge<Long>) this::getNumDirectTotalDeallocations);
    registry.register(MetricRegistry.name(NettyInternalMetrics.class, "NumberDirectTotalActiveAllocations"),
        (Gauge<Long>) this::getNumDirectTotalActiveAllocations);
  }
Constructor to create a {@link NettyInternalMetrics};
@param registry Registry to registry the metrics.
@param config {@link NettyConfig}.
ambry-commons/src/main/java/com/github/ambry/commons/NettyInternalMetrics.java