private void metricsOfPoolArena()

in artemis-server/src/main/java/org/apache/activemq/artemis/core/server/metrics/NettyPooledAllocatorMetrics.java [113:273]


   private void metricsOfPoolArena(final MeterRegistry registry,
                                   final PoolArenaMetric poolArenaMetric,
                                   final int poolArenaIndex,
                                   final String poolArenaType) {
      // the number of thread caches backed by this arena.
      final String poolArenaIndexString = Integer.toString(poolArenaIndex);
      Gauge.builder("netty.pooled.arena.threadcaches.num", poolArenaMetric, metric -> metric.numThreadCaches())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString)
         .description("The number of thread caches backed by this arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.allocations.num", poolArenaMetric,
         metric -> metric.numAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "all")
         .description("The number of allocations done via the arena. This includes all sizes")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.allocations.num", poolArenaMetric,
         metric -> metric.numTinyAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "tiny")
         .description("The number of tiny allocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.allocations.num", poolArenaMetric,
         metric -> metric.numSmallAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "small")
         .description("The number of small allocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.allocations.num", poolArenaMetric,
         metric -> metric.numNormalAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "normal")
         .description("The number of normal allocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.allocations.num", poolArenaMetric,
         metric -> metric.numHugeAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "huge")
         .description("The number of huge allocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.deallocations.num", poolArenaMetric,
         metric -> metric.numDeallocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "all")
         .description("The number of deallocations done via the arena. This includes all sizes")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.deallocations.num", poolArenaMetric,
         metric -> metric.numTinyDeallocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "tiny")
         .description("The number of tiny deallocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.deallocations.num", poolArenaMetric,
         metric -> metric.numSmallDeallocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "small")
         .description("The number of small deallocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.deallocations.num", poolArenaMetric,
         metric -> metric.numNormalDeallocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "normal")
         .description("The number of normal deallocations done via the arena")
         .register(registry);

      FunctionCounter.builder("netty.pooled.arena.deallocations.num", poolArenaMetric,
         metric -> metric.numHugeDeallocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "huge")
         .description("The number of huge deallocations done via the arena")
         .register(registry);

      Gauge.builder("netty.pooled.arena.active.allocations.num", poolArenaMetric,
         metric -> metric.numActiveAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "all")
         .description("The number of currently active allocations")
         .register(registry);

      Gauge.builder("netty.pooled.arena.active.allocations.num", poolArenaMetric,
         metric -> metric.numActiveTinyAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "tiny")
         .description("The number of currently active tiny allocations")
         .register(registry);

      Gauge.builder("netty.pooled.arena.active.allocations.num", poolArenaMetric,
         metric -> metric.numActiveSmallAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "small")
         .description("The number of currently active small allocations")
         .register(registry);

      Gauge.builder("netty.pooled.arena.active.allocations.num", poolArenaMetric,
         metric -> metric.numActiveNormalAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "normal")
         .description("The number of currently active normal allocations")
         .register(registry);

      Gauge.builder("netty.pooled.arena.active.allocations.num", poolArenaMetric,
         metric -> metric.numActiveHugeAllocations())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "huge")
         .description("The number of currently active huge allocations")
         .register(registry);

      Gauge.builder("netty.pooled.arena.active.allocated.num", poolArenaMetric,
         metric -> metric.numActiveBytes())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString)
         .description("The number of active bytes that are currently allocated by the arena")
         .baseUnit(BYTES_UNIT).register(registry);

      Gauge.builder("netty.pooled.arena.chunk.num", poolArenaMetric,
         metric -> metric.numChunkLists())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString)
         .description("The number of chunk lists for the arena")
         .register(registry);

      Gauge.builder("netty.pooled.arena.subpages.num", poolArenaMetric,
         metric -> metric.numTinySubpages())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "tiny")
         .description("The number of tiny sub-pages for the arena")
         .register(registry);

      Gauge.builder("netty.pooled.arena.subpages.num", poolArenaMetric,
         metric -> metric.numSmallSubpages())
         .tags(commonTags)
         .tags("pool_arena_type", poolArenaType, "pool_arena_index", poolArenaIndexString, "size", "small")
         .description("The number of small sub-pages for the arena")
         .register(registry);

      List<PoolChunkListMetric> poolChunkListMetrics = poolArenaMetric.chunkLists();
      assert poolChunkListMetrics.size() == 6;
      for (PoolChunkListMetric poolChunkListMetric : poolChunkListMetrics) {
         final String poolChunkListType = usageTypeOf(poolChunkListMetric);
         metricsOfPoolChunkListMetric(registry, poolChunkListMetric, poolArenaIndexString, poolArenaType, poolChunkListType);
      }
      // smallSubpages metrics
      metricsOfPoolSubpageMetric(registry, poolArenaMetric, PoolArenaMetric::smallSubpages,
                                 poolArenaIndexString, poolArenaType, "small");
      // tinySubpages metrics
      metricsOfPoolSubpageMetric(registry, poolArenaMetric, PoolArenaMetric::tinySubpages,
                                 poolArenaIndexString, poolArenaType, "tiny");



   }